Search code examples
unity-game-engine

Shift key + mouse left button is not lowering the terrain. how to lower the terrain?


I want to make the ground in this place of the terrain a bit deeper a bit lower but left shift key or right shift key and the left mouse button does not change anything on the terrain.

enter image description here


Solution

  • I've been looking for an answer for hours, and I finally found it. If you are trying to lower a piece of land that is already at 0 height, you will not be able. You can only lower areas that are above to height 0. In short, height 0 is the minimum: you cannot go to snow values ​​due to the way the terrain is created. To be able to make valleys then you have to select the tool "Set Height", enter a height and raise all the ground to that height with "Flatten All", or small pieces of land by dragging the mouse on the ground. If you click "Flatten All", all the terrain will be brought to that height, losing all the changes made previously for the mountains. However, if you have already made land and you don't want to lose it and redo it from scratch, you can use the following solution:

    1. Export the current heightmap;
    2. Open the image in an editor; (I'm not an expert in Photoshop or other graphics programs, but I'm sure Photoshop has a way. If there isn't an entry in the program, find out how to use scripts in photoshop) Find a way to set the pixels according to a formula: maximum depth of valleys + current value of the grayscale pixel * original height / (original height + maximum depth of valleys);
    3. Export the image in Raw format;
    4. Go back to Unity and import it on the ground as you read in the link above;
    5. In the terrain settings set the height equal to the value you used in the formula called "original height" + the “maximum depth of valleys” value;
    6. You should now have the ground as before, but higher. Set the value in the transform of the Y position equal to "-maximum depth of valleys" so that it is at the same height as before.

    You should now be able to create valleys! I haven't tried the process, but I've thought about it so much I'm pretty sure it will work.

    Good work!