Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advances in Real-Time Rendering in Games. Game Worlds from Polygon Soup: Visibility, Spatial Connectivity and Rendering Hao Chen Ari Silvennoinen Natalya.

Similar presentations


Presentation on theme: "Advances in Real-Time Rendering in Games. Game Worlds from Polygon Soup: Visibility, Spatial Connectivity and Rendering Hao Chen Ari Silvennoinen Natalya."— Presentation transcript:

1 Advances in Real-Time Rendering in Games

2 Game Worlds from Polygon Soup: Visibility, Spatial Connectivity and Rendering Hao Chen Ari Silvennoinen Natalya Tatarchuk Bungie Umbra Software Bungie

3 Advances in Real-Time Rendering in Games Talk Outline Game Environment Game Environment Previous Approach Previous Approach New Approach New Approach Implementation Implementation Demo Demo

4 Advances in Real-Time Rendering in Games Halo Reach

5 Advances in Real-Time Rendering in Games More than pretty pixels AI perception AI perception Activation Activation Object Attachment Object Attachment Audibility Audibility Caching/Paging Caching/Paging Path-finding Path-finding Collision/Physics Collision/Physics Visibility Visibility Spatial Connectivity Spatial Connectivity Rendering Rendering

6 Advances in Real-Time Rendering in Games More than pretty pixels AI perception AI perception Activation Activation Object Attachment Object Attachment Audibility Audibility Caching/Paging Caching/Paging Path-finding Path-finding Collision/Physics Collision/Physics Visibility Visibility Spatial Connectivity Spatial Connectivity Rendering Rendering

7 Advances in Real-Time Rendering in Games Background  Cells and portals  Potentially Visible Sets (PVS)  Occluder rasterization  Software rasterization  Hardware occlusion queries  GPGPU solutions  Spatial Connectivity  Watershed Transform  Automatic Portal Generation

8 Advances in Real-Time Rendering in Games Halo Approach Cells and portals Cells and portals Watertight shell geometry Watertight shell geometry Artists manually placed portals Artists manually placed portals Build a BSP tree from shell geometry Build a BSP tree from shell geometry Floodfill BSP leaves into cells Floodfill BSP leaves into cells Build cell connectivity Build cell connectivity

9 Advances in Real-Time Rendering in GamesProsPros Unified visibility/spatial connectivity Unified visibility/spatial connectivity Precise spatial decomposition Precise spatial decomposition Inside/outside test Inside/outside test Great for indoor spaces with natural portals Great for indoor spaces with natural portals

10 Advances in Real-Time Rendering in GamesConsCons Manual portalization is non-trivial! Manual portalization is non-trivial! Watertightness is painful for content authoring Watertightness is painful for content authoring Force early level design decision Force early level design decision Optimized for indoor scene only. Optimized for indoor scene only.

11 Advances in Real-Time Rendering in Games Portalization Example

12 Advances in Real-Time Rendering in Games Polygon Soup!

13 Advances in Real-Time Rendering in Games Polygon Soup Just pieces jammed together Just pieces jammed together No water-tightness No water-tightness No manual portals No manual portals Incremental construction/fast iteration. Incremental construction/fast iteration. Allow late design changes Allow late design changes

14 Advances in Real-Time Rendering in Games General Idea Sub-divide the scene Sub-divide the scene Voxelize the subdivided volume Voxelize the subdivided volume Segment the voxels into regions Segment the voxels into regions Build a connectivity graph between regions Build a connectivity graph between regions Build simplified volumes from voxel regions Build simplified volumes from voxel regions

15 Advances in Real-Time Rendering in Games 2D Example –Path Finding Input Scene [Recast Library: Mikko Mononen recastnavigation/]

16 Advances in Real-Time Rendering in Games 2D Example –Path Finding Voxelization

17 Advances in Real-Time Rendering in Games 2D Example –Path Finding “Walk-able” voxels

18 Advances in Real-Time Rendering in Games 2D Example –Path Finding Distance Field

19 Advances in Real-Time Rendering in Games 2D Example –Path Finding 2D Watershed Transform

20 Advances in Real-Time Rendering in Games 2D Example –Path Finding Contour

21 Advances in Real-Time Rendering in Games 2D Example –Path Finding Nav Mesh

22 Advances in Real-Time Rendering in Games 3D Watershed Bungie & Zhe Jiang University Zhefeng Wu, Xinguo Liu

23 Advances in Real-Time Rendering in Games 3D Watershed Transform

24 Advances in Real-Time Rendering in GamesProblemsProblems 3D is considerably harder/slower 3D is considerably harder/slower Over-segmentation (small regions) Over-segmentation (small regions) Sensitive to scene changes Sensitive to scene changes Simplified representation non-trivial Simplified representation non-trivial What about visibility? What about visibility?

25 Advances in Real-Time Rendering in Games Collaboration with Umbra Automatic portal generation Automatic portal generation Incremental/local updates Incremental/local updates CPU based solution, low latency CPU based solution, low latency Same solution for visibility and spatial connectivity Same solution for visibility and spatial connectivity Handle doors and elevators Handle doors and elevators Precise around user placed portals Precise around user placed portals Fast run time / low memory fooprint Fast run time / low memory fooprint

26 Advances in Real-Time Rendering in Games Umbra Solution Polygon soup Automatic cell and portal generation Visibility and connectivity queries Preprocess Runtime

27 Advances in Real-Time Rendering in Games Preprocess Overview Polygon soup Automatic cell and portal generation Visibility and connectivity queries Preprocess Runtime

28 Advances in Real-Time Rendering in Games Preprocess Overview  Discretize the scene into voxels  Determine voxel connectivity with respect to input geometry  Propagate connectivity to find connected components  Determine portals between local connected components

29 Advances in Real-Time Rendering in Games Tile Grid  Subdivide the input geometry into tiles

30 Advances in Real-Time Rendering in Games Tile Grid  Subdivide the input geometry into tiles  Localizes computation  Distributed computing  Fast local changes

31 Advances in Real-Time Rendering in Games Tile Voxelization  Compute a BSP tree for each tile

32 Advances in Real-Time Rendering in Games Tile Voxelization  Compute a BSP tree for each tile  Subdivide to discretization level  Skip empty space  Leaf nodes = voxels

33 Advances in Real-Time Rendering in Games From Voxels to Cells and Portals

34 Advances in Real-Time Rendering in Games From Voxels to Cells and Portals  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

35 Advances in Real-Time Rendering in Games Voxel Classification  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

36 Advances in Real-Time Rendering in Games Voxel Connectivity  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

37 Advances in Real-Time Rendering in Games Voxel Connectivity  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

38 Advances in Real-Time Rendering in Games Voxel Connectivity  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

39 Advances in Real-Time Rendering in Games Voxel Connectivity  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

40 Advances in Real-Time Rendering in Games Voxel Connectivity  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

41 Advances in Real-Time Rendering in Games Cells  Classify voxels  Connect voxels  Local connected components represent view cells  Build portals between connected cells

42 Advances in Real-Time Rendering in Games Portals  Classify voxels  Build voxel connections  Local connected components represent view cells  Build portals between connected cells

43 Advances in Real-Time Rendering in Games Portals  Classify voxels  Build voxel connections  Local connected components represent view cells  Build portals between connected cells

44 Advances in Real-Time Rendering in Games Cell Graph  Optimize cells and portals to a runtime cell graph  Runtime algorithms are graph traversals

45 Advances in Real-Time Rendering in Games Cell Graph  Optimize cells and portals to a runtime cell graph  Runtime algorithms are graph traversals  Graph structure allows limited dynamic changes

46 Advances in Real-Time Rendering in Games Runtime Algorithms Polygon soup Automatic cell and portal generation Visibility and connectivity queries Preprocess Runtime

47 Advances in Real-Time Rendering in Games Connectivity Algorithms  Connectivity is encoded in the precomputed cell graph  Connectivity queries are just graph traversals  Examples:  Find connected region (region == set of view cells)  Find shortest 3D path  Intersection queries  Ray casts  Combinations: Ray cast -> connected region -> objects in region  Lot’s of possibilities for simulation and AI

48 Advances in Real-Time Rendering in Games Visibility Algorithms  Practical analytic visibility in the cell graph  Axis aligned portals enable effective algorithms  From point visibility queries  From region visibility queries  Volumetric visibility  We can choose to be aggressive or conservative

49 Advances in Real-Time Rendering in Games Potentially Visible Sets  Deterministic conservative visibility  Computation time is directly related to culling efficiency  Every solution is useful  Sampling based visibility solvers can take long time to converge  Additional use cases:  Identify visibility hotspots  Cull always hidden triangles  Cull always hidden lightmaps

50 Advances in Real-Time Rendering in Games Portal Culling  How to traverse 100K+ portals fast?  Recursive algorithm does not scale  Many paths to one cell – combinatorial explosion  Rasterization based approach  BSP-style front-to-back traversal  Update coverage buffer on entry and exit  Fast – 16 pixels at a time with 128-bit SIMD vectors

51 Advances in Real-Time Rendering in Games Renderer Integration Focus on the pipeline, not on rendering techniques Focus on the pipeline, not on rendering techniques Visibility integration with game state extraction and rendering Visibility integration with game state extraction and rendering

52 Advances in Real-Time Rendering in Games Halo Reach Game Loop

53 Advances in Real-Time Rendering in Games Halo Reach Game Loop Coarse-grain parallelism Coarse-grain parallelism – System on a thread

54 Advances in Real-Time Rendering in Games Halo Reach Game Loop Coarse-grain parallelism Coarse-grain parallelism – System on a thread Explicit synchronization through state mirroring Explicit synchronization through state mirroring

55 Advances in Real-Time Rendering in Games Halo Reach Game Loop Coarse-grain parallelism Coarse-grain parallelism – System on a thread Explicit synchronization through state mirroring Explicit synchronization through state mirroring Mostly manual load-balancing Mostly manual load-balancing

56 Advances in Real-Time Rendering in Games Halo Reach Game Loop Simulation 30 hz Job kernel Render 30 hz Audio loop Job kernel, debug logging Async tasks, I/O, misc. HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5

57 Advances in Real-Time Rendering in Games Halo Reach Game Loop Simulation 30 hz Job kernel Render 30 hz Audio loop Job kernel, debug logging Async tasks, I/O, misc. HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5

58 Advances in Real-Time Rendering in Games Halo Reach Game Loop Simulation 30 hz Job kernel Render 30 hz Audio loop Job kernel, debug logging Async tasks, I/O, misc. HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5

59 Advances in Real-Time Rendering in Games Halo Reach: Simulation Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5

60 Advances in Real-Time Rendering in Games Halo Reach: Simulation Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update

61 Advances in Real-Time Rendering in Games Halo Reach: Simulation Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update Havok Update Obj move

62 Advances in Real-Time Rendering in Games Halo Reach: Simulation Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update Havok Update Obj move

63 Advances in Real-Time Rendering in Games Halo Reach: Simulation Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update Havok Update Obj move

64 Advances in Real-Time Rendering in Games Halo Reach: Simulation Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update Havok Update Obj move frame is published for rendering game state mirror

65 Advances in Real-Time Rendering in Games Halo Reach: Render Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update Havok Update Obj move Player Viewport 1 Player Viewport 2

66 Advances in Real-Time Rendering in Games Halo Reach: Render Thread (MP) Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update Havok Update Obj move Player Viewport 1 Player Viewport 2 PV1: Visib PV1: Submission PV2: Visib PV2: Submission

67 Advances in Real-Time Rendering in Games Halo Reach: Thread Utilization Simulation loop: % utilized Job kernel: 20-30% utilized Render loop: % utilized Audio loop: 50-80% utilized Job kernel, debug logging: 20-30% utilized Async tasks, I/O, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5

68 Advances in Real-Time Rendering in Games Halo Reach: Thread Utilization Simulation loop: % utilized Job kernel: 20-30% utilized Render loop: % utilized Audio loop: 50-80% utilized Job kernel, debug logging: 20-30% utilized Async tasks, I/O, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5

69 Advances in Real-Time Rendering in Games Can We Do Better? Observation #1: We don’t need the entire game state for rendering Observation #1: We don’t need the entire game state for rendering

70 Advances in Real-Time Rendering in Games Gamestate and Visibility In Reach, game state extraction happens before we do visibility In Reach, game state extraction happens before we do visibility – That’s why we have to copy the entire game state – Expensive (in ms and memory footprint)

71 Advances in Real-Time Rendering in Games Reduce CPU Latency Visibility is a large chunk of CPU time on render thread Visibility is a large chunk of CPU time on render thread Yet we have CPU time is under utilized Yet we have CPU time is under utilized – Underutilized HW threads – And not to mention other platforms!

72 Advances in Real-Time Rendering in Games Gamestate and Visibility But we can invert that operation But we can invert that operation Only copy data for visible objects out of game state Only copy data for visible objects out of game state – Only extract data for objects that will be rendered

73 Advances in Real-Time Rendering in Games Extract Post Visibility Better: Drive game extraction and processing based on results of visibility Better: Drive game extraction and processing based on results of visibility – Only extract data for visible objects (both static and dynamic) No need to double buffer the entire game state No need to double buffer the entire game state – Only buffer game data for the per-frame transient state for visible objects – Smaller memory footprint

74 Advances in Real-Time Rendering in Games Better Load Balancing Start by splitting off visibility computation into jobs per view Start by splitting off visibility computation into jobs per view – This includes visibility computations for player, shadow, reflection views Visibility jobs can have viewport-to-viewport dependencies Visibility jobs can have viewport-to-viewport dependencies – Can reuse results of one visibility job computation as input to another

75 Advances in Real-Time Rendering in Games Reducing Input Latency Stagger visibility computation at the same time as game object update Stagger visibility computation at the same time as game object update – Start static visibility early with predictive camera early in the frame – Start this before we do object update

76 Advances in Real-Time Rendering in Games Improve CPU Latency Run expensive CPU render operations for visible objects only Run expensive CPU render operations for visible objects only – Just make sure to run this after visibility – These would be render-only operations (skinning, cloth sim, polygon sorting) – they do not affect game play

77 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Predict camera envelope

78 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Determine render views next

79 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move Start static objects’ (environment) visibility and broadphase dynamic objects visibility for render views as jobs on available threads: player, shadows, etc.

80 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move Execute object update jobs

81 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move Run render prepare for static environment rendering jobs (bake precompiled command buffers, etc.)

82 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move Finalize camera (poll input)

83 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move Compute narrow phase dynamic objects visibility (as jobs)

84 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move Preparing visible dynamic objects and extracting game state data for them (in jobs)

85 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move Execute final prepare jobs to finalize frame packet data

86 Advances in Real-Time Rendering in Games An Improved Game Loop Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Object Update/Move \ \ Publish the frame for rendering

87 Advances in Real-Time Rendering in Games Streamlined Submission Thread Simulation loop: % Job kernel: 20-30% Render loop: % Audio loop: 50-80% Job kernel, debug logging: 20-30% Async tasks, socket polling, misc: 10-30% with bursts of 100% utilization HW Thread 0 HW Thread 1 HW Thread 2 HW Thread 3 HW Thread 4 HW Thread 5 Render submission job Object Update Havok Update Obj move

88 Advances in Real-Time Rendering in GamesBenefitsBenefits Decouple game-state traversal from drawing Decouple game-state traversal from drawing Better CPU utilization with staggered visibility computation Better CPU utilization with staggered visibility computation – Earlier results for each frame mean reduced input latency

89 Advances in Real-Time Rendering in GamesBenefitsBenefits Decouple game-state traversal from drawing Decouple game-state traversal from drawing Better CPU utilization with staggered visibility computation Better CPU utilization with staggered visibility computation Render thread becomes a streamlined kernel processor Render thread becomes a streamlined kernel processor

90 Advances in Real-Time Rendering in Games A Simple Little Job Tree

91 Advances in Real-Time Rendering in Games Future Work Predict dynamic objects visibility with temporal bounding volume Predict dynamic objects visibility with temporal bounding volume Fixup after final camera and object positions are known Fixup after final camera and object positions are known

92 Advances in Real-Time Rendering in Games


Download ppt "Advances in Real-Time Rendering in Games. Game Worlds from Polygon Soup: Visibility, Spatial Connectivity and Rendering Hao Chen Ari Silvennoinen Natalya."

Similar presentations


Ads by Google