per pixel displacement mapping

Started by
24 comments, last by jeroenb 18 years, 6 months ago
Be aware that one of the big problems with per pixel displacement mapping is that it throws early Z out the window. You might want to do occlusion culling for anything that's using it, because all of the pixels will be computed regardless of depth test.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement
You only lose early Z rejection if you actually modify the z value in the pixel shader. However most implementations of per-pixel displacement mapping do NOT do this (for the very reason you mentioned). So you don't get proper z buffering but you do get parallax, self-occlusion etc. If you are using shadowmapping and deferred shading you can write out the modified viewspace position (based on the height) and have your shadows react to the bumps almost for free :)
That's a good point about deferred rendering and shadow maps. If anyone has a demo that does this, I would really like to see it.
"Math is hard" -Barbie
Ok, per-pixel displacement now works, tho still now view independant. For some reason I dont get it rotate correctly like the demo does. I tried to use the inverse/transpose modelview matrix to transform the eye position like the code of the demo does. But with no success yet.

Crafter 2D: the open source 2D game framework

?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]

Quote:Original post by jeroenb
Ok, per-pixel displacement now works, tho still now view independant. For some reason I dont get it rotate correctly like the demo does. I tried to use the inverse/transpose modelview matrix to transform the eye position like the code of the demo does. But with no success yet.


and have you tried it without any transformation matrix? I didn't have a deep look at the source in the demo app. but in the book they don't use any transformations...
I tried that too, I will try to post up a screenshot soon. Thanks for the reply anyway :)

Crafter 2D: the open source 2D game framework

?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]

This topic is closed to new replies.

Advertisement