Search Unity

Painting the underside of a terrain

Discussion in 'World Building' started by xbertou, Jul 18, 2021.

  1. xbertou

    xbertou

    Joined:
    May 3, 2021
    Posts:
    8
    Hi, beginner terrain user (and Unity in general) here...
    I have a reduced scale mountain as a terrain and I'd like to be able to "enter" below the mountain. When I do so, I can of course see outside as the terrain is transparent (not rendered) when seen from below. Is there a way to paint/put material to the "back" side of a terrain? I thought about creating an "anti-terrain" with the opposite altitude and then rotate it 180 deg in x or z but found out terrains can't be rotated... I'd rather not abandon the terrain solution if possible...
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Terrain is one sided mesh so you can probably make a hole but have to use a 3D mesh for any interior stuff.
     
  3. xbertou

    xbertou

    Joined:
    May 3, 2021
    Posts:
    8
    Right. More than one sided it is an up-sided (y) mesh, if I understand correctly. No way of having a terrain facing down, correct?
    In that case I was thinking about having somewhere else a terrain and a 180deg rotated camera so it looks like it is facing down would work, and moving from the up-world to the down-world using Terrain.activeTerrain.SampleHeight(transform.position).
    Does it make sense or is there a better way of doing this (I don't necessarily need to be able to see both worlds at the same time, it is really an inside/vs/outside option)?
    (writing this solution reminds me of Stranger Things...)
     
  4. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,288
    What do you actually plan to see when you're inside the mountain? That's usually a cave or something, which means a mesh and the problem of the terrain texture would resolve itself. You wouldn't work with that terrain anymore.
     
  5. xbertou

    xbertou

    Joined:
    May 3, 2021
    Posts:
    8
    I'd like to see the "reverse" of the terrain as black or something like that. Right now my current solution was to export the terrain to a low quality mesh, put it there back, reverse the normals and eventually give it a material (currently the default one). Far from optimal. But modifying the terrain shader to have the terrain render normally and show black when the angle to the normal is > 90 deg looked way too much for my level of understanding of things (assuming this is possible and a correct way of doing things).

    For the context, I have a real world map with a scale of 1/1000 and when I go "in" the moutain I want to see a 3D model of things that are inside the mountain (a tunnel and an underground laboratory). When I look "outside" I see the realistic map of the surrounding terrain, and when I "plunge" into the mountain I see the tunnel and the lab. Attaching 2 images to give an idea of the current solution (which isn't too bad, it's just than when you "enter" the mountain you briefly see that there are 2 meshes in there, the terrain and the mockup, if you look at the wrong angle). It is not supposed to be a "realistic" thing, entering in the mountain that way. The whole project plan is to do some science communication about underground science laboratories.

    Outside view:

    outside.jpg

    Inside view (currently default material for terrain, will probably put something maroonish in the future):

    inside.jpg
     

    Attached Files: