+ All Categories
Home > Documents > Procedural Graphics with DirectX 11

Procedural Graphics with DirectX 11

Date post: 23-Jan-2016
Category:
Upload: jaafar
View: 64 times
Download: 3 times
Share this document with a friend
Description:
Procedural Graphics with DirectX 11. James Reid. Meshes. A mesh is what all the textures are laid on. Meshes are deformed to give us the nice terrains seen in games today using height maps or procedural methods. More vertices require more GPU power! - PowerPoint PPT Presentation
Popular Tags:
28
Procedural Graphics with DirectX 11 James Reid
Transcript
Page 1: Procedural Graphics with DirectX 11

Procedural Graphics with DirectX 11

James Reid

Page 2: Procedural Graphics with DirectX 11

Meshes

• A mesh is what all the textures are laid on.• Meshes are deformed to give us the nice

terrains seen in games today using height maps or procedural methods.

• More vertices require more GPU power!• Goal: reduce number of vertices in a mesh

without sacrificing quality.

Page 3: Procedural Graphics with DirectX 11

Height Maps• Advantages:

– Easily modeled by an artist.– Easily implemented.– Normal maps can be paired for lighting.– Use far less memory than meshes.– Easier on the CPU/GPU.

• Disadvantages:– Only able to show 256 distinct heights in grayscale.– Can quickly consume hard disk space when having to store

height/normal/tangent/etc maps.• Image: The Elder Scrolls V: Skyrim

Page 4: Procedural Graphics with DirectX 11

What is Procedural?

• From Wikipedia: “content generated algorithmically rather than manually”

• Content is created at run time, not compile time or stored in file.

• Most games use height maps and models.• Image: The Elder Scrolls III: Morrowind

Page 5: Procedural Graphics with DirectX 11

Why Use Procedural?

• Memory usage is far less on both the hard disk and in RAM.

• Size limitations are much larger than those involving height maps.– Allows games to be released on a single CD/DVD.– Makes downloadable games more manageable.

• Image: Minecraft

Page 6: Procedural Graphics with DirectX 11

Basis For Procedural

• Noise algorithms.– Perlin– Voronoi

• Can be implemented in different dimensions.– 1D– 2D (used for terrain/clouds)– 3D (used for clouds the user can fly through)

Page 7: Procedural Graphics with DirectX 11
Page 8: Procedural Graphics with DirectX 11
Page 9: Procedural Graphics with DirectX 11

How Noise Works

• Summing up of static maps generated with pseudorandom numbers.

• Basic Algorithm:

double t = 0;double amplitude = 1;double freq = m_dFrequency;

for(int i = 0; i < m_nOctaves; i++) { t += GetValue(x * freq + m_nSeed, y * freq + m_nSeed) * amplitude; amplitude *= m_dPersistence; freq *= 2;}return t;

Page 10: Procedural Graphics with DirectX 11
Page 11: Procedural Graphics with DirectX 11

Using Perlin Noise

• Start with a mesh.• Generate a height field using Perlin Noise.• Assign the coordinate for each pair in the

mesh.• Result:

Page 12: Procedural Graphics with DirectX 11

Scalability

• Makes very convincing terrain.• Issues:– High number of vertices.– Static meshes can’t adapt to camera’s view.

• Solution:– Use a quadtree structure to store the data.

Page 13: Procedural Graphics with DirectX 11

Quadtree Structure

• Similar to binary trees, but has 4 nodes instead of 2.

Page 14: Procedural Graphics with DirectX 11

Quadtree Mesh

Page 15: Procedural Graphics with DirectX 11

Uses For The Quadtree

• View frustum culling.• Level of detail (LOD).• Collision detection.• Grid location.• Reducing total vertices.

Page 16: Procedural Graphics with DirectX 11

View Frustum

• Field of view the camera has.• Used in culling and LOD.

Page 17: Procedural Graphics with DirectX 11

Frustum Culling

• Removing of primitives that are not seen from the graphics pipeline to increase performance.

• More types:– Backface– Contribution– Occlusion

Page 18: Procedural Graphics with DirectX 11
Page 19: Procedural Graphics with DirectX 11

Level of Detail (LOD)

• The amount of detail shown being based on the camera’s view point.

• Where DirectX 11 makes a difference.– Use of the geometry shader.

Page 20: Procedural Graphics with DirectX 11
Page 21: Procedural Graphics with DirectX 11

Vertex Interpolation Error

• When changing LOD the new vertices may cause popping.

• Several solutions to this, most common is to just take the midpoint of both vertices.

Page 22: Procedural Graphics with DirectX 11

Texture Morphing

• LOD can cause textures to not line up and varying levels of detail.

• Solution: Use texture blending to hide the effect.

Page 23: Procedural Graphics with DirectX 11

Vertex Reduction

• Use minimum number of vertices based on slope of terrain.

• Image: Shamus Young (Twenty Sided)– Top right: no optimization– Bottom left: optimized grid, removed about two-

thirds of total vertices (Huge performance increase!)

Page 24: Procedural Graphics with DirectX 11

Tessellation

• Started in DirectX 10 – can be controlled by user with DirectX 11

• Take a mesh and add more primitives to smooth it out.

Page 25: Procedural Graphics with DirectX 11
Page 26: Procedural Graphics with DirectX 11

Putting It All Together

• Use CPU to determine LOD and any culling to be done based on view frustum.

• Use noise algorithm in real time on the GPU to generate height field.

• Remove any unwanted vertices based on slope of terrain (e.g. flat areas will use two triangles instead of filling up the mesh).

• Morph the textures at the LOD breaks.• Tessellate the mesh in high detail locations.

Page 28: Procedural Graphics with DirectX 11

References• Schneider, J., & Westermann, R. (2006). Gpu-friendly high-quality terrain rendering.,

Computer Graphics and Visualization Group, Technische Universität München, Munich, Germany.

• Yusov, E., & Turlapov, V. (2007). Gpu-optimized efficient quad-tree based progressive multiresolution model for interactive large scale terrain rendering., Department of Computational Mathematics and Cybernetics, Nizhny Novgorod State University, Nizhny Novgorod, Russia.

• Perlin, K. (2001). Improving noise., Media Research Laboratory, Dept. of Computer Science, New York University , New York City, NY, .

• Verts, W. T., & Hill, Jr., F. S. (1989). Quadtree meshes, COINS Department, ECE Department, University of Massachusetts, Amherst, MA, .

• Olsen, J. (2004). Realtime procedural terrain generation., Department of Mathematics And Computer Science (IMADA), University of Southern Denmark, .

• Bernhardt, A., Maximo, A., Velho, L., Hnaidi, H., & Cani, M. (2011). Real-time terrain modeling using cpu–gpu coupled computation., INRIA, Grenoble Univ., Univ. Lyon 1, IMPA, France, Brazil.


Recommended