• Advertisement
Sign in to follow this  

Textures are grainy and pixels move when moving the camera

This topic is 1903 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've recently moved to the Windows SDK, so I've stopped using the D3DX libraries. I now use D3DCompiler for shaders and DirectXTex for loading textures (CreateDDSTextureFromFile).

I've noticed that my textures are grainy, and when I move the camera the grain(pixels) move around as well. I'm basically using the rastertek directx 11 tutorials, but converted them to use DirectXMath and the libraries I explained below.

I've uploaded a video on youtube that explains this better. Remember to turn on 720p and full screen viewing.
[media]
[/media]

I've tried to compare flags and such when loading the textures/compilers, but I haven't found anything. Does anyone know what could cause this? I can provide code if necessary. Edited by Corvwyn

Share this post


Link to post
Share on other sites
Advertisement
Hey Corvwyn

What filters are you using for sampling? Min/Mip and Mag?

Seems like the textures are rendered on a high resolution with small pixel coverage resulting in changes on small movement.

Greetings

Share this post


Link to post
Share on other sites
I'm using D3D11_FILTER_MIN_MAG_MIP_LINEAR. It seems to work with the rastertek examples. The textures are also grainy when the camera stands still.

Haven't really had the chance to look into this much, but getting artifacts like this starts the learning process tongue.png Edited by Corvwyn

Share this post


Link to post
Share on other sites
Yup, this is definitely broken mipmapping. As well as the filters check for any LOD bias, min LOD and max LOD settings in your sampler states. Also ensure that you're actually specifying creation of a full mipmap chain in your CreateTexture calls. Edited by mhagain

Share this post


Link to post
Share on other sites
I tried converting the texture to .png and loading it with CreateWICTextureFromFile (http://directxtk.cod...Title=DirectXTK), and everything looks good. Since the dds file is more effective, I want to use that instead though.

The texture viewer I use shows that the .dds file contains all the mip maps (512x512 down to 1x1), but the call to CreateDDSTextureFromFile doesn't seem to be sufficient to load them. The documentation says that the loader supports mipmaps though (http://directxtk.cod...Title=DirectXTK).

The sampler uses these settings for LOD, which looks correct:
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

The only reference I see to creating a full mipmap chain is in the depthbuffer (setting this to 0 has no effect):
depthBufferDesc.MipLevels = 1;

Apparently the old D3DXLoadTextureFromFile is different and uses mipmaps correctly. Since the dds already has mipmaps, GenerateMips shouldn't be necessary, right? Edited by Corvwyn

Share this post


Link to post
Share on other sites
Apparently the dds file did have corrupt mipmaps or something. I generated some mipmaps from the dds plugin in gimp, and everything seems to work! Seems like the other tool I used couldn't detect if the mipmaps were corrupt or not. Edited by Corvwyn

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement