DirectX Objects Finalised Paul Taylor 2010. Packing Your Objects

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements


CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Binary Search Visualization i j.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
Visible-surface Detection Computer Graphics Seminar MUM
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
Sprite Batching and Texture Atlases Randy Gaul. Overview Batches Sending data to GPU Texture atlases Premultiplied alpha Note: Discussion on slides is.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
Hidden Surface Removal
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
4.7. I NSTANCING Introduction to geometry instancing.
Geometric Objects and Transformations. Coordinate systems rial.html.
CSCE 552 Fall D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and point.
COMP 261 Lecture 16 3D Rendering. input: set of polygons viewing direction direction of light source(s) size of window. output: an image Actions rotate.
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
Visible-Surface Detection Jehee Lee Seoul National University.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
CS-378: Game Technology Lecture #2.2: Clipping and Hidden Surfaces Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney,
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Implementation II.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
CSE3AGT – How to fail the Exam Paul Taylor Things to forget: What is Barry? A hamster or a Guinea Pig? The differences between Dx9 and Dx10 What.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
Maths & Technologies for Games Spatial Partitioning 2
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
Computer Graphics I, Fall 2010 Implementation II.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
BSP Tree Supplement Jyun-Ming Chen. Fall Kd-Tree and BSP tree kd-tree is a special kind of bsp tree.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Graphics, Modeling, and Textures Computer Game Design and Development.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
OpenGL Objects Finalised. Debugging Tip For Debugging your applications remember: glGetError(); gluErrorString(); Don’t use these in release code (the.
Visibility Determination – List Priority Methods Chapter 11.

Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
Computer Graphics Implementation II
Hidden Surfaces Dr. Scott Schaefer.
3D Graphics Rendering PPT By Ricardo Veguilla.
CSCE 441: Computer Graphics Hidden Surface Removal
Introduction to geometry instancing
Computer Graphics Module Overview
Introduction to Computer Graphics with WebGL
Computer Graphics Introduction to Shaders
Visible-Surface Determination
Presentation transcript:

DirectX Objects Finalised Paul Taylor 2010

Packing Your Objects

DirectX Buffers A buffer contains Elements Elements are basic structures such as – Colours – Integer – Float Values An Element can contain a maximum of four components e.g. – Colour B8 G8 R8 A8 – Position X Y Z – Texture Coordinates – 4x Floats

DirectX Buffers Three types of buffer Vertex Index Constant

Vertex Buffers Contain per-vertex data X Elements per Vertex Offset Base Vertex Location Vertex 0Vertex 1 PositionColourTexCoordsPositionColourTexCoords

Index Buffers A String of 16 or 32 bit Indices Each Index points to a location of an element in an existing vertex buffer Offset (2) Start Index Location (1) Index Count (2) Not used 012 Vertex 0Vertex 1 PositionColourTexCoordsPositionColourTexCoords

Constant Buffers New to Dx10 A SINGLE element buffer, no multi-element abilities like vertex buffers Supply the Shaders with an array of constant values Each stage can support 15x 4096 component constant buffers

The DirectX 10 Pipeline us/library/ee415715%28VS.85%29.aspx A Constant Buffer can be used to capture the results of the Stream Output Stage

A Basic Packing Example SimpleVertex vertices[] = { D3DXVECTOR3( 0.0f, 0.5f, 0.5f ), D3DXVECTOR3( 0.5f, -0.5f, 0.5f ), D3DXVECTOR3( -0.5f, -0.5f, 0.5f ), }; D3D10_BUFFER_DESC bd; bd.Usage = D3D10_USAGE_DEFAULT; bd.ByteWidth = sizeof( SimpleVertex ) * 3; bd.BindFlags = D3D10_BIND_VERTEX_BUFFER D3D10_SUBRESOURCE_DATA InitData; InitData.pSysMem = vertices; CreateBuffer( &bd, &InitData, &g_pVertexBuffer ); UINT stride = sizeof( SimpleVertex ); UINT offset = 0; IASetVertexBuffers( 0, 1, &g_pVertexBuffer, &stride, &offset ); Draw( 3, 0 ); content/uploads/2007/04/heres-the-beef.jpg

Buffers can save time! Translate() Draw(Beef); Translate(…) Draw(Beef); Translate(…) Draw(Beef); content/uploads/2007/04/heres-the-beef.jpg

Index Buffers are great for reuse!

Warning!!! You can’t always share your Normals!

Partitioning your world ClearCut.jpg

Binary Spacial Partitioning (BSP) In today's gaming world, there are two important reasons for dividing the world – Rendering without the Z-Buffer – Rendering Translucent (Alpha Blend) Polygons

Why? Modern games have so many polygons that stretching the z buffer to cover the entire object range would result in many visual glitches, as many polygons start falling into the same depth levels of the buffer. Translucent Polygons are created using a blend function which requires back-to-front rendering (Painters algorithm)

How? There are many differing ways and methods to create maps of polygons, especially static collections One of the most common, and a very efficient way is utilising BSP trees. – The first use of a BSP tree was Doom in 1993 It was only used in a 2D implementation!

A BSP is a specialised implementation of a Binary Data Tree Binary Trees are used because: the ability to be efficiently traversed in both directions The ability to add data randomly during the building of the tree The speed in which a random location can be found

Binary Data Trees gif/CompleteBinaryTree_1000.gif /features/trees2/BuildTree1.gif

The Principal to creating a BSP Tree Each polygon (3D) / line (2D) creates a dividing line / plane in the tree where every other Polygon/line is either in front or behind.

Cutting your Polygons The offending Polygon / Line must be cut into two parts It then becomes two separate polygons / lines One infront of the division, the other behind

Reordering the split If we split using the red/green line first, our tree would require no splitting

Problems Creating BSP Lists Minimising Polygon Cuts Balancing the Tree

A short 2D Example

Creating a BSP Tree for Lines (Doom Style)

References us/library/bb205133%28VS.85%29.aspx#Buffe r_Resources