Planar reflections/refractions in UPBGE 0.1.5 master

Some time ago I wrote about how to achieve planar reflections in Blender but now we got easy planar reflections and refractions in the recent official builds from the UPBGE project, you can get the official build here, and the blend test file here (Thanks to Youle).

Once I saw the demo I wanted to modify the shader a little bit to make the water more interesting, because the water flow seem like solid, no waves, etc.


So the first thing to do was to add another texture slot for a new normal map (this could be the same or another normal map) texture in the texture panel, and make sure to put on the top of the reflection and refraction maps.

Do not forget to adjust the settings just like the first normal map in order to get it to work.


And now use this script:

import bge

cont = bge.logic.getCurrentController()
own = cont.owner

tex= own.meshes[0].materials[0].textures[0]
tex1= own.meshes[0].materials[0].textures[1]

def update():

tex.uvOffset.x += 0.0005
tex1.uvOffset.y -= 0.0006

You can find this script linked in the water plane, and of course in the text editor in blender (offset.py)

The only thing I did here was to add another line to call for the second texture slot (tex1) and after that update the “Y” offset for “tex2” with 0.0006. Once you have added you will notice the effect in the 3d view, at this point you can modify the texture rotation to make the motion a little bit different than only “Y” axis.

And the result should be like this:

If you don’t know about the UPBGE project, go to the web site for more information about it

www.upbge.org

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *