Introduction
Developed in 2010, VGFXOpenGL (Venom Graphics OpenGL) version 2.0 is an in-house, hardware-accelerated 3D engine. Built on OpenGL 3.2 core profile, it takes full advantage of the programmable pipeline and shaders.

Technical Features
Target Platforms
- Windows XP, Vista, 7, 8.X, 10, 11
Hardware Acceleration
- Hardware-accelerated through the OpenGL 3.2 core profile with programmable pipeline and shaders
- Using the new OpenGL core context
- Using extensions to access features from OpenGL 4.3


- An optional developer mode enables the use of the new OpenGL debug context for detailed warning and error logging
- Using the OpenGL Shading Language (GLSL) version 1.50.11 core
- Supports all display resolutions and refresh rates (Hz)
- Double buffering
Renderer
- Hybrid forward/deferred renderer
- Combines forward rendering with deferred techniques
- Aims for a unified rendering pipeline for opaque and transparent objects, reducing the need for multiple shaders
- Utilizes advanced G-Buffer and MRT-based rendering effects
- Multi-pass scene rendering
- Collects and renders visible reflection (cube) maps with high detail. For each reflection
- Gathers visible objects and lights
- For each light, renders only depth values into shadow (cube) maps
- Collects visible shadow-casting objects
- Renders opaque objects, sorted front to back
- Renders special objects, sorted front to back
- Renders into the G-Buffer, filling two FBO attachments (encodes normal and normalized eye-space z into an RGBA texture & stores raw eye-space z in an R32F texture)
- Renders opaque objects, sorted front to back
- Renders transparent objects, sorted back to front
- Renders special objects, sorted front to back
- Generates the SSAO buffer using G-Buffer data
- Renders opaque objects, sorted front to back, without reflections with multi-pass object rendering
- Renders transparent objects, sorted back to front, without reflections with multi-pass object rendering
- Renders special objects, sorted front to back, without reflections with multi-pass object rendering
- Gathers visible objects and lights
- For each light, renders only depth values into shadow (cube) maps
- Collects visible shadow-casting objects
- Renders opaque objects, sorted front to back
- Renders special objects, sorted front to back
- Renders into the G-Buffer, filling two FBO attachments (encodes normal and normalized eye-space z into an RGBA texture & stores raw eye-space z in an R32F texture)
- Renders opaque objects, sorted front to back
- Renders transparent objects, sorted back to front
- Renders special objects, sorted front to back
- Generates the SSAO buffer using G-Buffer data
- Renders opaque objects, sorted front to back, with multi-pass object rendering
- Renders transparent objects, sorted back to front, with multi-pass object rendering
- Renders special objects, sorted front to back, with multi-pass object rendering
- Applies Depth Of Field (DOF) effect
- Applies FXAA 3.11
- Collects and renders visible reflection (cube) maps with high detail. For each reflection
- Multi-pass object rendering
- Adds global ambient light if no other light sources are collected, otherwise the first collected light will include global ambient lighting
- Executes custom render handlers for objects with assigned handlers, passing necessary data about the current pass (G-Buffer or shadow)
- Renders object as wireframe if requested
- For objects casting volumetric light
- Renders front faces to a utility color buffer
- Renders back faces to the main color buffer using a volumetric lighting shader
- For all other objects, for each material
- Uses the current active shader for materials tagged to retain it
- Executes material-only shaders for materials requesting non-lighting passes (e.g., dispersion shaders utilizing reflection maps which already incorporate lighting)
- Applies lighting passes for materials requiring it. For each light
- Binds the shadow (cube) map of the light
- Selects appropriate lighting shaders based on material and light type
- Renders the object using the selected lighting shader. The first light is processed with BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), while subsequent lights are rendered with BlendFunc(GL_SRC_ALPHA, GL_ONE), achieving the same effect as rendering all lights simultaneously. Whenever a fragment color containing specular light is written, the luminance of the specular component is stored in the second color attachment
Render Targets
- Framebuffer objects (FBO) featuring support for multisampling (MSAA) and mipmapping
- Packed depth-stencil texture attachments for FBOs, providing a shared buffer for both depth and stencil values
- Support for non-power-of-two (NPOT) FBO dimensions
- FBOs connected to cube map sides
- Multiple render targets (MRT)/color attachments per FBO
Shader Manager
- Shaders are loaded directly from external files, allowing for easier management and updates
- Includes support for ‘#include’ statements, enabling the integration of shared shader code across multiple files, which significantly reduces code redundancy and improves maintainability
- Displays validation errors and warnings in a clear and interactive WinAPI dialog
- Allows runtime insertion of ‘#define’ statements to dynamically generate different shader versions, such as multisampled and non-multisampled variants
- Implements a central shader collection class with C++ macro-based registration of shaders, making it straightforward to manage and classify engine core shaders
- Supports inheritable C++ shader program front-ends, providing flexibility to:
- Quickly define custom uniforms outside the engine’s core uniform list
- Extend and implement new shader logic within the C++ framework
- Optimizes uniform uploading by intelligently minimizing redundant uploads, such as for global uniforms like ModelViewMatrix
Lighting / Shadowing
- Multi-pass Phong shading (per-pixel/per-fragment lighting) with SSAO and shadow factors seamlessly integrated into the lighting formulas
- SSAO shader samples within normal-oriented hemispheres to accurately approximate ambient occlusion
- Supported light types:
- Omni light
- Directional light
- Spot light
- Rectangular spot light
- Global ambient light, enhanced with an ambient cube map for normal mapping
- Volumetric lights
- Emission maps (emissive textures)
- Lighting parameters:
- Vertex normals, with optional smoothing
- Material properties including ambient, diffuse, specular, specular shininess, and two-sided materials
- Normal maps to simulate texture depth for realistic bump mapping
- Ambient occlusion factor derived from the SSAO buffer
- Shadow factor generated from shadow maps
- Specular intensity extracted from specular maps
- Light type-specific parameters for precise adjustments
- Advanced shadow maps and shadow cube maps for each light type, featuring thin soft edges achieved through Percentage-Closer Filtering (PCF) and hardware-based filtering. Includes an intuitive user interface to define shadow quality settings
Shader Effects
- Depth of Field (DOF) effect in GLSL, inspired by the paper “Advanced Depth Of Field” by Thorsten Scheuermann (ATI/AMD)


- True real-time reflections in GLSL, utilizing a specialized double buffering system to distribute reflection cube map generation across multiple frames
- Refraction and dispersion for glass materials in GLSL, applying Fresnel factors to refract each RGB channel at distinct angles




- Per-pixel crepuscular rays (god rays) in GLSL, based on depth value analysis. Light intensity is stored in the second color attachment for later integration into the dirty lens effect




- Real volumetric lighting in GLSL (no cheap billboard tricks), achieved through volume ray casting combined with shadow map data





- Efficient two-pass Gaussian blur effects in GLSL, utilizing different kernel sizes and minimizing texture sample lookups
- Glow and bloom effects in GLSL, leveraging specular light information stored during lighting passes in the MRT attachments of the main render buffer

- Dirty lens effect in GLSL, combining specular light data from lighting passes with direct light information from post-process effects like god rays



- Distortion effects in GLSL with depth value analysis, ensuring objects between the camera and the area of effect (AOE) do not bleed into the effect
- Particle-based effects such as fire, smoke, rain, snow, and flying leaves for dynamic and immersive visuals
- Realistic lens flare effects in GLSL, implemented using occlusion queries for accurate light source simulation
Particle System
- Advanced particle system capable of being rendered independently or integrated within the scene graph
- Batching of triangles for maximum rendering performance
- Supports static or randomized texture selection for varied visual effects
- Easy loading of textures into a texture atlas
- Features RGB color fading and alpha fading for smooth transitions
- Allows dynamic resizing of particles
- Includes simulation of gravitation and wind effects for realistic motion
- Provides randomization of origin points and direction vectors
- Offers both constant and randomized particle lifetimes for flexible animations
- Enables dynamic speed control to fine-tune particle movement
- Supports rendering via billboards or rotating, two-sided quads
- Allows pre-initialization of particle positions for greater control
- Simplifies translation and rotation of the entire particle system
Anti-Aliasing
- Fast Approximate Anti-Aliasing (FXAA), utilizing the official and enhanced FXAA3 (v.3.11) implementation by Timothy Lottes, which significantly reduces blur compared to earlier versions. Before applying FXAA3, the engine transforms linear RGB values into perceptual color space (gamma 2.0 encoded) and calculates luminance for each pixel within the same space. After processing, the output is converted back to linear RGB. Application settings allow users to configure:
- The degree of sub-pixel aliasing removal
- The minimum local contrast required to activate the algorithm
- Legacy support for application-controlled High-Resolution Anti-Aliasing (HRAA), also referred to as Multisample Anti-Aliasing (MSAA). Legacy support is maintained as MSAA does not integrate well with SSAO in the hybrid forward/deferred renderer. Most modern deferred renderers prefer post-processing anti-aliasing filters. Supported sampling modes include:
- 2x Samples with 2 Taps
- 4x Samples with 4 Taps
- 6x Samples with 6 Taps
- 8x Samples with 8 Taps
Texturing
- Bilinear, bilinear mipmapped and trilinear mipmapped filtering
- 2x, 4x, 8x and 16x anisotropic filtering
- Multitexturing
- Smart texture management system
- Hardware-accelerated mipmap generation for color textures as well as software mipmap generation for normal maps
- Support for multisampled color and depth texture FBO attachments using GLSL #ifdefs to create shader versions with sampler2D and sampler2DMS
- Support for non-power-of-two (NPOT) texture dimensions
- Support for S3 Texture Compression (S3TC) methods DXT1, DXT3 and DXT5
- Compressed texture files (e.g., JPG) can be decompressed and stored on disk to speed up subsequent application startups
- DOT3 bump mapping using normal maps, normalization cube maps and TBN matrices to convert light vectors from world to tangent space. To generate the normal maps from common RGB images, the “NVidia Normal Map Filter” plug-in for Adobe Photoshop or the “Height Field to Normal Map” plug-in for Paint.NET could be utilized

Scene Graph and Object Management
- Linear and hierarchical (tree-based) representation of the scene/objects
- The hierarchical representation enables fast recursive view frustum culling and serves as the foundation for efficient collision/intersection tests and rendering
- For leaf objects, oriented bounding boxes (OBBs) are calculated
- For parent objects, OBBs are constructed by merging the OBBs of their child objects
- OBBs are utilized for view frustum culling. If an object’s OBB lies outside the view frustum, no further culling tests are performed on its child objects. View frustum planes are individually deactivated for all descendants of an object if its OBB lies on the positive side of the plane
- Light sources can be defined in the world to illuminate only a subtree of the scene graph. This is achieved by placing light sources at desired positions within the tree. In “developer mode,” a (WinAPI-based) tree view window is displayed alongside the main window. This view represents the scene graph and includes icons for geometric data, cameras, target spotlights, point lights, directional lights, grouping dummy objects, and particle systems. Additionally, information about the render state (RS) and collision handling (CH) is displayed

- Each object holds both a local and a world transformation matrix, which represent its local and global orientations. In combination with the scene graph manager, this allows entire worlds or object groups to be transformed simply by modifying the values of a single matrix and calling the scene graph manager to recursively update the subtree. The intelligent scene graph manager optimizes update times by determining the minimal object group that requires updating
- By default, model transformation is performed on the GPU, but it can also be executed on the CPU if needed. This setting can be adjusted at runtime, with the engine dynamically selecting either local or world space VBOs. The engine also adapts the model matrix in the shader, setting it to either the identity matrix or the specific model matrix of the mesh
- A comprehensive view class and view stack system manages the entire Model-View-Projection flow, as well as camera, viewport, and frustum states. This ensures everything remains organized and easily trackable, even during complex cascaded rendering processes that configure multiple views for reflections, shadow maps, cube maps, and other advanced scenarios
- Render data is stored in Vertex Buffer Objects (VBOs)
- The Vertex Array Object (VAO) encapsulates the necessary VBO configuration required for rendering an object
- Front-to-back z-sorting is performed on opaque objects to efficiently utilize the depth buffer
- Objects can be linked into groups to receive commands distributed among all group members
- Recursive deep cloning of objects is achieved with a single function call
- Special render handlers (e.g., particle systems) can be easily integrated into the scene graph
Intersection Testing
- The hierarchical, tree-based scene representation enables efficient recursive intersection tests
- Each object includes a separate OBB-tree, which is automatically and recursively generated during the loading process. For a given triangular mesh with an associated oriented bounding box, the mesh can be divided into two submeshes. The algorithm splits the mesh using a plane orthogonal to the longest axis of the OBB. This splitting plane is determined by calculating the median value of the projections of each face center onto the longest axis, with the median as the plane’s center and the longest axis as the plane’s normal. The faces are then partitioned based on the side of the plane on which their centers lie






- The resulting OBB-tree significantly reduces the computation time required to test whether a line segment (e.g., a gunshot) intersects a triangle in a mesh containing potentially thousands of triangles






- For collision detection, intersection tests can be performed between moving OBBs, OBB-trees, and individual triangles. The hierarchical, tree-based scene representation also facilitates efficient recursive collision tests. Intersection tests between two OBB-trees use a double-recursion method. Optionally, intersection tests can be conducted between triangles within the intersecting leaf nodes of the two OBB-trees
Animation System
- Character bone animations implemented through object hierarchies
- Linear and Hermite spline interpolations designed for full compatibility with the TCB position controller in 3ds Max/GMax and the 3DS file format
- Linear rotation interpolation utilizing quaternion mathematics
- Smooth Bezier spline rotation interpolation with quaternion mathematics, fully compatible with the TCB rotation controller in 3ds Max/gmax and the 3DS file format
3DS Loader
- High-performance, self-developed 3DS importer implemented in C++
- Fully processes objects, lights (point and spot), cameras, and their complete material, object, and keyframer animation blocks
- Supports smoothing groups and optimizes vertex, texture, and normal array data to minimize array sizes, ensuring the lowest possible video memory usage
- Conducts comprehensive mesh data checks, including:
- Vertices with invalid #QNAN00 (not-a-number) values
- Vertices with corrupted values leading to #INF000 errors
- Isolated vertices
- Bad faces with equal vertices, with automatic repair functionality
- Integrates the 3DS object hierarchy seamlessly with the engine’s scene graph hierarchy
- Allows 3DS scenes to be loaded as subtrees within existing nodes of the scene graph
- Provides support for normal maps, environment maps, specular maps and self-illuminating maps
- Includes a custom-developed extension enabling the loading of multiple levels of detail (LOD)
3D Sound
- Harnessing the advanced capabilities of the FMOD sound engine to deliver immersive DOLBY 5.1 3D surround sound
Font Rendering
- Comprehensive internal font class
- Batching of triangles
- High-performance, anti-aliased text rendering utilizing OpenGL alpha testing for smooth visuals
- Simplified font style loading from diverse texture sets for flexibility in design
- Support for text leading, kerning, and precise spacing adjustments
- Efficient line breaking and text block rendering for structured layout and readability
Image Formats
- Utilizes the exceptional C++ library CxImage by Davide Pizzolato to enable texture loading for a wide range of popular and advanced image file formats
- Supported formats include:
- JPG (JPEG) – The most widely used image format globally
- JP2 (JPEG2000) – Renowned for its superior compression, ideal for photo-like images
- PNG – Offers lossless compression with alpha channel support, ensuring high-quality transparency
- TGA, TIFF, BMP, GIF, PCX, ICO, WBMP, WMF, ZLIB, MNG, JBIG, PNM, PPM, and PGM
- Features a self-developed PCX decoder for efficient handling of PCX files
Realtime Statistics
- Current Time – Displays the application’s current time
- Frames Per Second (FPS) – Indicates the current frame rate
- Activated Features – Lists enabled features, such as VBO, VSync, MSAA samples, anisotropic filtering, and more
- Camera Position and View Angle – Provides the current position and orientation of the camera
- Rendered Objects – Shows the number of opaque and transparent objects, smoothing groups, and per-pixel-lit objects
- Rendered Triangles – Displays the count of opaque and transparent triangles
- Reflection Maps
- Shadow Maps
- Performed Culling Tests – Tracks culling operations, including tests against the field of view (FOV) or a single view plane
- Current Textures in GPU Memory – Reports active textures currently loaded in GPU memory
- Memory Information – Displays details such as currently allocated memory and the highest memory allocation
- Active Light Sources – Lists the OpenGL light sources that are currently in use
- Intersection Tests – Provides details on tested OBBs and triangles, as well as the last intersection position, distance, and more
- OpenGL Renderer, Vendor, and Version – Displays the OpenGL renderer, vendor, and version information
Camera System
- Unlimited, easily activated cameras
- Animations seamlessly loadable from 3DS files
- Each camera controllable via mouse and keyboard with support for up, down, forward, strafe, and mouse look movements
Rendering Modes
- Seamless real-time switching between various visualizations via F1-F11 function keys
- Visualize wireframe, vertex normals, face normals, face tangents and bounding boxes
- Visualize the linearized depth buffer
- Visualize the content of shadow maps and reflection (cube) maps
- Visualize the content of each color attachment within the main FBO
- Visualize the content of the color attachments within the G-Buffer FBO
- Visualize the content of the utility color buffers used for SSAO and volumetric lighting effects
- Thick red axes represent the object’s pivot point, and blue axes indicate the center. Thin red axes display the object’s current rotation. Bold white boxes illustrate the oriented bounding boxes, which are used for view frustum culling








Miscellaneous
- VSync (vertical synchronization) support to eliminate screen tearing
- Clean and user-friendly Windows configuration interface






- OpenGL clip planes for real-time particle effects such as fire, smoke, and electroshock, along with OpenGL scissor tests for precise 2D clipping
- Seamless skybox background rendering for immersive environments
- Built-in user interface for intuitive gamma correction adjustments
Programming, Development and Design
- Developed using Microsoft Visual Studio with Visual C++
- Compiled into a static library for seamless usability across multiple projects
- Leverages GMax by Autodesk, a free 3D modeling and animation tool based on Discreet’s award-winning 3ds Max

- Implements smart application control to minimize CPU usage to nearly 0% when the program is minimized or lacks input focus
- Comprises approximately 139 C++ and 113 shader source files (GLSL)


- Offers optional control of nearly all rendering modules (e.g., lens flare, level, skybox) via XML script files, with XML parsing and DOM creation powered by the Xerces C++ Parser from The Apache XML Project
Reception
VGFXOpenGL was featured in the article titled “The Twitchspeed Generation – The Convergence of Synthetic Environments, Virtual Reality, and Computer Games: The Tools and the Benefits” on ETS-News.com, a platform dedicated to Military Defence Equipment, Simulation, and Training News.
