This will teach you how to use the "stat_dyn_reflect" shader in Crystal Space!

Example

Here you see an example of how the shader works!

As you see the metal is static, and the reflection is only reflected where there is non-white surface on the mask file.

This is the mask file I used.

Setting up the files

The metal you want to add reflections too: metal.jpg.
The reflecting texture, which will float, and create the reflecting surface: reflection.jpg.
This is the mask that masks what will be reflected and what will not be: reflection_mask.jpg.

If you don't use the shader it will look like this.

You might think this looks nicer, yes maybe in this static picture, but in the "game", the reflection looks great!!!

The masked reflection shader works like this

It will not create any reflections where the mask texture is 100% white.
It will create 100% reflection where the mask texture is 100% black.
In between it makes reflections, static according to how bright/dark the mask is.

How to use it

Step 1 - Loading the textures

The first thing you need to do is to add the loading of the textures you are using.

The reflection is added as a cubemap to prevent the reflection to get all messy, and look bad. Instead of using one texture, it is actually using 6 different textures (I used the same to prevent the memory usage to be too high).

These are the variables that are used in the shader for creating the reflections and the mask, but only for that special material. If you want to use another mask (or reflection) just import another texture as well (named mask2.jpg...etc.) then apply this in the other material you want to use this
stat dyn reflect shader!

But you can off course use the same texture as many times as you want!