Author Topic: Flatten Terrain for Given Radious Under Camera  (Read 454 times)

Offline OldFlak

  • Member
  • *
  • Posts: 35
Flatten Terrain for Given Radious Under Camera
« on: December 12, 2018, 11:40:33 AM »
Hi all :)

So I use TG for creating skyboxes for game engines. Most of the time the terrain can be just flat or not even there at all.

The skybox that I am working on at the moment requires hills\mountains in the distance which of course is easily done, but I would like to flatten the terrain for a given radius under the camera basically so that the terrain on the bottom tile of the skybox is flat and then the hills\mountains start from outside that radius.

Hope that makes sense.

Can anyone give me some clue as to how to achieve this, or point me to a post that may touch on it.

Thanks for any input :)

OldFlak....
Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.

Offline Dune

  • Member
  • *
  • Posts: 15127
    • www.ulco-art.nl
Re: Flatten Terrain for Given Radious Under Camera
« Reply #1 on: December 12, 2018, 11:49:00 AM »
Use a distance shader, with the render camera attached and set your distances. Use as mask for the hills.

Offline Hannes

  • Member
  • *
  • Posts: 4461
Re: Flatten Terrain for Given Radious Under Camera
« Reply #2 on: December 12, 2018, 12:27:37 PM »
I guess the default scene has already what you're after.

Offline Oshyan

  • Planetside Staff
  • *
  • Posts: 13097
  • Holy snagging ducks!
Re: Flatten Terrain for Given Radious Under Camera
« Reply #3 on: December 12, 2018, 08:51:35 PM »
Yes, this is exactly how the default scene is setup. And there's an explanation of it here: http://planetside.co.uk/wiki/index.php?title=The_Default_Scene_Explained#Terrain

The basic concept is to use a mask for your terrain(s), either a Simple Shape Shader, or Dune's suggestion of a Distance Shader could also work (though is directly tied to a camera so may be a bit more difficult to work with easily).

Depending on how many displacement nodes you have in your Terrain network, you may want to use an alternative instead of masking every single one. Something like a Merge Shader with the Simple Shape Shader as mix controller and a constant color as Input A.

- Oshyan

Offline OldFlak

  • Member
  • *
  • Posts: 35
Re: Flatten Terrain for Given Radious Under Camera
« Reply #4 on: December 12, 2018, 09:30:52 PM »
Thanks for the feedback everyone.

Yes the default scene is where I am starting from, but the flattened part needs to extend farther out. Basically I would like the hills\mountains to start where the haze does or a little farther. (works better for my purposes in game engine)

And also at some stage (for other skyboxes) I will want more dramatic mountains so I am guessing if I change the height for distant mountains the terrain under the camera will also change from being flat.

Since I am working with 6 cameras to capture the environment, I figured some way of altering the terrain itself may be easier. Like, tell the terrain shader somehow where the camera is and flatten out for given distance under the camera - but hey total newbie to all this :)

But will now digest all the suggestions here and see what I can get working.

OldFlak....

Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.

Offline OldFlak

  • Member
  • *
  • Posts: 35
Re: Flatten Terrain for Given Radious Under Camera
« Reply #5 on: December 12, 2018, 10:04:39 PM »
Thanks for the link Oshyan - very helpful :)

OldFlak....
Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.

Offline Oshyan

  • Planetside Staff
  • *
  • Posts: 13097
  • Holy snagging ducks!
Re: Flatten Terrain for Given Radious Under Camera
« Reply #6 on: December 13, 2018, 12:21:04 AM »
In that case you can just increase the size of the Simple Shape Shader (in the default scene) to extend it out. A Distance Shader might not be a bad idea instead, as Dune earlier suggested.

- Oshyan

Offline Rich2

  • Member
  • *
  • Posts: 419
  • Forgive me - I'm an idiot.
Re: Flatten Terrain for Given Radious Under Camera
« Reply #7 on: December 14, 2018, 03:17:36 PM »
I may not be providing the answer you are looking for, but Hetzen has created what I find to be an extremely useful clip:
https://planetside.co.uk/forums/index.php/topic,13311.msg131303.html#msg131303

Rather than completely flattening a terrain at one location as the Simple Shape (SS) does, it globally widens the spaces between elevations and leaves subtle low level variations that appear more "natural".   I've put it into my Default Scene in place of the SS.  Now I have no idea if it can be connected to a camera to project at a specific location, but it may be worth trying.
Did I mention that I'm an idiot?

 

anything