Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > Direct3D

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D
hacking programming reversing
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

D3DXSprite quality?
Old 08-24-2010, 06:18 PM   #1
Senior Member

Kosaki's Avatar

Join Date: Aug 2009
Posts: 89
Reputation: 2974
Rep Power: 60
Kosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating community
Disc Dash Champion
Points: 3,422, Level: 5
Points: 3,422, Level: 5 Points: 3,422, Level: 5 Points: 3,422, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
D3DXSprite quality?

Hello,

I have stumbled upon another problem when writing my gfx toolkit.
It seems like the quality D3DXSprite renders with is too bad.

My fonts are basically 256x256 textures containing all the ASCII characters.
As you can see in the picture below it is not precise enough.



As you can see the quality is not usable for drawing text at this time.
Does anyone have any ideas on how to improve the quality?

The original texture:


If you guys want my rather simple drawing function for the text:
Code:
HRESULT TextRenderer::DrawStrokedText( char *text, int x, int y, DWORD color )
{
	FVEC2 currentPos = {(float)x, (float)y};
	for(int i = 0; text[i]; i++)
	{
		RECT bounds;
		bounds.left = (text[i] % 16)*16; // 16 characters per row
		bounds.top = text[i] & 0xF0; // 16 rows
		bounds.right = bounds.left + 16;
		bounds.bottom = bounds.top + 16;
		m_pGFXToolkit->DrawSprite(IDB_CONSALAS_STROKED, &currentPos, &bounds, color);
		currentPos.x += m_fontWidths[text[i]]+3;
	}
	return S_OK;
}
It is only a prototype of the TextRenderer class I am making so some stuff is hardcoded. (Like resolution of texture, and character spacing)

Would using primitves and textures directly have any effect on the quality?
Kosaki is offline

Reply With Quote


Old 08-24-2010, 07:44 PM   #2
SEGnosis
Guest

Posts: n/a
I dont know of your rendering class, but using direct3d's I get



@ 512 x 512 image size

Reply With Quote

Old 08-24-2010, 08:01 PM   #3
Senior Member

Kosaki's Avatar

Threadstarter
Join Date: Aug 2009
Posts: 89
Reputation: 2974
Rep Power: 60
Kosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating community
Disc Dash Champion
Points: 3,422, Level: 5
Points: 3,422, Level: 5 Points: 3,422, Level: 5 Points: 3,422, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Here is a small dump of whats relevant.

Code:
HRESULT GFXToolkit9::LoadTexture(WORD textureID, HMODULE hSrcModule, LPCTSTR pSrcResource)
{
	if(m_textures[textureID])
	{
		m_textures[textureID]->Release();
	}
	LPDIRECT3DTEXTURE9 pTexture = NULL;
	HRESULT hRes = D3DXCreateTextureFromResource(m_pDevice, hSrcModule, pSrcResource, &pTexture);
	if(SUCCEEDED(hRes))
	{
		m_textures[textureID] = pTexture;
	}
	return hRes;
}

HRESULT GFXToolkit9::DrawSprite( WORD textureID, FVEC2 *pos, RECT *imageBounds, DWORD colorMask)
{	
	LPDIRECT3DTEXTURE9 pTexture = m_textures[textureID];
	if(!pTexture)
	{
		return E_FAIL;
	}
	D3DXVECTOR3 vec;
	vec.x = pos->x;
	vec.y = pos->y;
	vec.z = 0;
	return m_pSprite->Draw(pTexture, imageBounds, NULL, &vec, colorMask);
}
The D3DXSprite is started like this:
m_pSprite->Begin(D3DXSPRITE_ALPHABLEND);

I just can't find any reason for why it is acting like that.
Kosaki is offline

Reply With Quote

Old 08-24-2010, 08:12 PM   #4
SEGnosis
Guest

Posts: n/a
o: you could try my QTS texture from resource function and see if that fixes the difference.
Also resizing to the 8x8 based 512 x 512 size.

Reply With Quote

Old 08-24-2010, 08:20 PM   #5
Senior Member

Kosaki's Avatar

Threadstarter
Join Date: Aug 2009
Posts: 89
Reputation: 2974
Rep Power: 60
Kosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating community
Disc Dash Champion
Points: 3,422, Level: 5
Points: 3,422, Level: 5 Points: 3,422, Level: 5 Points: 3,422, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Alright, I will be trying that out tomorrow.

Hopefully it will be something that simple

Thanks
Kosaki is offline

Reply With Quote

Old 08-24-2010, 08:20 PM   #6
Broken Moderator

kolbybrooks's Avatar

Join Date: Aug 2006
Location: United States
Posts: 760
Reputation: 33567
Rep Power: 418
kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!kolbybrooks has a huge epeen!
Points: 23,105, Level: 21
Points: 23,105, Level: 21 Points: 23,105, Level: 21 Points: 23,105, Level: 21
Activity: 20.0%
Activity: 20.0% Activity: 20.0% Activity: 20.0%
Last Achievements
Unhappy

Quote:
Originally Posted by segnosis View Post
o: You could try my qts texture from resource function and see if that fixes the difference.
Also resizing to the 8x8 based 512 x 512 size.

8
16
32
64
128
256
512


Think you meant the Higher quality 512x512 (?)
kolbybrooks is online now

Reply With Quote

Old 08-24-2010, 08:25 PM   #7
SEGnosis
Guest

Posts: n/a
Ofc, im not basic math impaired >: o

Reply With Quote

Old 08-24-2010, 10:14 PM   #8
Level 3

silverfish's Avatar

Join Date: Dec 2006
Posts: 436
Reputation: 8917
Rep Power: 160
silverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATSsilverfish DEFINES UNKNOWNCHEATS
Points: 9,557, Level: 11
Points: 9,557, Level: 11 Points: 9,557, Level: 11 Points: 9,557, Level: 11
Activity: 4.2%
Activity: 4.2% Activity: 4.2% Activity: 4.2%
Last Achievements
Sorry for the off topic but QTS of how to draw text using textures would be a nice addition, no?
silverfish is online now

Reply With Quote

Old 08-24-2010, 10:34 PM   #9
SEGnosis
Guest

Posts: n/a
Quote:
Originally Posted by silverfish View Post
Sorry for the off topic but QTS of how to draw text using textures would be a nice addition, no?
Added, didn't go to much into it since toymaker explains it better

Reply With Quote

Old 08-25-2010, 03:48 PM   #10
Senior Member

Kosaki's Avatar

Threadstarter
Join Date: Aug 2009
Posts: 89
Reputation: 2974
Rep Power: 60
Kosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating communityKosaki is a legend in the cheating community
Disc Dash Champion
Points: 3,422, Level: 5
Points: 3,422, Level: 5 Points: 3,422, Level: 5 Points: 3,422, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Changing the method how I load the textures did not affect anything. =(

However I decided to go with the work around. Using a 512x512 texture now which contains 20p characters stroked 1 pixel.

The text drawing is now done with some scaling. It causes a bit blurred character at small fonts but I believe it should be good enough.



Pros:
It works

Cons:
Uses more memory 512x512 with 4 channels uses quite a bit more memory than 256x256.

Thanks for the help
Kosaki is offline

Reply With Quote

Old 08-25-2010, 04:05 PM   #11
SEGnosis
Guest

Posts: n/a
np, glad to help :]

Reply With Quote
Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
d3dxsprite, quality
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 07:42 AM.