SurfelPlus

Logo

A real time dynamic global illumination renderer based on surfel. Final project of University of Pennsylvania's CIS 565 GPU Programming and Architecture class. Written by Zhen Ren, Ruipeng Wang and Jinxiang Wang.

View the Project on GitHub WANG-Ruipeng/SurfelPlus

SurfelPlus Project Page

DemoImage.png DemoImage.png

Introduction

SurfelPlus is a real-time dynamic global illumination renderer built on top of NVIDIA’s vk_raytrace framework. Using Vulkan ray tracing and surfel-based techniques, SurfelPlus aims to deliver high-quality lighting effects with dynamic scene updates, providing an efficient solution for realistic and immersive visual rendering in real time. Click here for the project pitch PDF.

Technical Overview

SurfelPlus utilizes surfel-based techniques to achieve high-quality and accurate lighting effects. This approach builds on the surfel GI method presented by EA SEED in their SIGGRAPH 2021 talk and SIGGRAPH 2024 talk. Originally designed for the Frostbite engine, these techniques have been carefully adapted and optimized for our Vulkan-based renderer, taking advantage of Vulkan’s flexibility and ray tracing capabilities to deliver real-time global illumination in dynamic scenes.

What are Surfels?

Surfels, short for “surface elements,” are point-like primitives that represent the surface of a 3D object. Each surfel stores key information, including position, normal, color, and other material properties, enabling efficient computation of light interactions in a scene.

image.png

In global illumination, surfels serve as intermediaries for light propagation and reflection, balancing accuracy and computational cost.

Key Features and Techniques

  1. Surfel-Based Indirect Lighting

    Indirect lighting is computed by storing and sharing light energy across surfels. This approach captures diffuse inter-reflections and supports dynamic scenes without requiring precomputed data, making it well-suited for interactive applications.

    image.png

  2. Lighting Integration

    SurfelPlus leverages Vulkan’s capabilities for direct lighting, while surfels handle the more performance-intensive indirect light calculations. This hybrid approach optimizes rendering performance without sacrificing visual quality.

  3. Global Illumination Pipeline
    • Surfel Preparation: Surfels are generated or updated based on the surfel coverage of the screen. Each surfel’s properties (e.g., normal, color, and reflectance) are computed to match the underlying surface.
    • Surfel Visibility and Culling: Surfels outside the camera’s view frustum or occluded by other geometry are efficiently culled to reduce computational overhead.
    • Lighting Calculation: Light bounces are simulated using surfel-to-surfel interactions, enabling indirect light accumulation in the scene.
  4. Grid-based surfel acceleration structure A grid-based surfel acceleration structure organizes surfels into spatial cells for fast neighbor queries and updates. This method enables efficient surfel-to-surfel interactions and scalable indirect lighting computations. image.png

Advantages of Surfel-Based GI

Surfel GI Render Passes Overview

Overview

image.png

G-Buffer Pass

The G-Buffer Pass is responsible for capturing per-pixel information about the scene’s geometry and surface properties, which are later used in lighting and shading computations. This pass encodes data such as primitive object ID, compressed world-space normals, and other attributes necessary for the rendering pipeline.

Visibility Buffer Depth Buffer
image.png image.png

Surfel Prepare Pass

A pass that reset some counters and prepares all the buffer for later accumulation.

Surfel Update Pass

The Surfel Update Pass is responsible for maintaining and updating the dynamic surfel data in real time. It processes active surfels to:

This pass ensures the surfel system remains efficient and responsive to scene changes, supporting real-time dynamic global illumination with consistent performance. However, surfel recycle may dispose some surfels in unseen area, causing the GI to re-converge when camera looks at them.

Cell Info Update Pass

Pre-allocate the offset and range of cell to surfel buffer.

Cell to Surfel Update Pass

Populate data in cell to surfel buffer.

Surfel Ray Trace Pass

The Surfel Ray Tracing Pass is responsible for casting rays from surfels to compute their radiance, which is essential for indirect lighting in the scene. This pass integrates ray-guiding sampling and cosine-weighted hemisphere sampling to ensure accurate and efficient light transport calculations.

When a ray reach its maximum depth but receiving not lights, we can use the surrounding surfels to provide diffuse indirect lighting for that ray. The helps the scene to converge faster. However, if there are many surfels nearby, sampling all of them would cause a huge performance deration. Therefore, a stochastic sampling strategy would be used to limit the number of surfel samples.

Surfel Integrate Pass

The Surfel Integration Pass is responsible for aggregating the radiance contributions collected by surfel rays, updating surfel properties, and sharing irradiance data among nearby surfels. This pass plays a crucial role in achieving consistent and smooth global illumination.

This pass ensures that surfels maintain smooth and stable lighting across frames while leveraging shared data to enhance global illumination accuracy and performance.

Surfel Generation & Evaluation Pass

The Surfel Generation Pass computes indirect lighting contributions for each pixel based on nearby surfels, updates shading information, and dynamically generates new surfels to ensure adequate coverage in the scene. This pass evaluates the lighting of the rendered image by incorporating smooth and detailed global illumination.

This pass evaluates the indirect diffuse lighting using nearby surfels, while dynamically adapting the surfel distribution to maintain high-quality and uniform global illumination in real-time scenarios.

image.png

Each color cell represents one surfel

Reflection Trace Pass

The Reflection Compute Pass computes specular reflections using RIS. It calculates accurate reflection contributions while efficiently handling complex material properties and varying surface roughness.

RIS: Implements a weighted reservoir sampling approach to select the best reflection candidate based on target contribution weights.

Reflection Computation: Traces reflection rays to gather radiance from the scene using both raw trace and surfel-based indirect lighting. The idea is similar to surfel ray trace. This approach accelerate reflection convergence surprisingly.

Without surfel indirect, max bounce = 6 With surfel indirect, max bounce = 1

From the above image, you can see the huge difference achieved by surfel indirect lighting even with only 1 bounce.

Firefly Suppression: Includes a threshold-based luminance clamp to prevent outliers (fireflies) in the reflection output, ensuring stable and realistic visuals.

This pass provides high-quality specular reflections, essential for realistic rendering of glossy and metallic surfaces, while maintaining efficiency through RIS and surfel indirect lighting techniques.

Spatial Temporal Filtering Pass

The Spatial Temporal Filtering Pass refines the specular reflection data by applying spatial reconstruction and temporal accumulation techniques. This pass ensures smooth and visually accurate reflections while mitigating noise and artifacts.

image.png

Reflection lighting in the scene

Bilateral Filtering Pass

The Bilateral Cleanup Pass refines the filtered reflection data by applying a bilateral filter that considers spatial, color, and normal similarity. This pass enhances the smoothness of reflections while preserving sharp edges and important details.

image.png

Filtered reflection image for denoising

This pass ensures high-quality reflection visuals by reducing noise and artifacts while maintaining important surface details and transitions, providing a polished final image.

SSAO Pass

A ssao pass to add more realism to the scene. Use temporal accumulation to do denoising.

Light Integrate Pass

This pass calculates direct lighting and integrats it with indirect and reflection information that gathered from previous passes.
Information needed (material, world position, etc.) for Direct lighting was obtained and uncompressed/reconstructed from G-Buffer, then ray-query features was used to compute shading accordingly.

Direct Lighting Indirect Lighting Reflection

TAA Pass

The TAA pass jitters the view frustum and strategically averges the color between multiple frames.

Position Reconstruction: Reconstruct world position using depth buffer and screen uv.

Previous Frame Reprojection: Using the view-projection matrix of last frame to calculate uv of world position of current pixel in last frame.

Reprojection

Neighbor Color Vector AABB: Sample the 3x3 neighbor color and adjacent neighbor color (surrounding pixels in “+” pattern), calculate aabb of color vector

AABB

Neighbor Color Clipping: clip the current color towards history color instead of just clamping it. In this way color from previous frame is trivially accepted to reduce ghost and smearing effect.

Clamping and Clipping

Blend and weigh history frames: Lerp between colors of past frame and this frame. Higher feedback factor will have a faster converge but will introduce artifacts.

Blend

Milestones Development Log

Milestone 1

Click here for the original PDF.

For our first milestone, we made significant progress in setting up the foundation of our renderer:

Key Achievements

This milestone established a solid groundwork for our surfel-based GI system.

Render Passes Implemented

image.png

Demo

Surfel Generation Visibility Buffer Normal Buffer
image.png image.png image.png

Milestone 2 Goals

For the second milestone, our focus is on improving the surfel system and integrating advanced features:

These improvements aim to advance the overall efficiency and realism of our renderer.

Milestone 2

Click here for the original PDF.

For Milestone 2, we achieved significant advancements in our surfel-based GI system:

Completed Goals

Partially Completed Goal

New Passes Implemented:

image.png

Demo

Diffuse Surfel indirect
image.png image.png

Milestone 3 & Final Goals

Looking ahead to Milestone 3 and the final stage of the project, our goals include:

Milestone 3

Click here for the original PDF.

For Milestone 3, we addressed key issues identified in Milestone 2 and implemented significant improvements:

Issues from Milestone 2:

Milestone 3 Improvements:

New Features:

Demo

Before Milestone 3 After Milestone 3
image.png image.png

Goals for Milestone 3 & Final:

These improvements position SurfelPlus as a highly efficient and visually robust renderer capable of dynamic global illumination with high performance and quality.

Final

Click here for final presentation PDF.

Completed Goals:

  1. Glossy Indirect Lighting:
    • Fully implemented support for glossy reflections, enhancing visual realism by simulating accurate light bounces on glossy surfaces. This feature significantly improves the fidelity of materials like polished metals and glass.
  2. Spatial-Temporal Filtering for Glossy Reflections:
    • Successfully integrated stochastically spatial-temporal filtering techniques for glossy reflections. This approach improves both temporal stability and spatial consistency, reducing flickering and noise in scenes.

Additional Features Implemented:

  1. Bilateral Filtering:
    • Added a bilateral filtering stage after spatial-temporal filtering to further smooth indirect lighting. This step preserves edge details while eliminating noise, resulting in cleaner and more visually appealing outputs.
  2. Temporal Anti-Aliasing (TAA):
    • Implemented TAA to address aliasing artifacts, particularly in high-contrast areas of the scene.
    • The current implementation focuses on motion vectors derived from camera movement, which provide smoother visuals during dynamic camera interactions.
    • Due to time constraints, we did not include ray hit re-projection, but the groundwork has been laid for future extensions.
  3. Screen-Space Ambient Occlusion (SSAO):
    • Integrated SSAO into the rendering pipeline to enhance the perception of depth and contact shadows. This feature improves the overall realism by adding subtle occlusion effects in areas where light is naturally obstructed. image.png

These enhancements collectively elevate the visual quality and performance of SurfelPlus, making it a robust and versatile renderer for real-time global illumination in dynamic environments.

TAA Pass

The TAA pass jitters the view frustum and strategically averges the color between multiple frames.

Position Reconstruction: Reconstruct world position using depth buffer and screen uv.

Previous Frame Reprojection: Using the view-projection matrix of last frame to calculate uv of world position of current pixel in last frame.

Reprojection

Neighbor Color Vector AABB: Sample the 3x3 neighbor color and adjacent neighbor color (surrounding pixels in “+” pattern), calculate aabb of color vector

AABB

Neighbor Color Clipping: clip the current color towards history color instead of just clamping it. In this way color from previous frame is trivially accepted to reduce ghost and smearing effect.

Clamping and Clipping

Blend and weigh history frames: Lerp between colors of past frame and this frame. Higher feedback factor will have a faster converge but will introduce artifacts.

Blend

Sharpen: Filter the final image with Laplace operator

No TAA TAA (Unsharpened) TAA (Sharpened)

Demo

Large open scene Closed scene
image.png image.png
With Glossy Indirect Lighting Without Glossy Indirect Lighting
image.png image.png

References

GIBS: SIGGRAPH 2021 talk
GIBS: SIGGRAPH 2024 talk
Stochastic All the Thing
Unreal Engine 5.5
SurfelGI-W298
Stochasitc Screen-Space Reflections
Ground Truth Ambient Occlusion