项目作者: arnaudmathias

项目描述 :
Forward+ Renderer
高级语言: C++
项目地址: git://github.com/arnaudmathias/forward_plus_renderer.git
创建时间: 2018-06-06T11:11:33Z
项目社区:https://github.com/arnaudmathias/forward_plus_renderer

开源协议:

下载


Forward+ Renderer

A real-time Forward+ renderer based on the paper
Forward+: Bringing Deferred Rendering to the Next Level
by Takahiro Harada, Jay McKee, and Jason C. Yang.

screenshot

Overview

As its name suggests, Forward+ is an extension to traditional forward rendering.
Before the final shading, a light culling stage is introduced to cull and store lights that contribute to the final pixel.

The rendering consist of 3 pass: the depth prepass, the light culling and the final shading.

1. Depth prepass

We fill the depth buffer by rendering the scene geometry without fragment shader.

depthpass

2. Light culling

In this pass we split the screen in tile of 16 x 16 pixels and use a compute shader to determine what lights are visible in each tile.
A workgroup is created for each tile. Within that workgroup, there are 256 threads, one for each pixel in the tile.

The depth buffer generated in the depth prepass is used to determine the min and max depth value within a tile.
A thread calculates the frustum planes for that tile, which will be shared by all threads in the workgroup.

Then each thread calculates in parallel (256 max) whether or not a light is inside the frustum.
The visible light indices are stored back by a single thread into a SSBO (Shader Storage Buffer Object).

light visibility

3. Final shading

For each fragment, we loop through the lights indices stored into the SSBO and accumulate the light contributions using a full direct lighting PBR.
The resulting color is stored within a HDR buffer and is post-processed in a final shader.

final shading with light debug

Build

  1. git clone --recursive https://github.com/indiedriver/forward_plus_renderer
  2. cd forward_plus_renderer
  3. cmake .

Controls

  1. Mouse movement - Orients the camera
  2. W,A,S,D - Move around
  3. F - Toggle fullscreen
  4. I - Toggle debug info HUD
  5. Q - Toggle light debug
  6. E - Toggle light visibility debug