Jump to content
  • Advertisement
  • entries
  • comments
  • views

More Parallax Occlusion Mapping

Sign in to follow this  
Jason Z


I spent my dev time yesterday working on a newer version of my parallax occlusion mapping effect. There was actually a bug in my interpolation between the final two sampled height points that was causing an aliasing effect unless I used insanely high sampling rates to somewhat 'brute force' the aliasing to go away.

After wondering why it was taking so many samples to get good precision, I decided to try to understand better what was going on. So I forced the texture samplers to use the top level mip map by setting the derivatives to zero in the tex2Dgrad HLSL function. The normal/heightmap that I was using is a 256x256 texture, so I forced the algorithm to use 300 samples (yes, per texel - it took a while to render a frame...) - which should produce a perfect image since the heightmap is being oversampled.

I then saved a screen shot of the output and then reduced the sampling rate to 256, then to 200, then to 128, ... , and finally decided that something was wrong. Even the oversampled version was not perfect and had some aliasing on edges that were perpendicular to the view edge. And I know that it doesn't take that many samples to get a good image using other people's implementation.

That was when I started modifying the interpolation code - I am not sure how I came up with what I was using before (has that ever happened to you???), but now it is very simple and fast, and actually reduced the instruction count by 2[grins]! Using 16 texture samples produces the exact same image as using 50 samples in my test scene, so I am very happy with the results.

The moral of the story is that you should always be open to re-examining old code - even if you think it is proven to be stable!

Since my laptop only has a shader model 2.0 card in it, I have been generating a few demo movies offline by saving screenshots one at a time. I'll post some of them once I get them all built and compressed!
Sign in to follow this  


Recommended Comments

There are no comments to display.

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
  • 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!