Search Unity

Please help me understand rendertextures as terrain heightmap

Discussion in 'World Building' started by Sevardos, Nov 10, 2020.

  1. Sevardos

    Sevardos

    Joined:
    Jan 12, 2018
    Posts:
    8
    I am currently using SetHeights() to to apply heights to a terrain.
    It works, but its a little slow. I have read on several occasions that it would be faster to use CopyActiveRenderTextureToHeightmap(). But I cant really find much documentation on how exactly to do that and what exactly it does.

    1. how must the rendertexture look like to be used as heightmap? I guess width and height is just the terrain resolution, what about depth and format?
    2. I never used rendertextures before, so how do I actually get the data into the rendertexture? I just have them in an array suitable for SetHeights(). I calculate the heights in a shader, so if I could avoid a readback to the CPU that would be great.
    3. Why is this method faster, what is the difference?
    4. Could I do something similar with Alphamaps? How would that look like?