• Advertisement
Sign in to follow this  

tex2dlod only pulls from top mip level of .dds texture

This topic is 2155 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

Hello.

I have an r8g8b8 .dds texture with mipmaps. When i try to sample from it in pixel shader 3.0 using tex2dlod(texturesampler, float4(texcoords,0,miplevel)) it only samples from the top mip level no matter which miplevel I specify.

I'm loading the .dds file with this code:
texture = game.Content.Load<Texture2D>(texturename);

Will this load all of the mipmaps or is there something more that I need to do?

Note: For my purposes I do not want to auto-generate or auto-select mipmaps.

Thanks

Share this post


Link to post
Share on other sites
Advertisement
Just a quick check, how is your texture sampler set up? Which filtering options and mipmap options are you using?

Best regards!

Share this post


Link to post
Share on other sites
uniform const sampler Sampler = sampler_state { texture = <Landcover>; magfilter = LINEAR; minfilter = LINEAR; mipfilter = NONE; AddressU = CLAMP; AddressV = CLAMP;};

Tried changing AddressU and AddressV to Wrap but that doesn't make any difference as I am manually clamping UV's anyway.
Tried setting Mipfilter to Linear but that just a made a big mess and I don't want to automatically select mip levels.

Share this post


Link to post
Share on other sites
MipFilter=NONE means don't use mipmaps at all. MipFilter=POINT will select the closest mip level to the one requested. MipFilter=LINEAR means blend between mip levels to get a smooth transition.

The shader controls which mip levels are accessed. tex2d() will automatically calculate them. tex2dlod() will let you specify which one you want to use.

You may find it useful to create a texture where each mip level is a different colour to help debug the shader.

Share this post


Link to post
Share on other sites
That did it, thanks Adam_42!

Linear mip filtering wouldn't work because I'm using tiled textures in a texture atlas.....so I had mip filtering shut off entirely.

Share this post


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

  • Advertisement