Realtime lighting via Light Linked List 8072014 Abdul
Real-time lighting via Light Linked List 8/07/2014 Abdul Bezrati
Old: Deferred Lighting
Old: Deferred Lighting
Old: Deferred Lighting
New: Light Linked List
Deferred Lighting GBufferr Fill Light Buffers Light GBuffer Alpha
Diffuse Lighting
Specular Lighting
New approach • Store lights in a per-pixel linked list.
Compressed Fragment
Resolution • Lower resolutions are better: – One quarter, one eighth etc…
Memory Cost • 4 Buffers at one eighth resolution: – 2 RWByte. Address. Buffer – 1 RWStructured. Buffer – 1 Depth Buffer (optional) • Pre-allocate average 40 Lights per pixel. • Total cost: – 900 P: ~7. 25 megs – 1080 P: ~10. 15 megs
Insomniac Engine GBufferr Fill Linked Listr Light GBuffer Custom Materials Alpha
Insomniac Engine GBuffer (fast path) Fill Linked Listr Light GBuffer Custom Materials Alpha
Insomniac Engine GBufferr Fill Linked List Light GBuffer Custom Materials Alpha
Fill LLL Cost 900 P
Fill LLL Cost 1080 P
LLL Depth Buffer • Generate down-sized depth buffer. • Use conservative depth selection. • Use Gather. Red.
Light Shells
LLL Shader Steps • Software depth test. • Acquire min and max depth. • Allocate a LLL fragment.
LLL Depth Test
LLL Depth Test • Software test front faces.
Depth Bounds • Both depths need to come through. • Which depth comes first?
Depth Bounds • Bounds RWByte. Address. Buffer Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel
Depth Bounds • Encode Depth + ID – 16 bits Depth
Depth Bounds • Use Interlocked. Exchange New Info Old Info Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel
Light Fragment Links • Use a RWStructured. Buffer for storage:
Allocate LLL Fragment • Increment current count
Track Last Entry • Start. Offset RWByte. Address. Buffer: – Interlocked. Exachange New Index Old Index Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel Pixel
Light Fragment Encoding • Fill the linked light fragment and store it.
Insomniac Engine GBufferr Fill Linked Listr Light GBuffer Custom Materials Alpha
Lighting the GBuffer • Draw full-screen quad • Access the LLL • Apply the light
Accessing the SRVs • Fetch the first linked element offset: – The first linked element is encoded in the lower 24 bits.
Light Loop • Start the lighting loop: – An element index equal to 0 x. FFFFFF is invalid.
Decoding Light Depth • Decode the light min and max depth. • Compare the light depth.
Access Light Info • Fetch the full light information:
Insomniac Engine GBufferr Fill Linked Listr Light GBuffer Custom Materials Alpha
Custom Materials • Render geometry again. • Access the LLL while rendering.
Custom Materials
Shadows?
Questions? abezrati@insomniacgames. com
- Slides: 50