Presentation is loading. Please wait.

Presentation is loading. Please wait.

Engine Basics: Optimizing Geometry CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia.

Similar presentations


Presentation on theme: "Engine Basics: Optimizing Geometry CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia."— Presentation transcript:

1 Engine Basics: Optimizing Geometry CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia

2 Real-Time Rendering 2 David Luebke SIGN UP SHEET Today: Fight Night videos Demo Time

3 Real-Time Rendering 3 David Luebke Homework The pitch: “due” Tuesday, keep pitching The game: due today at midnight

4 Real-Time Rendering 4 David Luebke Recap: Scene Graph Node Examples Objects Groups of objects LOD selectors Animation “effectors” –“Flipbook” animation selectors –Transform drivers –Deformers –Skeletal animation players Lights! Cameras! Transforms Useful state –Bounding boxes, partitions Graphics state –Which textures, shaders bound –Material –Other state - glEnable(GL_FOO) “Raw” geometry –Vertices and triangles Note: often actual geometry only exists at leaves

5 Real-Time Rendering 5 David Luebke Scene Graph Traverals Classical use of scene graph: –Traverse in depth-first fashion –Apply effects of “action” nodes when reached LOD selectors, animation effectors –Push/pop matrices when reach/leave xform nodes –Issue geometry as reached Not very efficient for complex scenes ( why? ) –Unnecessary pushing/popping –Constantly switching graphics state –No spatial organization –Lots of recalculation for multiple passes

6 Real-Time Rendering 6 David Luebke Scene Graph Traversals Can optimize traversal logic several ways, e.g.: –Cache per-frame computations: bbox, matrices –Flatten hierarchy for unchanging subgraphs –Call animation effectors first & update bboxes bottom-up Visibility computations affect traversal –View-frustum culling: top-down, separate visibility grid –Cells & portals: portals can be special arcs –Other: BSP trees, 2.5D from-region, fog-of-war

7 Real-Time Rendering 7 David Luebke Scene Graph Traversals Common traversals: –Simple depth-first. Optional: View-frustum culling or other visibility scheme Different LOD biases Cache bbox/visibility/matrix info for later passes –Rough front-to-back sort –Sorted by state –Geometry-only

8 Real-Time Rendering 8 David Luebke Efficient Rendering So leaves of the scene graph represent geometry… How to efficiently represent that geometry? –Hint: not like this: typedef float Point[3]; typedef Point Triangle[3]; Triangle tris[] = new Triangle[ntris];... glBegin(GL_TRIANGLES); for (i=0;i<nverts;i++) { glVertex3fv(tris[i][0]); glVertex3fv(tris[i][1]); glVertex3fv(tris[i][2]); } glEnd();

9 Real-Time Rendering 9 David Luebke 5 Steps to Efficient Rendering Step 1: reduce #vertices/triangle Step 2: reduce overhead of each vertex Step 3: recognize the existence of the vertex cache Step 4: display lists (deprecated re: performance) Step 5: learn about the hardware

10 Real-Time Rendering 10 David Luebke Other things you should know Most interesting stuff in OpenGL isn’t in red book –Extension registry http://oss.sgi.com/projects/ogl-sample/registry/ Extensions you should know: –ARB_multitexture –EXT_framebuffer_object –ARB_occlusion_query –ARB_point_sprite –ARB_texture_rectangle –ARB_draw_buffers –ARB_texture_float (_framebuffer_float, _half_float_pixel, etc) –ARB_depth_texture –ARB_vertex_buffer_object (_pixel_buffer_object)

11 Real-Time Rendering 11 David Luebke Coming Up Next topic: programmable graphics hardware –We’ll use NVIDIA’s Cg language because I know it –Similar alternatives: Microsoft’s HLSL for DirectX OpenGL Shading Language ( GLSL, once Glslang) –Different approach: Sh


Download ppt "Engine Basics: Optimizing Geometry CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia."

Similar presentations


Ads by Google