Real Time GPU Graphics Engine Modules

This was my bsc final project. It was implemented in C++ and Cg, and the rendering effects are all executed on GPU.

The modules included are:

Scene management module

The objects that are included in the scene are arranged in a tree structure, so that all the transforms are applied gradually from root to leaves. The culling is also made in the same order, according to the nodes bounding boxes.

 The pictures show the bounding boxes that make the node hierarchy.
 This picture shows how the culling algorithm works. The rectangles are the bounding boxes of the objects. The red rectangles will be culled, the yellow ones are not culled and parts of them are in the view frustum, and the green one is not included in the frustum, but not eliminated by the algorithm. The result is:


Lighting and Fog Module

The lighting is done using per pixel lighting, and fog is also included in the shader.

Shadows Rendering Module

Shadow mapping technique is implemented. For spot lights, the implementation is straightforward. For the directional light, cascaded shadow maps have been implemented. The directional light uses several depth textures for rendering shadows at different resolutions - better shadows for close objects, low resolution shadows for far objects. More information can be found here.


Particle System Module

The app includes a GPU particle system. The emitters can be point, line or rectangle. A fixed number of particles, but with random delays can be generated. The particles'coefficients are placed in a texture, that is updated each pass by the shaders:


The particle system was used to render fire, rain and snow falling.

Bump Mapping Module

Bump mapping using a normal map was implemented.


Terrain rendering module

A terrain is loaded from a height map. The terrain is splitted in several rectangular chunks, which are stored with different level of detail geometry. For rendering the chunks, the LOD is applied:

However, the LOD is a basic algorithm, and it does not treat the artefacts that arise at the borders between levels.

Grass Rendering Module

Over the terrain, chunks of grass packs are rendered. Each grass pack contains 3 polygons arranged in a star structure:

More information about this rendering method can be found here.

Reflections, Refractions and Fresnel Effect

The app can render those effects using cubemapping technique. Unfortunately, rendering the whole scene 6 times did not prove to be real time, so the effects were preprocessed and are not dynamic. Preprocessing could have been done much much better using raytracing/raycasting, so cubemaps are not really useful here... However, they look nice and can be optimised. Maybe rendering them once every 3-4 frames could be real time, and generate a good effect.

Water Rendering Module

Using the reflections and refractions made available by the above module, water was implemented. The reflections are done using a cubemap, which is rendered each frame. The refractions are realized using blending. The wave animation is done by summing some sinusoidal waves (http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html).

3D Models Loader Module

The app can load 3ds and ms3d files, but the 3ds files are limited (single mesh 3ds models, one colour per mesh etc.) The ms3d models are animated using SLERP technique. More information about ms3d models a good ms3d loader can be found here.

Finally, those were all the modules included. It is, by far, not a complete graphics engine, but it contains the basic modules that are composing one.