13. LOD - Level of Detail
Split each chunk into 4 when LOD increases
Chunk side vertex count must be 2^n
14. LOD - Level of Detail
Connect patches by copying:
left of right to right of left
new count is (2^n)+1
15. LOD - Tricks
Optimize patch side vertex count for
performance
You want few GPU ops with a lot of data
You don’t want the GPU to ‘swap’ from
VRAM to RAM
21. So Far
• Dealt with LOD, splitting
• Found a suitable projection system
• Triangulated the terrain meshes
• Each patch of terrain - Vertex Buffer Object
22. Redundancy
• Several representations of the same data
• Increased dataset size, up to 2x
• No way around for textures
• EP + 1 for everything else
24. EP + 1 Storage
• Reprocess the entire dataset
• Write all samples as chunks
• Arrange by LOD levels
• Don’t write duplicate samples
• Reading a chunk is now fseek+fread
25. Eye Candy 1 - Lighting
• Normals are crucial
• Light intensity directly proportional to LoN
26. Calculating Normals
• Use a single chunk of vertexes
• Rotate and scale accordingly
• Attach heightmap as texture
• Morph (planet radius + texture height)
• Sample neighboring heights for normal
30. Eye Candy 2 - Atmosphere
• Two types of scattering, Mie & Rayleigh
• Small molecules, O2, O3, etc - Rayleigh
• Aerosols - Mie (gray when it rains, pollution
haze, etc)
31. Atmospheric Shader
Phase function - Amount of scattering for camera angle
Outscattering - Optical depth of ray from entry point to camera
Inscattering - Amount of light added by scattering on planet surface
into camera
37. Fun!
• Add gravity, each object is a node, it’s easy
• Export from SketchUp to .obj, auto
triangulate + auto normals
• Write a script to convert .obj into a vertex
buffer object
• Drop in a dead simple shader