Jump to content
  • Advertisement
Sign in to follow this  
cephalo

Mip Mapping in the Domain Shader

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

Ok, I want to do some displacement mapping in my domain shader, and some corresponding normal mapping in my pixel shader. I've never done displacement mapping before, but I would guess that it is very important to use the same mip mapping technique for both shader stages. In the pixel shader, mip-mapping happens sort of automatically so I don't really know exactly what's happening enough to emulate it in the domain shader.

 

I figure that for something this basic, there's probably a well established way to use the same mips for sampling in the domain and pixel shaders. Can anyone point me to an article somewhere with some code examples? I'm finding articles that say you should use mip-mapping in the domain shader, but nothing as to how to do that exactly.

Share this post


Link to post
Share on other sites
Advertisement

It sounds like you just want to mip-map your normal map. Your normal map is just an image so I don't see why the default mip-mapping won't work automatically.

Share this post


Link to post
Share on other sites

"default" mip-mapping only works in a pixel shader, since it's based on screen-space derivatives of your UV coordinates that are computed from neighboring pixels. For any other shader type you have to compute the mip level manually.

 

I would suggest reading through this article for some ideas regarding mip selection for displacement mapping.

Share this post


Link to post
Share on other sites

Interesting. It was a misconception on my part that the mip levels would be the same on both shader stages, as the domain shader samples at a much lower frequency than the pixel shader.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!