Planetside Software Forums

General => Terragen Discussion => Topic started by: N-drju on April 01, 2020, 07:24:28 AM

Title: Gentle curve on a road
Post by: N-drju on April 01, 2020, 07:24:28 AM
Guys,

Is there any realistic way to:


Have a straight stretch of road, say 400m, and then, have part of that road curve gently by, say 20 degrees to the left? Can it be done by bending a part of SSS?

I've been trying to use functions, but can't find a way to translate a meth expression into the 3d space.

I tried to use vortex shader, but it badly distorts the road dimensions.

Any ideas?
Title: Re: Gentle curve on a road
Post by: Dune on April 01, 2020, 07:55:20 AM
You can place a soft circular simple shape about next to that area to bend and warp X or Z by that (through vector displacement shader of course). Takes some location, and softness adjustments to get it right, but 'white warps', so to speak.
Title: Re: Gentle curve on a road
Post by: N-drju on April 01, 2020, 08:18:57 AM
I might be doing it wrong, but it doesn't really work too well... :-[

banding road.png
Title: Re: Gentle curve on a road
Post by: N-drju on April 01, 2020, 08:36:29 AM
This might be, in a way, achieved simply by subtracting the colours. But is rather hard to control, if a set width is to be maintained.

examp.png
Title: Re: Gentle curve on a road
Post by: Dune on April 01, 2020, 09:38:01 AM
It depends on what you really need, a bend and then bend back and continue straight, or bend and continue to go that direction, or bend around something and then continue on original line?

Try work with this, set blue node constant to either 1 or zero and see what each does. Can't be perfect though.
Title: Re: Gentle curve on a road
Post by: N-drju on April 01, 2020, 03:12:03 PM
What I'm after, is a road that, after about 500 m, bends by about 30 - 40 degrees to the left and then disappears out of the frame. The problem however (in both our solutions) lies in the fact that the more curvature is added, the more distorted the width dimension gets. And I'd like to keep the width of the road uniform thought the entire length. :(

This is why I considered adding an arctan or sine wave, but I just can't seem to get a graphical representation of it.
Title: Re: Gentle curve on a road
Post by: WAS on April 01, 2020, 03:28:41 PM
0 roughness PF noise, zero noise variation, zero noise tweaks, and use that as displacement (not it's PF displacement, through a disp func or vector disp). Best way to keep things as uniform as *possible* without just plotting a line.

Note: hour base fractal sizes should be large enough to encompass what you are trying to maintain proportion of.

A distance shade could be used to mask it in at a distance (the displacement) and find a seed that gives you a nice bend off camera.
Title: Re: Gentle curve on a road
Post by: cyphyr on April 01, 2020, 04:39:58 PM
Quote from: N-drju on April 01, 2020, 03:12:03 PMWhat I'm after, is a road that, after about 500 m, bends by about 30 - 40 degrees to the left and then disappears out of the frame. The problem however (in both our solutions) lies in the fact that the more curvature is added, the more distorted the width dimension gets. And I'd like to keep the width of the road uniform thought the entire length. :(

This is why I considered adding an arctan or sine wave, but I just can't seem to get a graphical representation of it.
I would just build this out of Simple Shape Sahders.
Maybe work it out on paper first ...
A shallow bend could be made from a black circle within (after) a white circle with two black squares masking out a "wedge" shape thus giving you a bend.

Road_Bend.JPG

Road_Bend.tgd
Title: Re: Gentle curve on a road
Post by: Dune on April 02, 2020, 02:17:28 AM
Nice solution. Another way would be to just draw it in PS.
Title: Re: Gentle curve on a road
Post by: WAS on April 02, 2020, 02:29:40 AM
Quote from: cyphyr on April 01, 2020, 04:39:58 PM
Quote from: N-drju on April 01, 2020, 03:12:03 PMWhat I'm after, is a road that, after about 500 m, bends by about 30 - 40 degrees to the left and then disappears out of the frame. The problem however (in both our solutions) lies in the fact that the more curvature is added, the more distorted the width dimension gets. And I'd like to keep the width of the road uniform thought the entire length. :(

This is why I considered adding an arctan or sine wave, but I just can't seem to get a graphical representation of it.
I would just build this out of Simple Shape Sahders.
Maybe work it out on paper first ...
A shallow bend could be made from a black circle within (after) a white circle with two black squares masking out a "wedge" shape thus giving you a bend.

Road_Bend.JPG

Road_Bend.tgd

Clever yet "simple".
Title: Re: Gentle curve on a road
Post by: N-drju on April 02, 2020, 03:30:27 AM
Ulco, Richard,

These were exactly the first two "least resistance" solutions that I had in my mind. SSS network or a PS drawing. I think I won't complicate it further then.


My only concern would be the resolution of the road mask image... The entire road with a curvy part would be about 1km long. In that case, I'll need to make a picture that is at least 2500px across... Or higher/lower? What do you guys think? That is, of course, if I decide to use Photoshop instead of an SSS network.
Title: Re: Gentle curve on a road
Post by: Dune on April 02, 2020, 04:18:19 AM
You could do that in 2 smaller masks too. Paint a vertical roadmap, repeat it in TG. Add another version, repeated, then rotated, and add a separate bend mask on top of those.
Takes some fiddling. But one complete mask can be done too, in greyscale (LZW tiff), when all is black and only road is white, even a big mask won't take up much MB's. I often make masks of 5000x5000px or so, even in RGB for three masks.
I am now working on a big piece of land with 2m wide ditches, kilometers long. My mask is 6000x6000px with white, slightly blurred (1,5) lines of 2px wide (line function in PS). In TG they are smoothly interpolated anyway, so with a color adjust or bias function you can adjust widths pretty good, and the ditches are straight, and neat as can be.
Or just make the corner, and add simple shapes to that. Lots of ways.
Title: Re: Gentle curve on a road
Post by: N-drju on April 02, 2020, 04:39:10 AM
I think I'll stick to Richard's advice. I am playing with it right now and it's really fun, even despite having to control six SSS. I always prefer to just use TG tools. ;)
Title: Re: Gentle curve on a road
Post by: Kadri on April 02, 2020, 05:18:30 AM
I used more then one 20 000x 20 000 image masks in some old projects if i remember right.
Depends on your project and RAM size but it is mostly not a problem as it looks.
Especially when you use greyscale-256 colour masks etc.
Title: Re: Gentle curve on a road
Post by: Dune on April 02, 2020, 05:29:10 AM
An admirable purist! ;D
Title: Re: Gentle curve on a road
Post by: sboerner on April 02, 2020, 11:31:41 AM
All great solutions. Still hankering for a SVG import shader, though, which would work here as well.
Title: Re: Gentle curve on a road
Post by: WAS on April 04, 2020, 02:43:27 AM
Quote from: sboerner on April 02, 2020, 11:31:41 AMAll great solutions. Still hankering for a SVG import shader, though, which would work here as well.
That would be really handy. Maybe a mode to the SSS shader. Load a SVG.
Title: Re: Gentle curve on a road
Post by: cyphyr on April 04, 2020, 11:30:41 AM
Yes an SVG import shader would be great.