Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Accessing Terrain's Mask Map Channel Remapping

Discussion in 'World Building' started by luskos, Jul 30, 2023.

  1. luskos

    luskos

    Joined:
    Mar 4, 2013
    Posts:
    48
    Hi,
    can't seem to find how to access the Channel Remapping values, I want to change dynamically R value (Metallic) that way my lava terrain can have randomized lighting where's emission on it so it seems more lively.
     
  2. F_Dspace

    F_Dspace

    Joined:
    Mar 5, 2020
    Posts:
    1
    Hi! I think you can try these lines of code :
    Code (CSharp):
    1. var yourLayer = _terrain.terrainData.terrainLayers[0];
    2. var maxVal = 0.8f;
    3. var minVal = 0.2f;
    4. yourLayer.maskMapRemapMax = new Vector4(maxVal,1,1,1);
    5. yourLayer.maskMapRemapMin = new Vector4(minVal,0,0,0);
    I hope it will help you :)