Featured contribution

Top  Previous  Next

Parallax mapping shader

 

This month I have decided to brush up and put together a demo for a good looking parallax mapping shader (VS and PS >= 2.0) that was created by Steempipe a while ago.

 

aum53_parallax

 

Yes, you are looking at a plain texture, a simple box that has got this shader applied to it. Let's see how you can add the same effect to your projects.

 

First of all, you will need a model with 3 skins: your regular model skin, a dot3 bump map, and a height map. There are a few programs that can create dot3 bump maps; I have used Gimp's normal map plugin, which has quite a few options. Take a look at the textures that were used for my demo.

 

aum53_parallax2

 

You can examine the model that comes with the demo (box.mdl) for more information. Copy the content of the \parallax folder inside your game folder, and then include the parallax.wdl file in your main script. Place box.mdl in the level, set its scale to 4 (or any other value, it doesn't matter) and attach it the action named parallax_fx. Now place light.mdl in the level, close to the box.mdl model and attach it the action named dynamic_light. Oh, and don't forget to change the position of the dynamic_light entity until you like the result.

 

For an even greater looking effect you should place the entities that use this shader in dark areas and give the player a flashlight. Have fun!