Presentation is loading. Please wait.

Presentation is loading. Please wait.

Procedural terrain on the GPU Chalmers University of Technology Advanced computer graphics – DAT205 David Sundelius Adam Scott.

Similar presentations


Presentation on theme: "Procedural terrain on the GPU Chalmers University of Technology Advanced computer graphics – DAT205 David Sundelius Adam Scott."— Presentation transcript:

1 Procedural terrain on the GPU Chalmers University of Technology Advanced computer graphics – DAT205 David Sundelius Adam Scott

2 Introduction Generating terrain is a task fitted well for parallelization and thus for the GPU A technique to generate terrain, with textures and lighting during runtime. Divides the world into cubic blocks containing voxels

3 Agenda Overview Density function and noise generation Marching cubes algorithm Texturing, shading and lighting Demo Questions

4 Terrain generation overview Divide environment in blocks of voxels Parallelize block calculation by using pixelshaders Use a density function to create the basic environment Apply noise to the generated density function Use the marching cubes algorithm to generate geometry Add textures and texture coordinates Render scene

5 Density function Function used to create the basic environment A three dimensional function Positive and negative values float density = -1; float density = -ws.y; float density = rad – length(ws- float3(0,rad,0));

6 Noise generation Generate some noise 3d texture repeating Modify the density function with random sampling from our noise texture Use interpolation to warp the area Able to create a hard floor or flat areas, just clamp the density function Possibility to use hand made textures Generate cave structure

7 Marching cubes - Blocks March through voxels in blocks For each voxel we create an array with information of corners from the density function

8 Marching cubes – Lookup tables Lookup constructed array Pregenereted lookuptables

9 Marching cubes - geometry Geometry shader Calculate position of vertex Calculate normal Three different methods to generate blocks

10 Block generation method 1 1. Fill volume 2. Generate vertices The slowest method

11 Block generation method 2 1. Fill density volume 2. Lightweight marker point 3. Generate vertices

12 Block generation method 3 1. Fill volume 2. List non-empty cells 3. List vertices to generate 4. Generate vertices 5. Splat vertices 6. Make triangles

13 Lighting and ambient occlusion Easy to implement Calculating normals Ray casting Long/short rays

14 Premade textures Pros and cons Loading textures (such as photographs) Triplanar texturing – project on axis with least distorted normal

15 Generating textures Marble textures

16 Pros and cons Requires a lot of memory on the GPU Can compromize valitity of data (not exact), ambiguity in model Can have holes Fast way to generate procedural environments Easy and fast to manipulate environment High resolution (easy to extend use to LoD)

17 Applications Level of detail Collisions Lighting Other use: create 3d models from sampling i.e. MRI

18 Demonstration Video

19 Further research http://undergraduate.csse.uwa.edu.au/units/CITS4241/Project/ references/Lorensen-Cline-brief.pdf http://undergraduate.csse.uwa.edu.au/units/CITS4241/Project/ references/Lorensen-Cline-brief.pdf http://code-freeze.blogspot.se/2012/04/rebuilding-world-one- iteration-at-time.html http://code-freeze.blogspot.se/2012/04/rebuilding-world-one- iteration-at-time.html The CD to GPU gems 3 – Interactive demo

20 Questions ?


Download ppt "Procedural terrain on the GPU Chalmers University of Technology Advanced computer graphics – DAT205 David Sundelius Adam Scott."

Similar presentations


Ads by Google