How do I use an image shader to create a river in Terragen 3?

Started by Terraben, November 21, 2014, 02:59:19 AM

Previous topic - Next topic

Terraben

Hi,

Fairly new to using Terragen so this may sound silly.

I have read about using an image shader to create a river from a jpg on Terragen 2 here:

http://www.planetside.co.uk/forums/index.php?topic=8659.0

Can anyone give me any hints as to how to get this to work with TG3? I have loaded a heightfield from a file and want to place the river on top of my heightfield.

Thanks!!

Dune

Welcome to this forum, Terraben. First of all, it's best to not use a jpg as the compression artifacts might be visible; better to use a greyscale TIF (whether or not LZW compressed). If you have a heightfield you need to draw the river exactly where it's supposed to be, maybe from a topdown render that you use in Photoshop as base layer, then paint the river in a second layer in white-grey on black.
Import this TIF into TG in an image map shader and set its size and place so it falls exactly over the heightfield; then use that as a mask for coloring the river.

Will this do for a start?

Terraben

Thanks very much for that Dune! It makes sense now that I think about it  :P!

I ended up just using a 'Painted Shader' instead as I dont have access to photoshop or any decent image processing software at the moment.

To create the river I simply added a displacement shader to the painted shader and gave it negative displacement then just filled it with a lake object  ;D

Thanks again for your help though, I really appreciate it!  :)

Cheers

Terraben

On a side note, does anyone know if you can tilt lakes?

The river I want to make is on a downhill slope and the water just wants to display on a horizontal plane.

Other than just using lots of smaller lakes, does anyone know what I could do?

Thanks!

Dune

That is harder, but in principle you can lead the output from the terrain (before displacing the river down) to a new surface shader, which acts as the surface for your lake (set at 0 altitude). Then uncheck the color and add the water shader as a child to that surface shader.

archonforest

Quote from: Terraben on November 21, 2014, 05:13:27 AM
To create the river I simply added a displacement shader to the painted shader and gave it negative displacement then just filled it with a lake object  ;D
Quote
How did u do that? Sounds like an interesting way but after messing around with a painted shader for a while I could not make it work... ???
Dell T5500 with Dual Hexa Xeon CPU 3Ghz, 32Gb ram, GTX 1080
Amiga 1200 8Mb ram, 8Gb ssd

Upon Infinity

Quote from: Terraben on November 21, 2014, 06:09:10 AM
On a side note, does anyone know if you can tilt lakes?

The river I want to make is on a downhill slope and the water just wants to display on a horizontal plane.

Other than just using lots of smaller lakes, does anyone know what I could do?

Thanks!

What I do is use the painted shader for where you want your river to be.  And then add a water shader to your landscape shaders and mask it by painted shader.

Terraben

Quote from: archonforest on November 21, 2014, 03:07:28 PM
How did u do that? Sounds like an interesting way but after messing around with a painted shader for a while I could not make it work... ???

What I did was used the painted shader to 'paint' the river's path onto the surface then input it into displacement shader and gave it a negative displacement. The displacement shader is inserted right before the compute terrain node (SEE PICTURE). Only problem is that because the function applies to single micro-triangles as opposed to a perfect circle (as the brush appears) you end up with little peaks in your river because the brush didn't mark those exact micro-triangles for displacement.

And thanks Upon Infinity and Dune, I will give both those methods a try and see how they go!

Dune

It will be easier to start out with a less rugged terrain, then add the river area (either by painted shader or image map), mask a river by that (a real one on a plane/lake, or just say a reflective shader in the line to the planet), then use the inverse of the mask to add smaller more rugged terrain features (which will then obviously be outside your river only). If you offset the displacement a bit, you won't even need a downward river displacement shader.

In the case of a water shader on a plane/lake, you'd have to mask out the water, or you end up with water all over AND huge render times. Simply lead the water mask to the opacity input of a default shader, set its color to black and lead the default shader's output to the input of a surface shader carrying your water shader. The terrain goes into the input of the default shader.

Terraben

Quote from: Dune on November 22, 2014, 03:48:25 AM
In the case of a water shader on a plane/lake, you'd have to mask out the water, or you end up with water all over AND huge render times. Simply lead the water mask to the opacity input of a default shader, set its color to black and lead the default shader's output to the input of a surface shader carrying your water shader. The terrain goes into the input of the default shader.

I've attached an the current layout I have in the Terrain area of the node network with the Default Shader setup you mentioned above. Where abouts should I insert the water shader?

Dune

This will only be needed if you have your water on a lake or plane and if you use the whole terrain as displacement for that lake/plane as well, not if you color the water in the main line of nodes. If the latter it's a matter of masking the river surface shader by your painted shader only. No default shader. Just add a surface shader at the end of the line, just before planet, and mask that by the painted shader. add your colors and reflection there, into the inputs of that surface shader.

PabloMack

Quote from: Terraben on November 21, 2014, 02:59:19 AMFairly new to using Terragen so this may sound silly.

It's not a silly question at all. My concern is that a two-dimensional image is not an ideal general solution for making rivers. When your view (i.e. renders) of the river will be from a limited range of view points then a high-res image view from the ground or a low-res image view from space might suffice. But if you plan to do a flyover, especially a view from space flying down to the ground or vice versa, a 2-dimensional image mask is ill-suited for the job. Many rivers are long and thin and are basically more one-dimensional than two-dimensional. But they still have depth and their direction can meander. Using an image for a long river could waste vast amounts of image area and only use the small fraction of the image where the river exists.

I saw in some terrain-generation package (I can't remember which one) that used splines to define rivers and other terrain features. It would be great if a spline could be used to outline the shores of a river (an inner spline) and use an "outer spline" to define the far edges of a valley. The two splines would define a gradient where the altitude displacement is zero at the outer spline and the points of the inner spline are associated with weighted values. The gradient between the two splines might form a slope that could be subtracted from the terrain to form the river valley. Each spline could even be a loop with closed ends. One end of the loop would start at the head waters of the rivers (and even include all tributaries) and the other end would end at the river delta where the water dumps into the ocean. In the case of a land-locked river system such as the Okavango, the splines could even define (or at least influence) where the land-locked delta would end up. Using a data structure such as this, one could define a very extensive river system with comparatively very little data as compared to a 2D image.


Rivers are so important in the creation of virtual planets that I would think that a capability like this would be a major addition to a package like Terragen. If TG can already do something like this, then someone please pipe in.

The Okavango. What a cool place:
http://images.huffingtonpost.com/2012-10-15-ueol_01_img0036.jpg
http://images.huffingtonpost.com/2012-10-15-OkavangoDeltaPic1.jpg
http://images.nationalgeographic.com/wpf/media-content/photos/000/832/cache/83293_990x742-cb1409845722.jpg

archonforest

Thx Terraben for the clarification. Something new and useful for me ;)
Dell T5500 with Dual Hexa Xeon CPU 3Ghz, 32Gb ram, GTX 1080
Amiga 1200 8Mb ram, 8Gb ssd

briareos_kerensky

Quote from: PabloMack on November 22, 2014, 10:11:06 AM
I saw in some terrain-generation package (I can't remember which one) that used splines to define rivers and other terrain features.

World Machine can.
Uhm, thread revival! Glad I searched around the forums before asking how to create lakes and rivers with the painted shader.