Textures are grainy and pixels move when moving the camera

Started by
7 comments, last by Corvwyn 11 years, 5 months ago
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.
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
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
Missing mipmaps perhaps?

Cheers!
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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Thanks. I'll look into that.
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?
Any ideas?
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.

This topic is closed to new replies.

Advertisement