Make your virtual world bloom with Python
realXtend 0.4 makes use of OGRE postprocessing system. The two screenshots below give an example of one postprocessing effect, glass. First screenshot is a vanilla one, no postprocessing. The second screenshot has the glass postprocessing effect on. To move around with glass is an artistic experience. Some other postprocessing effects are motion blur (which could be turned on after some virtual beer), and black&white.
It is easy to play with different postprocessing effects by enabling and disabling them from the postprocessing effect dialog. Find the dialog from the realXtend viewer menu: view->postprocess. Effects can be set on so that they are on concurrently with other postprocessing effects. Results are, well, interesting.
The postprocessing effects can be also turned on or off from a script. This gives many application ideas:
o motion blur could be turned on after two beers, and turned off after a time-out
o if you go underwater, there is a suitable postprocessing effect for that too, it is called, ahem… UnderWater
o RexBloom is maybe one of the most useful, it is not very strong, so it can be used almost everywhere to enhance the lights and shadows nicely
Scripts allow turning postprocessing effects on and off when the user touches an object, moves into an object, or when the avatar enters the world.
In the next example we are going to set RexBloom on when the user enters the world. We will also add a teleport right at the start, so that it is easy to define the start location inside the world. You can see the RexBloom effect int the screenshot below.
First the theory, use these two lines of code inside your Python script to control postprocessing effects:
vAvatar.rexSetPostProcess(vEffectId, True) vAvatar.rexSetPostProcess(vEffectId, False)
vEffectId is the index number of the postprocess effect, the order is the same as in the postprocess dialog at the viewer (0=motion blur, 1=RexBloom, 2=Bloom_high, etc). The second parameter: True sets the effect on, False turns it off.
Here’s an example how to turn RexBloom on:
vAvatar.rexSetPostProcess(1, True)
To help you get started, dowload the zipped script folder CTN_python_worldinfo.zip, and extract it to rexserver->ScriptEngine->PythonScript. If you have the server running, you need to say “python restart” at the console window to load the new Python files. Do that also every time after you change Python scripts.
Now you need to edit ctn_worldinfo.py from the newly created CTN folder to get the right coordinates in, and to select which posprocessing effects should be on.
The worldinfo script needs to be connected to your world object. This can be done so that you just type “ctn_worldinfo.CTNInfo” to Class Name field of an object (it can be any object in the world):
I’d like to thank Turquoise for inspiring me to write this brief howto. Also thanks to the realXtend project team who wrote the original Python scripts to work with.












