Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Geomorphing terrain with a vertex shader (custom vertex data maybe?)

Discussion in 'Shaders' started by Buckslice, Oct 29, 2014.

  1. Buckslice

    Buckslice

    Joined:
    Sep 12, 2014
    Posts:
    5
    Hello everyone, I'm trying to get geomorphing working (better) in my planetary terrain engine. Geomorphing is where you morph from a lower resolution mesh to a higher one, in this case to reduce "popping" you see in the terrain. I want to be able to do it in the vertex shader, by passing a couple floats, rather then sending new mesh data every frame.

    What I currently have is the main terrain stored in vertices, colors, and normals of the mesh, and then the collapsed vertices are stored in mesh.tangents. I then lerp between them based on a float value passed to the vertex shader. However, I soon realized that I also need to store the collapsed colors and normals as well. I could use the two texture coordinate's but I still wouldn't have enough room.

    So I'm wondering if anyone has any ideas on how better pack data into the mesh class somehow, or if there's a way to send custom data to the vertex shader (didn't seem possible with Unity meshes), or really just a different/better way to do this. This is a pretty specific subject it seems, but hopefully some shader experts can help me out, Thanks!