VGFXOpenGL v1

Introduction

Developed in 2003, VGFXOpenGL (Venom Graphics OpenGL) version 1.0 is an in-house, hardware-accelerated 3D engine. Built on OpenGL 1.X, it takes full advantage of the fixed-function pipeline.

Technical Features

Target Platforms

  • Windows XP, Vista, 7, 8.X, 10, 11

Hardware Acceleration

  • Hardware-accelerated through the OpenGL 1.X fixed-function pipeline
  • Using extensions to access features from OpenGL 2.X
  • Supports all display resolutions and refresh rates (Hz)
  • Supports 32 bit color, 24 bit depth and 8 bit stencil buffers
  • Double buffering

Render Targets

  • Pixel buffers (pBuffers)
  • Framebuffer objects (FBO) with multisampling and mipmapping support
  • Packed depth-stencil FBO texture attachments (shared buffer for depth and stencil values)
  • Support for non-power-of-two (NPOT) FBO dimensions

Texturing

  • Bilinear, bilinear mipmapped and trilinear mipmapped filtering
  • 2x, 4x, 8x and 16x anisotropic filtering
  • Multitexturing using texture combiner
  • Smart texture management system
  • Hardware-accelerated mipmap generation
  • Environment/sphere mapping
  • 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
  • Render data is stored in Vertex Buffer Objects (VBOs) or optionally in vertex arrays
  • 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
  • All tests can also be done with the terrain system and its hierarchical representation

Terrain System

  • Advanced heightmap terrain generation system implemented in C++, based on the theoretical framework described in the paper Real-Time Generation of Continuous Levels of Detail for Height Fields. This powerful terrain rendering approach has also been utilized in commercial game blockbusters, such as Aquanox by Massive Development
  • Supports rendering of extremely large terrains (e.g., 1,050,625 vertices or 2,097,152 triangles) with high frame rates and excellent surface approximation, even on low-cost graphics cards
  • Features static and dynamic terrain lighting
  • Includes 4x multitexturing with integrated detail textures
  • Implements view frustum culling of the quadtree by efficiently culling qnode OBBs
  • Utilizes smooth geomorphing to seamlessly eliminate popping between levels of detail (LODs)
  • Supports spherical and cubic volumetric fog regions for atmospheric effects

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

Particle System

  • Advanced particle system capable of being rendered independently or integrated within the scene graph
  • Supports static or randomized texture selection for varied visual effects
  • 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

Lights and Shadows

  • Includes standard OpenGL lighting techniques, such as point lights, directional lights, and spotlights
  • Features advanced per-pixel lighting with support for normal maps and texture combiner integration
  • Incorporates material properties for realistic shading and rendering
  • Provides static lighting capabilities using precalculated vertex colors for improved performance
  • Supports robust real-time stencil shadow volumes for dynamic shadow rendering
  • Implements a fast algorithm to efficiently identify mesh silhouettes required for generating shadow volumes
  • Utilizes the depth-fail algorithm (Carmack’s Reverse) to manage scenarios where the eye position is inside a shadow volume
  • Optimizes rendering by treating shadow volumes as standard objects, allowing them to be rendered quickly as Vertex Buffer Objects (VBOs)
  • Offers offline calculation of shadow volumes for static objects with static light sources (e.g., buildings)
  • Renders shadow masks in a single pass into the stencil buffer, employing two-sided stencil testing and stencil value wrap extensions

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, and self-illuminating maps
  • Includes a custom-developed extension enabling the loading of multiple levels of detail (LOD)

Anti-Aliasing

  • Hardware-accelerated High-Resolution Anti-Aliasing (HRAA), also known as Multisample Anti-Aliasing (MSAA), controlled directly by the application
  • Supports the following sampling configurations:
    • 2x Samples, 2 Taps
    • 4x Samples, 4 Taps
    • 6x Samples, 6 Taps
    • 8x Samples, 8 Taps

Special Effects

  • Integration of the FMOD DSP Spectrum Analyzer for precise camera rumble and other special effects synchronized to audio beats
  • High-quality, hardware-accelerated radial blur supporting 256 or more layers
  • Hardware-accelerated blur implemented with texture mipmaps and the texture mipmap bias extension
  • Advanced hardware-accelerated glow effects for enhanced visuals
  • Realistic reflections and mirror effects
  • Particle-based effects, including fire, smoke, rain, snow, and flying leaves
  • Alpha blending for dynamic lighting effects, such as flares, glows, gunshots, and more
  • Lens flare effects with occlusion testing and view-dependent fading
  • Realistic muzzle flash effects tailored for 3D shooters
  • Electrifying visual effects for electroshock, laser, and plasma-based weapons
  • Impact effects, such as particle dust and sparks, featuring physically accurate reflection vectors

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
  • 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
  • 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 OpenGL 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, Wireframe, vertex normals, and bounding boxes can be visualized for detailed examination
  • 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 61 C++ source files
  • Offers optional control of nearly all rendering modules (e.g., terrain, 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.