PDA

View Full Version : Surface Thickness Calculation



Infinite
01-12-2015, 07:30 AM
Loooooooooong time no post. I still use Lightwave on a daily basis, I've been addicted since 1995!!

I was wondering if anyone knows how to calculate a models surface thickness and render that out using Surface Baking Camera? I use Lightwave to render out various maps for real-time visulaization and would like to stick in Lightwave for this technique.

Both Knald and XNormal can render out Thickness maps (or Transmission Maps) but the results are a little sketchy. I'm sure a more advanced calculation could be run from Lightwave to produce a grey scale map. Used to calculate the thickest and thinnest parts of human skin, on a scan.

Sensei
01-12-2015, 07:36 AM
If you send ray in the same direction as incoming ray, to inside of object, it will return distance ray must travel.

RebelHill
01-12-2015, 08:09 AM
Thickness will depend on the angle of view... Imagine the thickness of a finger, looking down on it, not very thick... but now imagine a character in Tpose, looking at the middle finger tip-on... The thickness runs right down the length of the finger, down the arm, through the body, and down the next arm to the tip of the opposing finger.

Generally... to try and get a meaningful thickness... you'd want to be looking along the poly normal of each polygon... but this can give you something with weird, or sudden changes.

The thickness gradient method gives you generally smooth results... but the values at each point on the mesh change as your angle of view changes.

The raycast method is less clean, but gives you a fixed result no matter the angle of view.

Sensei
01-12-2015, 08:21 AM
Plug it to Diffuse Shading, not to Color....
What goes to Color is later processed by Lambert shading, unless you didn't set Luminosity 100%, Diffuse 0%, so plugging to right input since beginning is easier..

RebelHill
01-12-2015, 08:24 AM
yes... lum 100 diff 0

Infinite
01-12-2015, 08:53 AM
Thanks for the replies and suggestions.

RebelHill
01-12-2015, 09:03 AM
What exactly do you mean by internal surface thickness though??

If you mean the thickness of the skin itself... well there's no way to tell that from geo. All you can get is the internal thickness of the geometry itself which, if you think about it, MUST be view dependent. Why... again, think about what you're seeing from different views... Take the very top of the scalp... view the head from the front, and it's pretty thin (the distance from the "front" poly to the first one behind it is small)... but view the character top down (birds eye), then once you "go through" the top of the head, you look right through the torso, to the crotch before you "see" another polygon.

The only thing different about this in the ray cast example, is the fact that the direction of view of each polygon is along the polys normal... thus rotating around the model doesnt change the value at that polygon.

Thickness MUST be view (or rather axis) dependent otherwise the term has no meaning.

Sensei
01-12-2015, 09:07 AM
It shouldn't be view dependant at all.

To be honest you don't understand what is thickness in that case..


For example we know the fingers are thinner than the legs, or the nostrils or ears are thinner than larger bulkier areas of the human body.

When you will have tube/sphere, you can pass through center of circle, and it'll have thickness=diameter.
But when analyzing thickness from different angles, it will have smaller thickness.

http://forums.newtek.com/attachment.php?attachmentid=126537&d=1421078450

The smaller thickness, the smaller value, and more toward black color.



The hack method in ZBrush is useful but not very accurate. Similar to this method http://www.gamedev.net/topic/653094-...thickness-map/


What's on top of this thread, is not thickness.

RebelHill
01-12-2015, 09:12 AM
http://forums.newtek.com/attachment.php?attachmentid=126537&d=1421078450

Thats a much better explanation.

Infinite
01-12-2015, 10:13 AM
Thanks for the help. I guess what I require is technically impossible and more of a hack. I will continue to use the ZBrush and hand painted method.

To clarify to others who might stumble upon this thread, this is the best method for what I was trying to achieve http://www.gamedev.net/topic/653094-baking-a-local-thickness-map/

RebelHill
01-12-2015, 10:25 AM
You can do that method in LW too... you'll need to use the DP occlusion node, and pipe an inverted normal set to its normal input.

Sensei
01-12-2015, 11:13 AM
Rebel, try something like this on your character:

http://forums.newtek.com/attachment.php?attachmentid=126538&d=1421086327

We will see how it looks like..

RebelHill
01-12-2015, 12:34 PM
Its basically the same as the raycast version I already posted... only difference is using the gradient to remap the values.

Sensei
01-12-2015, 12:48 PM
Its basically the same as the raycast version I already posted... only difference is using the gradient to remap the values.

Nope.
You said "using polygon normal" in #3 post. In post #2 I was talking about using Spot Info > Ray Direction (indeed view dependent).
But this version is not using polygon normal (which is Geometric Normal in Spot Info), but perturbed smoothed and then reversed spot normal.
With this setup you can spin viewport any way you wish and have same result...

RebelHill
01-12-2015, 01:35 PM
Yeah... I think you've misunderstood... I spoke in terms of poly normal to simplify the explanation... If you look at the network I used, it does indeed use the spot normal, and you can also spin the viewport any way you like and get the same result... as I pointed out initially. Your network is the same as mine, only with a gradient plugged inbetween.

MSherak
01-13-2015, 02:36 AM
Pretty simple. Study the scene to learn how to create thickness maps for a model in LW. The basics are to use the whole model inverted and bake the nodal AO into a map. Which is then place back on the original model to use as a thickness map. I just grabbed a free statue model and UV'ed it since it was a .3ds with bad uv's. Areas to be careful with is overlapping geometry. Along with the distance for the AO and baking to take place to get the best results. Load the scene and turn on VPR to see the inverted model. This example uses Dkit's Ambient Occlusion node. http://dpont.pagesperso-orange.fr/plugins/nodes/Additionnal_Nodes_2.html To get the right values play with the falloff distance and modes.


Enjoy,
-M

Infinite
01-13-2015, 05:47 AM
@Sensei: Very useful thanks. I will try that, great screen shot

@MSherak: That scene is incredibly useful!! Testing now.

@RebelHill: Thanks for your guidance and ideas. Researching further here.

I will let you know the outcome.

RebelHill
01-13-2015, 06:03 AM
You dont need a flipped model, you can just flip the normals in the node editor (where you'll need DP ao with its normals input). Changing the range value at the bottom then lets you easily attenuate the effect.

Infinite
01-13-2015, 07:23 AM
You dont need a flipped model, you can just flip the normals in the node editor (where you'll need DP ao with its normals input). Changing the range value at the bottom then lets you easily attenuate the effect.

IDEAL! Thanks RebelHill. Saves the flipping (an annoying step!)

I can't believe the response and help on this forum. Thank you guys.

The previous technique with ZBrush was flawed because you had little control over the calculation and it was near impossible to bake AO on a polygonal mesh over 5 million polygons, so you were stuck to low polygon. Lightwave of course chews up such data no problem and can produce exactly what I had imagine.

More accurate with finer control thanks to Dkit's Ambient Occlusion node:

126555

All that's needed now is some hand painted veins.

Much respect guys, thank you kindly for your help.

Infinite
01-13-2015, 08:13 AM
Although using MSherak's node setup combined with RebelHill's invert setup I can't get it to work. Just comes out black. Is the multiply node the right one to use to flip the polygon normals?

RebelHill
01-13-2015, 08:18 AM
The vector multiply... yep.

Try with the settings shown in my network image for the DP ao shader... as they make a difference. Also, if you flip normals on a flipped model, you're back to forward normals.

MSherak
01-13-2015, 10:41 AM
You dont need a flipped model, you can just flip the normals in the node editor (where you'll need DP ao with its normals input). Changing the range value at the bottom then lets you easily attenuate the effect.

Was more of a visual to show how they are generated. But yes you can invert the normals before the node.



Although using MSherak's node setup combined with RebelHill's invert setup I can't get it to work. Just comes out black. Is the multiply node the right one to use to flip the polygon normals?

Size of the model is important to the falloff setting. Since you are dealing with distance shading between normals you have to make sure that the falloff is atleast 25% the size of the model. Also if you are using the vector multiply you have to place -1,-1,-1 in the B input so the normals are flipped when using this on a normal facing model.

-m

erikals
01-13-2015, 05:33 PM
Awesome thread! http://erikalstad.com/backup/misc.php_files/king.gif