+ All Categories
Home > Documents > Deferred Shading

Deferred Shading

Date post: 23-Feb-2016
Category:
Upload: jubal
View: 61 times
Download: 1 times
Share this document with a friend
Description:
Deferred Shading. Patrick Cozzi University of Pennsylvania CIS 565 - Fall 2013. Announcements. Project 6 Due Friday 11/15 Final Project Kickoff this Wednesday Hackathon Next Saturday 11/16, 6pm-12am, SIG lab Inviting the “pros”. Renderer Design. Design an engine that renders lots of - PowerPoint PPT Presentation
26
Deferred Shading Patrick Cozzi University of Pennsylvania CIS 565 - Fall 2013
Transcript
Page 1: Deferred Shading

Deferred Shading

Patrick CozziUniversity of PennsylvaniaCIS 565 - Fall 2013

Page 2: Deferred Shading

Announcements

Project 6Due Friday 11/15

Final ProjectKickoff this Wednesday

HackathonNext Saturday 11/16, 6pm-12am, SIG lab Inviting the “pros”

2

Page 3: Deferred Shading

Renderer Design

Design an engine that renders lots ofObjects with different materialsDynamic lightsDifferent light types

Cleanly. Efficiently.

3

Page 4: Deferred Shading

Forward Rendering – Multi-Pass

4

foreach light{ foreach visible object { Render using shader for this material/light;

accumulate in framebuffer; }}

Pros and cons?

Page 5: Deferred Shading

Forward Rendering – Multi-Pass

5

One shader per material/light-type Performance

Need to do vertex transform, rasterization, material part of fragment shader, etc. multiple times for each object.

Occluded fragments are shadedNot all lights affect the entire object

Page 6: Deferred Shading

Forward Rendering – Single Pass

6

foreach visible object{ find lights affecting object;

Render all lights and materials using a single shader;

}

Pros and cons?

Page 7: Deferred Shading

Forward Rendering – Single Pass

7

Lots of shadersOne shader per material/light-combinationHard to author shadersMay require runtime compile/linkLong ubershader increase compile timesMore potential shaders to sort by

Same as multi-passOccluded fragments are shadedNot all lights affect the entire object

Page 8: Deferred Shading

Deferred Rendering

8

foreach visible object{ write properties to g-buffer;}

foreach light{ compute light using g-buffer; accumulate in framebuffer;}

Pros and cons?

Page 9: Deferred Shading

Deferred Rendering

9

Decouple lighting from scene complexity Few shaders

One per materialOne per light type

Only transform and rasterize each object once

Only light non-occluded objects

Page 10: Deferred Shading

Deferred Rendering

10

Memory bandwidth usage - read g-buffer for each light

Recalculate full lighting equation for each light

Limited material properties in g-buffer MSAA and translucency are difficult

Page 11: Deferred Shading

G-Buffer Layout in Leadwerks 2.1

11Image from http://www.leadwerks.com/files/Deferred_Rendering_in_Leadwerks_Engine.pdf

Page 12: Deferred Shading

G-Buffer Layout in Leadwerks 2.1

12Image from http://www.leadwerks.com/files/Deferred_Rendering_in_Leadwerks_Engine.pdf

Page 13: Deferred Shading

G-Buffer Layout in Killzone 2

13Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 14: Deferred Shading

G-Buffer Layout in Killzone 2

14Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 15: Deferred Shading

G-Buffer Layout in Killzone 2

15Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 16: Deferred Shading

G-Buffer Layout in Killzone 2

16Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 17: Deferred Shading

G-Buffer Layout in Killzone 2

17Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 18: Deferred Shading

G-Buffer Layout in Killzone 2

18Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 19: Deferred Shading

G-Buffer Layout in Killzone 2

19Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 20: Deferred Shading

G-Buffer Layout in Killzone 2

20Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 21: Deferred Shading

G-Buffer Layout in Killzone 2

21Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 22: Deferred Shading

G-Buffer Layout in Killzone 2

22Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 23: Deferred Shading

Light Accumulation Pass

Geometry for each lightFull-screen quad/triangle

with scissor/stencil test3D bounding geometry. Examples:

Point light – sphere Spot light – cone Needs multiple passes. Why?

23

Page 24: Deferred Shading

Light Accumulation Pass

24Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 25: Deferred Shading

Light Accumulation Pass

25Image from http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

Page 26: Deferred Shading

References Deferred Rendering in Killzone 2 – Michal Valient

http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf Deferred Rendering in Leadwerks Engine - Josh Klint

http://www.leadwerks.com/files/Deferred_Rendering_in_Leadwerks_Engine.pdf Light Pre-Pass – Wolfgang Engel

http://www.slideshare.net/cagetu/light-prepass Compact Normal Storage for Small G-Buffers – Aras Pranckevičius

http://aras-p.info/texts/CompactNormalStorage.html

26


Recommended