### Author Topic: Displacement to Vector Question  (Read 688 times)

#### treddie

• Member
• Posts: 156
##### Displacement to Vector Question
« on: September 20, 2017, 04:45:04 PM »
Hi again.

I have a question about the Displacement Shader to Vector node.  In the attached image, you see some terrain, and a preview from the attached DStoV node.
Now, as I understand it, this node takes the displacement info from the terrain and turns it into a simple vector quantity at each point in the preview.  If so, I would expect a multicolor preview, not a 2-color preview.  In other words, a preview that resembles a normal-map, where vector direction and intensity are depicted as a specific pixel color at each pixel.

I am confused as to exactly what I am seeing.  What does the green and black represent?  It seems the preview is showing where the mountains (raised area) meet the floor at roughly -80m, and everything that is green is above that -80m floor altitude.

Whaaaaat?

#### Tangled-Universe

• Terrevangelist
• Posts: 6089
##### Re: Displacement to Vector Question
« Reply #1 on: September 20, 2017, 06:18:12 PM »
The preview is basically a camera looking down along the Y-axis, which is the green vector in TG.
So my immediate thoughts are that you are simply looking at the upfacing vectors.
Added to that, by the looks of your preview, you are displacing the surface only upwards, thus a vector generated from this situation would only give a green colour anyway.

#### treddie

• Member
• Posts: 156
##### Re: Displacement to Vector Question
« Reply #2 on: September 20, 2017, 06:53:04 PM »
But not all vectors are pointing directly upwards...Even the tops of the mountains are pointing in varying directions that are only roughly pointing straight upwards.  If instead, I use the Displacement Shader to Scalar function, then the green is replaced with white.

#### Tangled-Universe

• Terrevangelist
• Posts: 6089
##### Re: Displacement to Vector Question
« Reply #3 on: September 20, 2017, 07:42:04 PM »
But not all vectors are pointing directly upwards...Even the tops of the mountains are pointing in varying directions that are only roughly pointing straight upwards.  If instead, I use the Displacement Shader to Scalar function, then the green is replaced with white.

I can't see all your nodes, but I think it's an illusion. What I see on the preview is that all surfaces are upwards displaced surfaces from the base planet. Without a compute terrain/normal node and a displacing shader following it you can not create lateral features, unless you use a redirect shader before the compute terrain/normal. That's pretty much the rule of thumb and is not what I'm seeing here.

Displacement shader to scalar converts the vector of each point to a single scalar value, thus it loses its colour information, simply because it's not a vector anymore, "just" a value.

#### treddie

• Member
• Posts: 156
##### Re: Displacement to Vector Question
« Reply #4 on: September 20, 2017, 08:32:05 PM »
I am assuming my choice of "Along normal" should work.

But now that I read your post more carefully, It seems that you can't ADD lateral features without the displacement shader after the compute normal.  Which makes sense because the green is pointing normal to the planet surface, which is a big sphere, which at the given camera distance might as well be all straight up, because the area visible in the scene is so small relative to the planet diameter?
« Last Edit: September 20, 2017, 08:38:45 PM by treddie »

#### digitalguru

• Member
• Posts: 278
##### Re: Displacement to Vector Question
« Reply #5 on: September 20, 2017, 08:55:18 PM »
You're looking at those displacement values through the wrong node.

You can sample the terrain as vector displacement but it needs to get the value of the displacement against an undisplaced point, that point being a Terragen planet which has no displacement.

So you would pipe the terrain at any point the graph into a displacemet to vector shader then into the luminosity function of default shader (with diffuse and spec turned down) we just want the pure color, then plug this into the surface shader of a duplicate of the Planet node. Then just render the duplicate planet. The reason for using a planet is that it will then account for the curvature of the planet.

I made a tutorial that goes through all the steps a while ago:

and an example file:
https://www.dropbox.com/s/abl0ypy311q7ner/terragen_vector_tutorial_end.tgd?dl=0

render the Render Bake Vector node.

EDIT; Just seen your latest post - you can use any type of displacement - lateral works just as well.

With the displacement to vector node you can plug this in anywhere, before or after the compute terrain.

« Last Edit: September 20, 2017, 09:01:03 PM by digitalguru »

#### treddie

• Member
• Posts: 156
##### Re: Displacement to Vector Question
« Reply #6 on: September 23, 2017, 10:31:26 PM »
digitalguru >  Am absorbing your info.  Been very busy, so getting my mind all the way around it is taking longer than I would like.

#### digitalguru

• Member
• Posts: 278
##### Re: Displacement to Vector Question
« Reply #7 on: September 23, 2017, 11:34:57 PM »
no worries, hope it helps