Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Mip Mapping in the Domain Shader


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 cephalo   Members   -  Reputation: 572

Like
0Likes
Like

Posted 22 May 2013 - 01:25 PM

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.



Sponsor:

#2 menohack   Members   -  Reputation: 216

Like
0Likes
Like

Posted 22 May 2013 - 04:12 PM

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.



#3 MJP   Moderators   -  Reputation: 11568

Like
4Likes
Like

Posted 22 May 2013 - 05:54 PM

"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.



#4 cephalo   Members   -  Reputation: 572

Like
0Likes
Like

Posted 23 May 2013 - 07:16 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS