Hello everyone,
I am trying to fix an issue that causes some (not all) sprites to have smudges/rigids when rendered. I am using a vertex buffer to render the sprites in 3D space. They all render with the correct size, etc. so that no resizing occurs during render-time. Here is an image of the issue I am clueless about (see "Character Info" dialog box):
Here is the texture/spritesheet that the game is reading from (as you can see the original doesn't have these rigids on the "Character Info" dialog box):
I have been testing and discovered this issue may be related to non-power of 2 textures being resized to power 2 sizes. That being said since this texture (above spritesheet) is 619x598 and is forced to be resized to 1024x1024 when the texture is created, I decided to manually change the size of the spritesheet image file to 1024x1024 to see if resizing during texture creation was the issue; however, the issue still remained with no improvements.
Also the position of the vertexes on the screen and on the spritesheet are all consistent with the size of the dialog box (270x376):
Screen(-0.687500~0.156250, -0.775000~0.791667)
Spritesheet(0.000000~0.263672, 0.000000~0.367188)
Both the screen position and texture coordinates equate to 270x376 being the dialog box size so it is not stretching at all but it is definitely losing quality for some unknown reason. If you want to verify that it's not being stretched, the screen size is 640x480 in this case and the texture size is 1024x1024 after "extending" (not stretching) to a power-of-2 size.
I am using the following line to create the texture:
D3DXCreateTextureFromFileInMemoryEx(device, imageBuffer, m_imageSize, D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, format, D3DPOOL_DEFAULT, D3DX_FILTER_NONE, D3DX_FILTER_NONE, 0, NULL, NULL, &m_texture);
Since I am passing D3DX_FILTER_NONE as the filter parameters "No scaling or filtering will take place. Pixels outside the bounds of the source image are assumed to be transparent black." as stated by the official MSDN website. That being said I don't know why the image is losing quality even though its not being stretched rather only extended and no harm should be done, right? The weird thing is when I passed D3DX_DEFAULT_NONPOW2 as the image sizes as opposed to D3DX_DEFAULT it looks perfect. But other issues arise and besides I don't want to use non-power-2 textures since its not entirely cross-compatible at least with older graphics cards which is what I'm targeting.
Any help on the matter is greatly appreciated. Also feel free to ask any more questions to clear things up!
Edit: This just came to mind, is it possible the rigids/smudges are caused from a vertical flip of the sprites since the bottom and top are flipped to properly display the sprites? If so how can I approach this another way so DirectX won't flip the sprites upside-down?