Vortex 3D Engine was born as a framework on which I could prototype realtime rendering techniques, but soon evolved into a set of proven, reusable components that enable delivering 3D applications and games on a disparate array of platforms, including desktop and mobile.
Some of the most prominent features of Vortex Engine include:
- Developed in standard C++, completely object-oriented.
- Fast and portable.
- Non-intrusive and flexible.
- Minimal external dependencies.
- Dynamic scene management.
- Automatic resource life-cycle management through reference counting.
- Rendering through the Fixed and the Programable pipelines.
- Supports OpenGL, OpenGL ES 1.1 and OpenGL ES 2.0.
This page gathers notes on the development of the Vortex 3D Engine and its features, as well as on other musings on computer graphics. These posts are licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Table of Contents
- Bump Mapping
- Light Scattering
- Realtime Shadows
- Geometry Post-Processing
- Multi-pipeline Support for Rendering
- Engine Resource Management
- Using your own Tools
In my last post, I started discussing Bump Mapping and showed a mechanism through which we can generate a normal map from any diffuse texture. At the time, I signed off by mentioning next time I would show you how to apply a bump map on a trivial surface. This is what we are going to do today.
Bump mapping is a texture-based technique that allows improving the lighting model of a 3D renderer. Much has been written about this technique, as it’s widely used in lots of popular games. The basic idea is to perturb normals used for lighting at the per-pixel level, in order to provide additional shading cues to the eye.
Light Scattering (also known as “God Rays”) is a prime example of what can be achieved with Shaders and Render-to-Texture capabilities. In the following image, a room consisting of an art gallery with tall pillars is depicted. We want to convey the effect of sun light coming from outside, illuminating the inner nave.
Vortex 3D Engine supports render-to-texture capabilities by means of Framebuffer Objects.
Vortex 3D Engine supports both Stencil Shadow Volumes and Shadow Mapping.
Shadows are a very interesting feature to implement in an renderer, as they provide important visual cues that help depict the relationship between objects in a scene. Notice in the following image how the shadow tells our brains that the Knight is standing on the floor (as opposed to hovering over it).
Shadow mapping is a technique originally proposed in a paper called “Casting Curved Shadows on Curved Surfaces”, and it brought a whole new approach to implementing realtime shadows in 3D Apps.
Sometimes the 3D models we have to display provide no information other than vertex data for the triangles they define. To help solve this problem, Vortex now provides a simple Normal generation algorithm that “deduces” smooth per-vertex normals from the geometric configuration of the 3D model. The results are nothing short of astonishing.
Multi-pipeline Support for Rendering
Supporting several rendering pipelines enables the developer to use the most appropriate rendering pathway for the target device’s capabilities. Newer video cards for Desktop computers and the latest mobile devices can be programmed for though the programmable pipeline, whereas older devices (such as the original iPhone and the iPhone 3G) can still be supported through the fixed pipeline.
Engine Resource Management
Now that we have advanced support for a dual rendering pipeline in Vortex, we are now shifting our attention into a completely different topic. This time we are looking into overhauling the engine’s inner resource management.
One of the great features of C++ is that the language is super-extensible. You can literally change the way many things work in C++ and, it turns out that after some research and experimentation (and a little C++ magic too), we found a way to implement C# covariance/contravariance for our custom smart pointers.
Using your own Tools
Someone once said there is no building the engine without building a game. There is nothing like actually using your own tools in order to pinpoint the weak spots of the Engine.
MD2 Library 2.0 has been out for a while now (download here), but I haven’t had the time to update this blog! It’s a free download for all iPad users, and, at the time of writing, all iOS versions are supported. The App has been revamped to use the latest version of my custom 3D Renderer: Vortex 3D Engine, bringing new features to the table.
One of the roughest edges in Vortex was Md2 model animation support. Until last week, integrating animated models into a Scene Graph was unnecessarily complicated. Fortunately, this is no longer the case. Adding an animated Md2 model to a Scene Graph is now as easy as adding any other node type.
Md2 models in Vortex can now be “instanced” from the same data at the Engine level (not to be confused with GPU instancing) and different animations can be assigned to each model. The idea for the short-term is to be able to provide entities the ability to create a Md2 model instance and animate it however they like without causing conflicts with other entities that instantiate the same model.