文章

程序化地形 GPU Driven Terrain

术语

Sector

最高分辨率的平铺块

流程

CPU 实现版本

stateDiagram-v2
    Stream: Stream quadtree nodes
    Tracerse: Tracerse quadtree. Select nodes to cover the terrain.
    Cull: Cull nodes to view
    Batch: Batch into shading groups
    Render: Render
    
    state CPU {
    	Stream --> Tracerse
    	Tracerse --> Cull
    	Cull --> Batch
    }
    
    state GPU {
        Render
    }
    
    [*] --> CPU
    CPU --> GPU
    GPU --> [*]
    

GPU 实现版本

  • 数据仅在GPU处理
stateDiagram-v2
    Stream: Stream quadtree nodes
    Tracerse: Tracerse quadtree. Select nodes to cover the terrain.
    Cull: Cull nodes to view
    Batch: Batch into shading groups
    Render: Render
    
    state CPU {
    	Stream
    	
    }
    
    state GPU {
    	Tracerse --> Cull
    	Cull --> Batch
    	Batch --> Render
    }
    
    [*] --> CPU
    CPU --> GPU
    GPU --> [*]

Stream quadtree nodes

image-20230626095739177

image-20230626100050423

image-20230626100224302

image-20230626101050670

常见的流式加载策略

  1. 加载环绕角色周围的最高级高精度 LOD
  2. 下一级LOD的范围将覆盖全地图一半的距离
  3. 直到所有低层次的LOD被加载完成

一些细节

  • 重叠区域的重复加载

  • 加载是异步的

    image-20230626101310675

Tracerse quadtree

image-20230626112439388

  • 哪些节点是真正被渲染的?
  • 从四叉树根节点深度遍历,直接子节点被加载,并细分该节点

Cull Nodes To View

image-20230626112857874

  • 只需要渲染在视锥内的 Node

image-20230626113118118

Batch into Shading Groups

image-20230626113319768

  • Shader的LOD分层,可以与Node的LOD不相关

Terrain Quad Tree - 四叉树

Node存储的信息

  • 高度图
  • 世界坐标系法线图
  • 地形纹理

GPU 四叉树

LOD

接缝处理

怎么做离线存储

本文由作者按照 CC BY 4.0 进行授权