### Author Topic: My Procedural Road, *Final* pg. 8  (Read 38980 times)

#### FrankB

• Member
• Posts: 3603
##### Re: My Procedural Road, Part II
« Reply #30 on: March 09, 2011, 03:35:16 PM »
Look at this... how is this possible? I'm just warping into one direction soooo... no clue where this circle is coming from. Crazy stuff...

#### Hetzen

• Member
• Posts: 1655
##### Re: My Procedural Road, Part II
« Reply #31 on: March 09, 2011, 03:40:32 PM »
These are looking very convincing Frank. There's a lot of power in them blues. I'm glad you're getting your feet wet.

Those circles I'd imagine are coming from your warp PF. If you push it too far within a set scale, you get those sorts of artifacts. The answer would be to use 2 scales of PF each with a set max displacement. ie One large scale for large displacements, one for minor variation.

I wonder if we could push the guys to give us a way of blurring/smoothing displacements/colours with nodes outside of heightfields? So that you could level off your road a bit more.

Jon
« Last Edit: March 09, 2011, 03:42:39 PM by Hetzen »

#### FrankB

• Member
• Posts: 3603
##### Re: My Procedural Road, Part II
« Reply #32 on: March 09, 2011, 04:02:25 PM »
These are looking very convincing Frank. There's a lot of power in them blues. I'm glad you're getting your feet wet.

Those circles I'd imagine are coming from your warp PF. If you push it too far within a set scale, you get those sorts of artifacts. The answer would be to use 2 scales of PF each with a set max displacement. ie One large scale for large displacements, one for minor variation.

I wonder if we could push the guys to give us a way of blurring/smoothing displacements/colours with nodes outside of heightfields? So that you could level off your road a bit more.

Jon

Hey Jon,

I'm using the blue nodes since years, I agree they can be very powerful additions to the normal shaders. I wish I could define a user interface for a network of blue nodes, so that I could effectively write new shaders.
I'm actually not using a PF for warping in the last render, but a blue perlin function fed into a displacement shader. I didn't have these artifacts with the previously used PFs... Anyway, I believe your explanation must be right.

Lastly, what do you mean by smoothing displacement ouside of a heightfield? I usually use a smooth step scalar to do this. Or did you mean something else?

Cheers,
Frank

#### Hetzen

• Member
• Posts: 1655
##### Re: My Procedural Road, Part II
« Reply #33 on: March 09, 2011, 04:14:12 PM »
Sorry Frank, you've previously given the impression that you didn't like getting into math, hence my comment. My bad. I've got to say I really like the modulo function, it gives you all sorts of possibilities.

Those circular artifacts tend to occur when you displace/warp something outside it's scale range. eg a perlin set at say 100m scale and you multiply that output by something a lot larger than it's scale, like 200m.

As for 'smoothing'. What I meant by that, was some way of looking at a defined area (say x +/- 10m by z +/- 10m) and finding out an average value of y, then smooth step between these values of y to give you a flat road surface. You could use this for rivers down slopes, etc. The only way I've seen this done, and it's not a perfect solution by any means, is by smoothing a heightfield masked by the limits of your road/river.

Cheers

Jon

#### FrankB

• Member
• Posts: 3603
##### Re: My Procedural Road, Part II
« Reply #34 on: March 09, 2011, 04:31:18 PM »
Ah, I see now what you mean with the smoothing. Yes, that would be ideal. It could probably be approximated with functions already, by probing the y value at say 9 defined points in the neighborhood of the current position and calculate an avg from that.... haven't tried this, though, but it sounds possible.

As for the math-denyer - you must be confusing me with someone else
I like getting into math, it's just that I'm not particularly good at it anymore. I did a lot of higher math during my studies, but never used it ever after, so I had to re-learn e.g. vectors

Cheers,
Frank

#### FrankB

• Member
• Posts: 3603
##### Re: My Procedural Road, Part II
« Reply #35 on: March 09, 2011, 04:42:41 PM »
For anyone still following this thread: If you have no idea where to start making your own roads, see the attached tgd.

It's a simple winding procedural road, but no frills. Based on the network in there, you can start making your own, infinite, procedural, good looking road. It's really easy to also generate masks for the paint based on the mask for the road.
This one isn't pretty, but it gives you the basic setup to extend to your liking.

Regards,
Frank

#### choronr

• Member
• Posts: 4582
##### Re: My Procedural Road, Part II
« Reply #36 on: March 09, 2011, 04:48:25 PM »
I've been following this thread with great enthusiasm. Thank you for all your input as well as the others contributing here. Between you, Dune and dandelO, you guys have opened some new doors to creativity ...thanks again, all of you.

#### dandelO

• Member
• Posts: 2401
##### Re: My Procedural Road, Part II
« Reply #37 on: March 09, 2011, 05:05:40 PM »
I've been mucking around with this thing myself. I'd rather not download your file just yet, Frank, until I feel I've exhausted all my own brain-power(such as it is).

But the thing I write here for is a very simple basic problem I'm facing, be it through functions or fractals. Simply, is there a way to 'tame' the scale of a noise to exactly the scale you input? By this I mean, the warping of a line function does not let me keep the scale of the 'road' width consistent. It will widen/thin the basic road line-mask according to how the fractal or Perlin lies at any particular point along its length.

Maybe I'm not being clear enough, it doesn't sound right reading it back. Is there another method to generate a noise that I can use as a warper, generally, other than an inconsistent perlin/fractal, so it bends the road consistently but still maintains the correct width?
See this deviation in width in the screen-shot below...

Cheers.

#### FrankB

• Member
• Posts: 3603
##### Re: My Procedural Road, Part II
« Reply #38 on: March 09, 2011, 05:29:41 PM »
I know what you mean, Martin. AFAIK there is nothing you can do about it if your technique is based on warping a stripe of white color.
It's really only bad when your displacements are very strong, otherwise, on real roads, often they are wider in the curves than on the straight parts. The effect must not get too strong though.

Maybe your road won't get distorted when you apply the defomation on the scalar or vector level. For example, if you run your function that generates scalars through a sine, then your line will be deformed like a snake but not become wider or narrower in some parts. I guess. Haven't tried. I can live with the effect if it's not too strong

Frank
« Last Edit: March 09, 2011, 05:51:50 PM by FrankB »

#### dandelO

• Member
• Posts: 2401
##### Re: My Procedural Road, Part II
« Reply #39 on: March 09, 2011, 05:38:39 PM »
I'm guessing that the only way round it at the moment is to not have too severe a displacement in the warping.
Large scales, creating sweeping curves are much better handled than tight ones and because they generally are much wider than the road, there's minimal distortion.
I like the 'roundabout' effect you showed above when you apply more warp than the scale describes but, unfortunately, that's when the distortion of the road width becomes really apparent.
And, I haven't even started on altitude deviation yet...

#### Hetzen

• Member
• Posts: 1655
##### Re: My Procedural Road, Part II
« Reply #40 on: March 09, 2011, 06:02:19 PM »
If your road is traveling along the x axis, you can tame that width variation Martin by, adding a 'multiply vector' after the 'get position' by a 'constant vector' of (1,0,0) before you plug it into the perlin function. This will effectively give you the same variation all the way along y and z for every x.
« Last Edit: March 09, 2011, 06:04:36 PM by Hetzen »

#### Volker Harun

• Member
• Posts: 1490
• Let there be Rock!
##### Re: My Procedural Road, Part II
« Reply #41 on: March 09, 2011, 06:03:05 PM »
Hello Martin,

look at the attached previews.
I'd expect the two warpers to show a parallel result but it is not possible - at least not with this setup

Hi Jon:
your multiply vector does not work here ... as there is no noise at all after multiplying it with 1,0,0
« Last Edit: March 09, 2011, 06:06:06 PM by Volker Harun »

#### PorcupineFloyd

• Member
• Posts: 394
##### Re: My Procedural Road, Part II
« Reply #42 on: March 09, 2011, 06:07:08 PM »
Ducking great!

Frank, have you thought about releasing a series of tutorial videos on NWDA? I'm thinking about e-learning like lynda.com or totaltraining.com. I'd be happy to pay for quality tutorials about functions and procedurals in depth.

#### Hetzen

• Member
• Posts: 1655
##### Re: My Procedural Road, Part II
« Reply #43 on: March 09, 2011, 06:09:36 PM »
The problem Volker, is that the Perlin has a different value at your offset point to its standard point. You need to flatten your 'get' input into one dimension to give the same output along a given axis. Easiest way is to nullify all other axis by the method I posted above.

Jon

#### Hetzen

• Member
• Posts: 1655
##### Re: My Procedural Road, Part II
« Reply #44 on: March 09, 2011, 06:13:37 PM »
Hi Jon:
your multiply vector does not work here ... as there is no noise at all after multiplying it with 1,0,0

In this case, your road follows the z axis so multiply your perlin by (0,0,1). Try that. Should work.

anything