PDA

View Full Version : Height / Displacement bake?



ilikepixel
10-24-2016, 07:01 AM
hello y'all!
i need to bake a few displacement maps. is there a way to do that in Lightwave?
something like the normal cast node?

i don't need anything fancy. no 32 bit informations.
jut a black and white heightmap of a hi-poly organic model baked onto a low-poly version.
... for use as a bump/height map. ie. just for shading ... not for displacement.

many thanks in advance :)

squarewulf
10-24-2016, 10:28 AM
In layout go to File>Save>Save Trans Object

This will save out your object as it is seen in layout.

ilikepixel
10-24-2016, 11:04 AM
thank you! but, that's not what i mean.
i have a hi-poly model. i desire to bake its difference in detail as a black and white texture into a low poly version.
ie. areas poking out would be white and details bumping in should be black.
it should look like an displacement map. but without the extra informations.
a DOF cast node ... if you will.

Ztreem
10-24-2016, 02:12 PM
Yes its possible. Use a raycast or raytrace node and drag the distance to color.

Sensei
10-24-2016, 04:15 PM
Imagine you have low-poly model of mesh.
Each spot on low-poly polygon is using ray-trace/ray-cast node,
to learn how deep is true high-poly mesh.
RayCast>Ray origin = Info>World Spot, RayCast>Ray Direction = Info>Ray Direction
Low-poly mesh has to be transparent to ray-cast (toggle Object Properties > Render > Unseen by rays),
high-poly mesh has to be transparent to camera (Unseen by camera).
And storing value from ray-cast (distance between low-poly spot, to high-poly, except -1.0 which means ray-cast shut to environment).

ilikepixel
10-24-2016, 06:34 PM
heyyy, thank You guys, very much! this seems to go in the right direction.
however, i'm too naive with nodes to make it work properly.
node flow and result shown in the screenshots.
it seems to sample only in the outward direction? intersecting areas are rendered black.

134911
134912

Sensei
10-24-2016, 06:40 PM
The first of all,
you can't connect it to Color, but to Diffuse Shading.
Color is affected by shading.
Diffuse Shading is param to merge it with other .. Shadings to make Material.
So you can use Make Material and feed it by your Gradient output and then plug to Material.

Secondly you might need to slightly move away from surface.
If you have Ray Origin and Ray Direction,
origin += direction * length (when length > 0 ) it's going in one direction,
but if
origin += direction * length (when length < 0 ) it's going in second direction.

In the case of low-poly mesh, which is nearly equal to high-poly mesh, distance to move away from surface is very very short needed.

erikals
10-24-2016, 06:48 PM
you can do somethin' like this...


https://www.youtube.com/watch?v=O7fINI4DpeI

jeric_synergy
10-24-2016, 06:59 PM
Right, erikals, it seemed that a Normal Map was actually what the OP wanted rather than a displacement map.

(Although I don't know the finder differences between the two, my impression is that normal maps are more for detailed work than displacement maps.)

Sensei
10-24-2016, 07:05 PM
Right, erikals, it seemed that a Normal Map was actually what the OP wanted rather than a displacement map.

(Although I don't know the finder differences between the two, my impression is that normal maps are more for detailed work than displacement maps.)

Normal map is 3D,
displacement map is 1D.
World Spot += Normal Vector (calculated) * Length (from Displacement map).

ilikepixel
10-24-2016, 08:41 PM
thank you all very much for pitching in. :)

feeding into diffuse shading gives me the same result as in color.
i think it's because i render with 0% diffuse 100% luminance?
134913

i think Erik is right to use the normal cast.
however, playing with the curve i do not get an as ... rich? result as i get from the ray cast.
it looks rather dull.
134914

i think i would prefer the use the ray cast, if it would work properly.

for context: i intend to use it for height maps in Unity.
https://docs.unity3d.com/Manual/StandardShaderMaterialParameterHeightMap.html

Sensei
10-24-2016, 08:53 PM
Also remember about color space..
It could influence your results..
While baking such stuff, you cannot have gamma color correction..

prometheus
10-25-2016, 10:18 AM
Right, erikals, it seemed that a Normal Map was actually what the OP wanted rather than a displacement map.

(Although I don't know the finder differences between the two, my impression is that normal maps are more for detailed work than displacement maps.)

A normal map is more of illusionary 3d with baked height/3d info info..which will look very good straight on viewed, but for a profile with contours, not good, normal maps needs no extra geometry divisions, while a displacement map is totally dependent on geometry, to reach fine detail however..you would need insane amount of polys, that is why you often combined a mid-high level displacement with a normal map.
Displacement on normals is s different thing...just concerns in what directon the displacement is going.

ilikepixel
10-29-2016, 05:07 PM
apologies about the confusion. i shouldn't have said displacement. nothing is being displaced.
this is about height maps /parallax normal maps.

i am too unfamiliar with notes to get it to work properly.

the normal cast gives me a too plain result.

the ray cast has nice and crispy depth but can't deal with the intersections.
i tried to turn play with unseen/seen by double sided ect. but i can't get rid of the black islands.
what am i doing wrong?

134942
134943

Sensei
10-29-2016, 05:12 PM
You should move away (or forward) slightly from/to World Spot in direction +/-Ray Direction let's say 1mm, or 0.1mm for a start.
You should see these black areas are disappearing, while using higher offset value.

World Spot2= World Spot +/- Ray Direction * offset

Or yours low-poly mesh is simply too close to high-poly mesh?
Absolutely it cannot intersect with high-poly...
Remember World Spot is taken from low-poly mesh,
and then ray is fired in direction equal to Camera Ray (Ray Direction),
it has to fly a bit and give you distance, between them.
If high-poly mesh intersects with low-poly, ray hits completely different side of mesh than you need.. it's like trying to fire ray while being inside of sphere..

Output from Ray Cast (Distance) (as long as it's not -1) + Ray Length (from camera to low-poly mesh), is total distance from Camera to high-poly mesh.

Surrealist.
10-29-2016, 08:47 PM
Use the right tool for the job is best I think, if it were me.

Just save trans as described. Take your High and Low poly mesh into any external program that does this and bake away. Xnromal is free. Blender will bake this map as well. Mudbox, Zbrush. Probably others. Best to use a program that is set up for baking and gives you the best results. Then simply bring the maps back into LW.

But do adhere to the advice to not intersect the mesh. That may solve it right there.

And again. I would just bake it externally myself.