DirectX 11 Real-Time Rendering Pipeline
A custom rendering pipeline built in DirectX 11, implementing real-time lighting, shadow mapping, and HLSL shaders to explore low-level graphics programming and GPU-driven rendering techniques.
Overview
Developed as part of MSc graphics programming coursework, this project focuses on building a custom real-time rendering pipeline in DirectX 11, exploring low-level GPU programming, shader authoring, and multi-pass frame rendering without relying on commercial game engines.
The renderer implements terrain rendering, dynamic lighting, shadow mapping, animated water shaders, and post-processing systems while exposing runtime debugging controls for live rendering configuration.
Goals
The primary goal was to design and implement a functional real-time renderer capable of handling geometry processing, lighting, and post-processing without relying on high-level engines.
The project aimed to develop a deeper understanding of the graphics pipeline, particularly how data is transferred, transformed, and rendered on the GPU.
My Contribution
- Implemented the full DirectX 11 rendering setup, including device and swap chain
- Developed HLSL shaders for lighting and screen-space effects
- Built a multi-pass rendering pipeline with intermediate render targets
- Implemented post-processing effects such as glow/bloom
- Managed GPU resources including buffers, textures, and render targets
System Architecture
Rendering Pipeline
The renderer follows a forward rendering approach, processing geometry, applying lighting in shaders, and outputting results through multiple passes.
Shader System
HLSL shaders are used for vertex and pixel processing, handling transformations, lighting calculations, and post-processing effects.
Render Targets
Intermediate render targets are used to store frame data between passes, enabling screen-space processing such as glow effects.
Frame Composition
The final frame is constructed through multiple rendering stages, combining base rendering with post-processing outputs.
Rendering Features
Forward Rendering
The renderer uses a forward rendering pipeline with per-pixel lighting calculated directly within HLSL shaders.
Shadow Mapping
Dynamic shadows are generated using a depth-based shadow map pass, sampled during the lighting stage for real-time shadow projection.
Animated Water Rendering
Water rendering uses a vertex displacement shader to animate a textured surface in real time using procedural wave motion.
Runtime Debug Controls
Runtime UI controls expose lighting parameters and rendering states, enabling rapid iteration and visual debugging during execution.
Technical Deep Dive
DirectX 11 Pipeline Setup
The renderer is built directly on DirectX 11, requiring explicit setup of the device, swap chain, render targets, and pipeline state. This includes configuring input layouts, vertex buffers, and draw calls for rendering geometry.
Dynamic Lighting and Shading
Lighting calculations are performed per-pixel in HLSL shaders, supporting both directional and point light sources. Surface normals, light attenuation, and shadow sampling are combined during fragment shading to produce dynamic scene lighting.
Multi-Pass Rendering
The rendering process is split into multiple passes, where intermediate results are written to textures and reused in subsequent stages. This enables more advanced effects that depend on full-frame data.
Post-Processing (Glow/Bloom)
Bloom is implemented as a screen-space post-processing effect using intermediate render textures. Bright regions are extracted, filtered, and recombined with the final frame to simulate light bleeding.
Shadow Mapping Pipeline
Shadows are generated through a dedicated depth rendering pass, where scene geometry is rendered from the light's perspective into a shadow map texture. This texture is then sampled during lighting calculations to determine shadowed fragments in the final scene.
Renderer Debugging
Runtime debugging tools were used extensively throughout development to inspect lighting behaviour, rendering passes, and shader output. Exposing adjustable lighting parameters during execution made it easier to validate shadow behaviour, attenuation, and scene composition.
The project also highlighted the importance of pipeline state management when combining multiple rendering passes and rasterization modes.
Challenges and Solutions
Managing GPU Resources Explicitly
Unlike engine-based workflows, DirectX requires manual handling of buffers, textures, and pipeline states. This introduced complexity in ensuring resources were correctly created, bound, and released.
Understanding Pipeline State and Flow
Building the renderer required understanding how each stage of the pipeline interacts, from vertex processing to pixel shading and final output.
Implementing Multi-Pass Effects
Post-processing required managing multiple render targets and correctly sequencing rendering passes, which increased complexity in frame composition.
Wireframe Rendering Conflicts
A rendering issue appeared when combining wireframe rasterization with the shadow rendering pass, producing incorrect visual output due to pipeline state interactions between render targets and depth processing. Investigating these interactions improved understanding of DirectX pipeline state management.
Performance and Optimisation
The renderer minimises unnecessary GPU state changes and reuses resources where possible. Rendering passes are organised to reduce redundant workload while maintaining flexibility for additional rendering features.
Offloading lighting and post-processing to shaders ensures that computational work is handled efficiently on the GPU.
Results
The final system successfully renders real-time scenes with dynamic lighting and post-processing effects, demonstrating a working understanding of the DirectX 11 graphics pipeline and shader-based rendering techniques.
Future Improvements
- Deferred rendering architecture
- Physically based rendering (PBR)
- Cascaded shadow mapping
- More advanced post-processing effects
- Screen-space ambient occlusion
- GPU profiling and performance tuning