1 / 20

Procedural terrain on the GPU

Chalmers University of Technology Advanced computer graphics – DAT205. Procedural terrain on the GPU. David Sundelius Adam Scott. Introduction. Generating terrain is a task fitted well for parallelization and thus for the GPU

pooky
Download Presentation

Procedural terrain on the GPU

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Introduction • Generating terrain is a task fittedwell for parallelization and thus for the GPU • A techniqueto generate terrain, withtextures and lightingduringruntime. • Divides the worldintocubic blocks containingvoxels

  3. Agenda • Overview • Densityfunction and noisegeneration • Marchingcubesalgorithm • Texturing, shadingand lighting • Demo • Questions

  4. Terrain generation overview • Divideenvironment in blocks ofvoxels • Parallelize block calculation by usingpixelshaders • Use a densityfunctiontocreate the basicenvironment • Applynoiseto the generateddensityfunction • Use the marchingcubesalgorithmto generate geometry • Addtextures and texturecoordinates • Renderscene

  5. Densityfunction • Functionusedtocreatethe basicenvironment • A threedimensionalfunction • Positive and negative values • float density = -1; • float density = -ws.y; • float density = rad – length(ws- float3(0,rad,0));

  6. Noise generation • Generate somenoise 3d texturerepeating • Modify the densityfunctionwithrandom sampling from ournoisetexture • Use interpolation towarp the area • Abletocreate a hard floor or flat areas, just clamp the densityfunction • Possibilitytouse hand madetextures • Generate cavestructure

  7. Marchingcubes - Blocks • Marchthroughvoxels in blocks • For eachvoxelwecreate an arraywithinformation ofcornersfrom the densityfunction

  8. Marchingcubes – Lookuptables • Lookupconstructedarray • Pregeneretedlookuptables

  9. Marchingcubes - geometry • Geometryshader • Calculate position ofvertex • Calculate normal • Three different methodsto generate blocks

  10. Block generation method 1 • 1. Fillvolume • 2. Generate vertices • The slowestmethod

  11. Block generation method 2 • 1. Filldensityvolume • 2. Lightweight marker point • 3. Generate vertices

  12. Block generation method 3 • 1. Fillvolume • 2. List non-empty cells • 3. List verticesto generate • 4. Generate vertices • 5. Splatvertices • 6. Make triangles

  13. Lighting and ambient occlusion • Easytoimplement • Calculatingnormals • Ray casting • Long/short rays

  14. Premadetextures • Pros and cons • Loadingtextures (such as photographs) • Triplanartexturing – project on axiswithleastdistorted normal

  15. Generating textures • Generating textures • Marbletextures

  16. Pros and cons • Requires a lotofmemory on the GPU • Cancompromizevalitityof data (not exact), ambiguity in model • Canhaveholes • Fast wayto generate procedural environments • Easy and fast to manipulate environment • High resolution (easytoextendusetoLoD)

  17. Applications • Levelofdetail • Collisions • Lighting • Otheruse: 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://code-freeze.blogspot.se/2012/04/rebuilding-world-one-iteration-at-time.html • The CD to GPU gems 3 – Interactive demo

  20. Questions ?

More Related