Post news RSS Development Blog #13 - Parallax Occlusion Mapping and Shadow Mapping

This time we improved the configuration dialog, the shadow rendering and added Parallax Occlusion Mapping!

Posted by on

In the last days we did a lot. Let's start with the configuration dialog:

Configuration Dialog

As mentioned last time we want to add an in-game configuration dialog. With the exception of the screen resolution every settings appears now in our new dialog. Check out the screenshots:

Dev Blog #13

This dialog was created from annotated source code. So it should not happen again that some of these settings are not accessable. We also updated the icon for the check box and added new settings. If you want to see the dialog in "live" check out the video below.

The old configuration dialog which appears when you start the game has been deleted!

Shadow rendering

As we now have moving plants we thought that it would be nice if the shadow map is also animated. In the past it was so that the shadow map was only updated every 25 frame or when necessary. So it couldn't follow the movement of the plants. So we added now a setting which allows you to enable this feature if you have a good computer. You can see it in action in the video!

And the grass does not cast a shadow any more. This only produced unrealistic artifacts.

Parallax Occlusion Mapping

Ok implementing this was really crazy. I also thought about naming this post "What the heck is going on? In which coordinate system am I?". The general parallax mapping (not parallax occlusion mapping) algorithm is relative easy but you have to check in which coordinate system you are and in which coordinate system you interpolate your values. For example the view direction is essential for this method. I originally interpolated the normalized view direction which produced strange results. Then I realised that I had to interpolate the view position, then in the pixel shader create the view direction and then normalize this vector. Everything else produces strange results. But I still feel a little uncomfortable about this algorithm. There is a minus sign where it shouldn't be, but it doesn't work without it. Hmm, I feel like a guy who builds something and then realises that some screws are remaining.

Then I had the parallax mapping algorithm implemented. But it was not really noticeable and when I increased the effect it distorted the texture. The main problem was that the height map contained small details and this did not work very well. So I implemented a gaussian blur algorithm to smooth the height map which is used for parallax occlusion. It looked better but I still wasn't satisfied. So I decided let's do it all and implemented Steep Parallax Mapping, Parallax Occlusion Mapping and Relief Parallax Mapping. These algorithms perform a raycast in the tangent space of the texture. This creates the illusion that the texture has depth. Just look at the screenshots:

Dev Blog #13 Dev Blog #13
Dev Blog #13 Dev Blog #13

This will be enabled for the blocky voxels. I also tested in on the trees but it didn't look good. The next thing what we have to do is to adapt the height maps so that we even get better rendering result. Check out the video:

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.