Hi guys, I made a windowed app to create particle systems for my game and I can't figure out why the textures are blocky. I'm using pretty much the same code that's in my game where the textures are fine. The only difference is that the app is windowed.
I'm using D3DXCreateTextureFromFile() to load the texture.
I'm calling:
SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR)
SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);
The screen output is smaller than the texure, in fact, the smaller the output size is the worse the blockiness becomes.
What can be wrong ? This is killing me.
Thanks.
8 replies to this topic
Ad:
#2 Members - Reputation: 560
Posted 01 February 2012 - 11:24 PM
Pictures are worth a thousand words ;) This does sound filtering-related, though.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
#4 Members - Reputation: 295
Posted 02 February 2012 - 03:01 AM
Hi!
Do you generate and use mipmaps?
Maybe your windowed app has another default value for the mipmap filtering.
This comes to my mind because Min and Mag filter alone can still produce visible edges at pixel centers.
Do you generate and use mipmaps?
Maybe your windowed app has another default value for the mipmap filtering.
This comes to my mind because Min and Mag filter alone can still produce visible edges at pixel centers.
- Allocate mip maps when you create the texture. (D3DXCreateTexture creates the full mipmap chain)
If you use another function to create the texture, specify D3DX_DEFAULT for the parameter "MipLevels" to create the full chain. - Set the sampler state.
SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR)
Acagamics e.V. – IGDA Student Game Development Club (University of Magdeburg, Germany)
#5 Moderators - Reputation: 1760
Posted 02 February 2012 - 09:34 AM
What format is the texture in? It's not a DXT compressed texture is it?
Steve Macpherson
Senior programmer, Firebrand Games
#6 Members - Reputation: 136
Posted 02 February 2012 - 09:33 PM
I'm not using mipmaps and the texture is a standard 24-bit BMP created in photoshop.
I created a new simple app based off the tutorials and the texture is not blocky. I then used the exact same code in my other app and it is blocky. The only difference is that in one app (without the blockiness) the window is not a child window and in the other app (with the blockiness) the window is a child window.
I don't understand why that would make a difference.
Any ideas ?
I created a new simple app based off the tutorials and the texture is not blocky. I then used the exact same code in my other app and it is blocky. The only difference is that in one app (without the blockiness) the window is not a child window and in the other app (with the blockiness) the window is a child window.
I don't understand why that would make a difference.
Any ideas ?
#7 Members - Reputation: 295
Posted 03 February 2012 - 02:43 AM
Hi!
I can’t imagine that it makes any difference to Direct3D, where the window comes from.
I’d rather suspect that there is a difference in a render state or a resource parameter.
You could use PIX to check whether all states are in both apps the same.
Also make sure that the textures are created with the same parameters.
Perhaps not all members of the descriptions were written and you forgot to initialize them (e.g. by ZeroMemory). This could cause inconsistencies.
Besides, it would be better if you use mipmaps. Min and Mag filter won’t help you much if a texel after mapping to the viewport is more than two times smaller or bigger than a pixel.
Cheers!
I can’t imagine that it makes any difference to Direct3D, where the window comes from.
I’d rather suspect that there is a difference in a render state or a resource parameter.
You could use PIX to check whether all states are in both apps the same.
Also make sure that the textures are created with the same parameters.
Perhaps not all members of the descriptions were written and you forgot to initialize them (e.g. by ZeroMemory). This could cause inconsistencies.
Besides, it would be better if you use mipmaps. Min and Mag filter won’t help you much if a texel after mapping to the viewport is more than two times smaller or bigger than a pixel.
Cheers!
Acagamics e.V. – IGDA Student Game Development Club (University of Magdeburg, Germany)
#9 Members - Reputation: 136
Posted 03 February 2012 - 07:44 PM
Hi guys,
Adam_42 is exactly correct. That's what the problem was. I was resizing my child window based on the mainframe's size but not resizing the back buffer. For now I'll just keep the child window a constant size until I learn how to resize the back buffer (maybe with Reset()?)
Thanks everyone, I wouldn't have figured this out on my own.
PS - thanks Tsus, I'm going to learn about mipmaps for sure now.
Adam_42 is exactly correct. That's what the problem was. I was resizing my child window based on the mainframe's size but not resizing the back buffer. For now I'll just keep the child window a constant size until I learn how to resize the back buffer (maybe with Reset()?)
Thanks everyone, I wouldn't have figured this out on my own.
PS - thanks Tsus, I'm going to learn about mipmaps for sure now.



















