zwcloud / MeshTerrainEditor-issues

Mesh Terrain Editor issue tracking and online docs
https://zwcloud.github.io/MeshTerrainEditor-issues/
5 stars 3 forks source link

Query mesh terrain to determine layer weights. #242

Closed zwcloud closed 2 years ago

zwcloud commented 2 years ago

requested by several users

  1. Convert world position (x,z) to uv coordinate (u,v) normalized in a mesh-terrain
    • CPU way: normalize world position with world AABB of a mesh-terrain to a uv of the weight-map, then sample the weight-map with the uv to get layer-weights
    • GPU way: raycast to get the world position's RaycastHit.textureCoord, then draw a pixel with the uv and a shader that output layer weights instead of weight-blended color.
  2. Sample the weight-map(s) with (u,v) and get per-layer weight