Many games that are considered ‘next generation’ use sophisticated rendering effects such as hdr, bloom, and glow. This effect make environments more realistic, attractive, and simply put, nice to look at. Many programmer’s achieve these effects through complex shader coding and the use of rendering surfaces, however, Truevision 3D comes with built-in glow functions to make it easier for your to get these effects into your projects.
If you would like to learn how to add a glow rendering effect to your games in Truevision 3D, follow the guided steps below.
Step One – Object Initialization
In order to make use of Truevision 3D’s glow effects, it is required to use the ‘TVGraphicEffect‘ object and the ‘TVRenderSurface‘ object. Add this source code to your project’s object declaration section,
public TVGraphicEffect tvGFXEffect;
public TVRenderSurface tvSurface;
And, after the engine has been initialized, add this code,
tvGFXEffect = New TVGraphicEffect();
tvSurface = Scene.CreateRenderSurface(512, 512, true);
With the graphic effect object and the rendering surface created, continue below to implement the actual rendering of the glow effect.
Step Two – Rendering the Glow Effect
In the main loop’s rendering code, place this source code before the engine’s renderer is cleared with the ‘Clear()‘ function,
// Render the Glow Surface
// Render any mesh that should affected by the glow here
// End the Surface Rendering
// Update the Graphic Effects
Make sure to add rendering code for any mesh you would like to be rendered with the glow effect between the StartRender() and EndRender() functions. To have the graphics engine render the glow effect to the screen, add this code before the engine’s ‘RenderToScreen()‘ method is called,
Now, when you compile and run the project, objects place between the rendering surface’s render tags should have a nice glow surrounding them. Make sure to adjust the glow intensity until the desired level of effect is reached.