Sign in to follow this  
cephalo

Mip Mapping in the Domain Shader

Recommended Posts

cephalo    739

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
menohack    216

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
MJP    19753

"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
cephalo    739

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this