The Westlake Engine employs a DirectX 11-based forward rendering system that integrates multiple graphics capabilities. The engine's renderer combines various vertex data layouts with comprehensive buffer and texture management, while supporting sprite sheets and 2D animations. It also features bitmap font rendering, a material pipeline, and a versatile shader system that handles vertex, pixel, and compute shaders to deliver efficient graphics processing.
(I'm currently implementing DX12, will update soon!)
The system supports two vertex types: PCU and PCUTBN. Geometric shapes are constructed from triangles, with each triangle requiring three vertices. The rendering process involves transferring vertex data from CPU to GPU for drawing. To optimize memory usage, the system offers two drawing methods:
Direct vertex drawing: Uses a simple vector of vertices
Indexed drawing: Uses vertex indices to reuse shared vertices, reducing memory consumption by eliminating duplicate vertex data
Additionally, the system implements vertex and index buffers to efficiently manage memory by storing vertex and index data on the heap, eliminating the need to rebuild these structures every frame.
The engine features comprehensive texture mapping capabilities for all primitive shapes. It implements UV mapping for various 3D primitives, as demonstrated by the custom UV layouts for cylinders and spheres, where each face is systematically mapped with numbered coordinates.
The UV mapping system is specifically designed for each primitive shape's geometry, ensuring proper texture wrapping and minimal distortion, as shown in the cylinder and sphere examples with their numbered UV layout patterns. This systematic approach allows consistent and predictable texture mapping across all supported primitive shapes.
The texture system supports multiple texture layers for advanced material rendering:
Diffuse maps for the base color and surface detail (like the brick and grass textures)
Normal maps for surface relief and detail (shown in the blue texture maps)
Specular/Gloss maps for controlling surface shininess and reflectivity
Emissive maps for self-illuminating surfaces
Each primitive shape can be assigned different texture layers, allowing for complex material compositions. The system demonstrates this through examples of brick and grass materials, where each material consists of multiple texture maps (diffuse, normal, and spec/gloss) that work together to create realistic surface appearances.
The engine implements a constant buffer system to handle various shader types and lighting calculations. This includes:
Lighting Constant Buffer:
Supports diffuse shader calculations for basic surface lighting
Enables Phong shading model for more realistic lighting with specular highlights
Stores essential lighting parameters like light direction, intensity, and ambient values
Handles material properties needed for light calculations
Blur Constant Buffer:
Dedicated to emissive shader effects
Allows objects to appear self-illuminating, as demonstrated by the colored cubes in the first image (*)
Can be combined with other shaders, as shown in the tank model where diffuse, Phong, and emissive effects are used together
Here is the quick view of the header file for the DX11 Render in Westlake Engine: