Wed, Apr 24, 12:01 PM CDT

Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Apr 24 9:07 am)



Subject: Mask a Displacement Map


flibbits ( ) posted Wed, 28 December 2011 at 2:27 PM · edited Sun, 21 April 2024 at 5:12 AM

This was suggested, in another thread, so that displaced areas don't poke through clothes.  Mask the displacement so it isn't applied on skin beneath clothing.

This is a followup.  How is a mask applied to a displacement?



RobynsVeil ( ) posted Wed, 28 December 2011 at 4:57 PM

Via a Blender node. I'm not home and at my PC atm, or I'd post a screenshot... it is relatively easy to do, though.

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


bagginsbill ( ) posted Wed, 28 December 2011 at 5:50 PM

Multiply with the mask. Where the mask is white, the displacement will remain. Where the mask is black the displacement will be nullified.

 

Consider:

 

White is 1, black is 0.

Any value, x, remains x when you do x * white. Any value, x, is 0 when you do x * black.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Wed, 28 December 2011 at 5:51 PM

Note, a blender contains multiplication and so it can be done with a blender, but it is using a more powerful node than is necessary. I tend to think about such things even if it is unimportant.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


RobynsVeil ( ) posted Wed, 28 December 2011 at 10:05 PM

Quote - Multiply with the mask. Where the mask is white, the displacement will remain. Where the mask is black the displacement will be nullified.

 

Consider:

 

White is 1, black is 0.

Any value, x, remains x when you do x * white. Any value, x, is 0 when you do x * black.

Nevr thought of that. Thanks for that, Bagginsbill. (in my black book this goes!)

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


flibbits ( ) posted Thu, 29 December 2011 at 12:12 AM

I'm still not sure what people mean by this displacement mask.

There's already an image applied to the displacement node in this case.   Is that the displacement mask?

This is the image of the settings.  For this one I altered the displacement image, changing to flat gray the areas where displacement isn't wanted.

 http://www.imagebam.com/image/1fb73b166957767

It removes the displacement, but there's seams between the chest (where there is no displacement) and shoulders.



flibbits ( ) posted Thu, 29 December 2011 at 12:32 AM

"there's seams" should be "there are seams".



rokket ( ) posted Thu, 29 December 2011 at 9:23 AM

The reason the seams are showing up is because you have them in your image on the displacement map. You might try using whatever photo manipulation software you have (photoshop) and remove them from the image.

If I had a nickle for ever time a woman told me to get lost, I could buy Manhattan.


bagginsbill ( ) posted Thu, 29 December 2011 at 9:35 AM · edited Thu, 29 December 2011 at 9:36 AM

Nobody is going to mention the gray != neutral displacement business?

(The symbol pair != is computer programmer speak for "does not equal")


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


hborre ( ) posted Thu, 29 December 2011 at 9:37 AM
Online Now!

No, this means that the displacement value is too high or, if you are using the Pro series Poser, the gamma correction for the displacement map is matching the render settings granted that you are using Gc in the render.  I don't recall which version you are using which will help.  Also, what is your Poser Display units?


SamTherapy ( ) posted Thu, 29 December 2011 at 9:59 AM

Quote - I'm still not sure what people mean by this displacement mask.

There's already an image applied to the displacement node in this case.   Is that the displacement mask?

Nope.  The mask would be a secondary image which is black over parts of the body where you don't want the Displacement to be applied and white where you do.  The Displacement Map is the Black/White/Grey image which shows how much Displacement is to be applied. 

Coppula eam se non posit acceptera jocularum.

My Store

My Gallery


flibbits ( ) posted Thu, 29 December 2011 at 11:31 PM

Where does the second image go? 

I've read dozens of tutorials and people keep answering, but there's no mention of where to apply the mask.

 

 



RobynsVeil ( ) posted Fri, 30 December 2011 at 2:28 AM

So, it would be:

PoserSurface.Displacement = .09856 * ImageMap("MyDispMask.jpg")

C'est tout??

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


SamTherapy ( ) posted Fri, 30 December 2011 at 8:02 AM

Quote - Where does the second image go? 

I've read dozens of tutorials and people keep answering, but there's no mention of where to apply the mask.

 

You first plug a Blender node into the Displacement Channel, then plug the Mask into one channel of the Blender and your Displacement Map into the other channel.  Set the parameter to 1 and plug the Mask into that also.

I can't remember offhand which the two maps go but since there are really only two options it's easy enough to work out.  When it's working you'll see an image with your displacement map in the white areas and plain black in the rest. 

Coppula eam se non posit acceptera jocularum.

My Store

My Gallery


bagginsbill ( ) posted Fri, 30 December 2011 at 8:17 AM · edited Fri, 30 December 2011 at 8:19 AM

Sam,

Here's what you said, using math:

Letting M represent the mask, and D represent the original unmasked displacement:

Blend(M, D, M) <---- this is what you described

Definition of Blend is

Blend(a, b, f) = (1-Clamp(f))*a + Clamp(f) * b

Since M is being used as f, and M is, by definition, already in the unit range [0, 1], the Clamp aspect can be ignored.

So, you have

Blend(M, D, M)

= (1-M)*M + M * D

However, the goal as I said earlier is to multiply M with D, so that you have M * D.

The Blend includes M * D, but also adds the term (1-M)*M which is interesting nonsense.

When studying any formula, it is instructive to examine the low, medium, and high input values.

For a map, the low is 0, medium is .5, and high is 1. Let's use this notation: [l, m, h].

So what does (1-M)*M produce with that vector?

1-M = 1-[0, .5, 1] = [1, .5, 0]

So (1-M) * M is:

[1, .5, 0] * [0, .5, 1] = [0, .25, 0]

What does this mean?

It means that where the mask is 0 or the mask is 1, this term is 0 and will have no influence on displacement.

However, where the mask is in transition between black and white, there will be shades of gray that will produce non-zero values. These will create a raised outline of the mask shape. This is not at all desirable.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Fri, 30 December 2011 at 8:20 AM · edited Fri, 30 December 2011 at 8:26 AM

Again, I have to point out two things:

Mid gray is not a neutral displacement. Black is neutral. Black means zero. As I've written many times, for proper use of a displacement map that was designed with mid-gray as the neutral value, you should offset it. There are two common strategies, both equivalent. You can subtract .5, or you can double it and subtract 1.

And to control a displacement effect so that it appears some places but not others, use a black and white mask. Multipy the mask with the displacement.

Robyn:

In matmatic parlance:

mask = LinearMap("whateverIsYourMask.jpg") # linear map is an image map with gamma=1

dispmap = LinearMap("whateverIsYourDisplacementMap.jpg")

centeredDispMap = dispmap - .5

depth = .1 # use whatever depth you want - I'm using .1 inch as an example

surface.Displacement = depth * (mask * centeredDispMap)


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Fri, 30 December 2011 at 8:23 AM · edited Fri, 30 December 2011 at 8:28 AM
kobaltkween ( ) posted Fri, 30 December 2011 at 8:34 AM

You only need a Blender node when you need to blend two colors.  If you only want to affect one value, you can multiply.  If you had two maps, you'd need a Blender node.  If you just want to control the strength of one map, then multiply works just fine.  And since displacement is single channel (as is any control map), you don't even need a color multiply, a regular one will do.  Especially considering render GC affects Blender nodes but not regular math nodes.



Khai-J-Bach ( ) posted Fri, 30 December 2011 at 8:34 AM

can anyone just show us how it's done? (the math and explanations are good... if you understand them. but since not all of us can do math like that, it's of no use, where a simple picture would help explain...)



bagginsbill ( ) posted Fri, 30 December 2011 at 8:42 AM · edited Fri, 30 December 2011 at 8:43 AM

I don't have time. I hoped that somebody else understood and would make the picture. I am at work.

 

Note that I made many pictures in the linked threads of the subtract .5 business. All that remains is to multiply. One node. Multiply.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


kobaltkween ( ) posted Fri, 30 December 2011 at 8:55 AM

file_476820.jpg

If we pretend that the cloud node is our mask, this is how to multiply our displacement map with the mask.  Not painful at all :D.



Blackhearted ( ) posted Fri, 30 December 2011 at 9:27 AM

"This was suggested, in another thread, so that displaced areas don't poke through clothes.  Mask the displacement so it isn't applied on skin beneath clothing."

if your displacement is 'puffing up' your figure then you need to fine tune your displacement map export settings from your software, and then your displacement map nodes/strength settings in poser.

since youre referring to a figure/clothing pokethrough im assuming youre talking about some sortof full body displacement map - which should just be fine surface details -- if applied properly your figure shouldnt 'puff up' :)



bagginsbill ( ) posted Fri, 30 December 2011 at 9:53 AM · edited Fri, 30 December 2011 at 9:55 AM

Quote - "This was suggested, in another thread, so that displaced areas don't poke through clothes.  Mask the displacement so it isn't applied on skin beneath clothing."

if your displacement is 'puffing up' your figure then you need to fine tune your displacement map export settings from your software, and then your displacement map nodes/strength settings in poser.

Not exactly. It's because 50% gray means 1/2 displacement in Poser. It does not mean that in other apps. It's not a tuning thing. It's what I linked to in 5 other threads above.

You must subtract .5 from the displacement map in order to cause the value .5 to mean no displacement.

Then gray does not puff up anything.

--

Assuming you have the neutral value issue dealt with by subtracting .5 ...

If the displacement is a muscle map, with bulging muscles in excess of the distance between the clothing and the skin, it is certain the skin will move outside the clothing, period. This is not a matter of adjustment. It is fundamental - you're trying to use clothing shaped like a normal person on a muscular person. Won't fit.

The OP asks for advice on a reasonable tactic - disable (neutralize) the displacement where clothing is involved. Of course this means the figure will not be muscular any longer. But whether or not I agree with the outcome, the technique is valid, and involves simply creating a mask to indicate where you want displacement enabled (white) and disabled (black) and then multiply the mask with the displacement.

 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Fri, 30 December 2011 at 9:56 AM

It is amazing to me how many well meaning folk can confuse a simple thing so badly.

Subtract .5

Then multiply with the mask

Then plug into displacement channel and adjust your depth of displacement there as desired.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


Khai-J-Bach ( ) posted Fri, 30 December 2011 at 10:07 AM · edited Fri, 30 December 2011 at 10:09 AM

It is amazing to me how many well meaning folk can confuse a simple thing so badly

it happens when you explain something in a complex fashion. eg - a page of math, instead of 'if you plug this into here, like so, to get this effect, see the notes below to why you get this effect' - compare say a complex cooking show to Good Eats. you'll learn more from Good Eats*....*

*actually building on that. it's like trying to teach cooking.  BB... you are Iron Chef. we need Good Eats instead.



bagginsbill ( ) posted Fri, 30 December 2011 at 10:42 AM · edited Fri, 30 December 2011 at 10:43 AM

But Khai - go look at my first post. No math - just simple instructions. Multiply with the mask.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


Khai-J-Bach ( ) posted Fri, 30 December 2011 at 10:52 AM

no context

mulitply in what node? where do the nodes connect? what is the mask made of - straight B&W or shades? etc

correct instructions yes. but without context, it's like handing someone who's never seen a car before,  an air filter for a BMW and saying "you just pop the old one out and put this in" with no other instructions.



bagginsbill ( ) posted Fri, 30 December 2011 at 11:16 AM

I get what you're saying but I'm concerned about how far this goes.

I will show the wiring, but it is not going to be in context. A real skin shader will have a bunch of other things. A real use case will have meaningful masks and displacement maps where mine has scribbles.

Because there will need to be further extrapolation and context, I suspect this is actually not much more helpful.

I already expect, for example, that some people have 127 and some have 128 for the mid gray, and truly, neither of these is .5. The goal is to neutralize that value and to do that you subtract whatever it is. Here we go again with math - sorry can't show it visually. The difference between 127 versus 128 is too small to see.

 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Fri, 30 December 2011 at 11:20 AM

file_476823.jpg

Here ya go.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


Khai-J-Bach ( ) posted Fri, 30 December 2011 at 11:20 AM

I already expect, for example, that some people have 127 and some have 128 for the mid gray, and truly, neither of these is .5. The goal is to neutralize that value and to do that you subtract whatever it is. Here we go again with math - sorry can't show it visually.

and yet, you just did in that statment. that made sense. no math, just a plain explanation. I now understand why thinking  .5 - as 127/128 grey - is an issue*.*



bagginsbill ( ) posted Fri, 30 December 2011 at 11:22 AM · edited Fri, 30 December 2011 at 11:22 AM

I still feel like people are just being petulant and intentionally opaque when I say multiply and you don't get that means Math:Multiply, and connect the two things that need multiplying.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


Blackhearted ( ) posted Fri, 30 December 2011 at 11:46 AM

"Not exactly. It's because 50% gray means 1/2 displacement in Poser. It does not mean that in other apps. It's not a tuning thing. It's what I linked to in 5 other threads above.

You must subtract .5 from the displacement map in order to cause the value .5 to mean no displacement.

Then gray does not puff up anything."

im aware of that:  which is why this should be dealt with your "displacement map nodes/strength settings in poser".

using displacement maps to represent muscles is not the most effective thing to do. theyre much better handled with JCMs and morphs. if someone is going all out and even doing muscle striations/veins/etc then it still should only be surface detail and shouldnt really affect pokethrough. 

dont get me wrong, masking displacement is a great thing to know how to do - however my post was intended to point out that if you are having to mask a figure's displacement maps to prevent pokethrough on clothing then you should be looking at your displacement nodes/settings before you try to correct something with masks.*



flibbits ( ) posted Fri, 30 December 2011 at 2:50 PM · edited Fri, 30 December 2011 at 2:52 PM

Thanks for all the replies and advice. 

I understand people are busy and don't necessarily have time to show the image.  Bagginsbill, who is very busy, took the time.  Thanks.

The piece missing was what kind of node and where to plug it.  Now it's clear.  It wasn't petulance.  It was confusion on my part.



SamTherapy ( ) posted Fri, 30 December 2011 at 2:58 PM

@ BB, seems I had it bass ackward but I know there's a real quick and simple way to get the blender node to do what fibbits wanted.  Not being at my Poser box, I was working from memory.  Oh well. :)

@ fibbits.  I tried my best from memory.  Couldn't post a screen shot, else I would have. 

Coppula eam se non posit acceptera jocularum.

My Store

My Gallery


bagginsbill ( ) posted Fri, 30 December 2011 at 3:00 PM · edited Fri, 30 December 2011 at 3:04 PM

No worries. Here's a cheat sheet:

When I say:

add, you use a Math:Add node

subtract, you use a Math:Subtract node

multiply, you use a Math:Multiply node

divide, you use a Math:Divide node

Each of these are binary operators - they manipulate a formula taking two things as input.

Whatever is being assembled by the important verb (first word in the above) you create that node and connect the things I said to use with the verb.

For the numeric value, you would generally use 1 in Value_1 and Value_2 unless one of the two things is itself just a number. In that case you use the number being discussed.

So when I say, for example, starting with the original displacement map, subtract .5 it should be instant in your mind that you:

Create a Math node.

Set it to mode Subtract.

Set Value_1 = 1 and connect the displacement map there.

Set Value_2 = .5 since I said to subtract .5.

 

And when I say multiply the displacement map and the mask, it should be instant in your mind that you:

Create a Math node.

Set it to Multiply.

Set Value_1 to 1 and connect that to the displacement map.

Set Value_2 to 1 and connect that to the mask.

A general rule for nodes with numeric parameters:

If nothing is plugged into the parameter, then the value of that parameter is whatever you typed into it.

If something is plugged into the parameter, then the value of that parameter is whatever you typed into it multiplied with whatever you plugged into it.

We use 1 for values when we plug thing in and we do not want them to be different.

So - if I have a displacement map in a node, and we call that node "D", and I tell you to calculate D - .5, it should be instant in your mind that this is the same as 1 D - .5, and a Math:Sub node will have Value_1 = 1, Value_2 = .5, and you plug D into Value_1.

 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Fri, 30 December 2011 at 3:07 PM · edited Fri, 30 December 2011 at 3:11 PM

Since we're dealing with beginner node tips here are a couple more.

A mask effect is convenient when white means on and zero means off. What if you need the opposite? What if you need white means off and zero means on? Do not make a reversed mask in Photoshop and load that. Instead, take the original mask and calculate the complement, or negative image.

Subtract the map from 1. This will make its complement or negative image.

If the original map node is called M, I'm saying you want:

1 - M

Now it should be obvious how to do this, right?

Math node

Mode subtract

Value_1 = 1

Value_2 = 1

Value_2 connected to M

How about if we want a grayscale version (so as to have a single number) of a color map?

Just connect it to any math parameter value and it will be converted to grayscale.

What if we want to multiply a color map with a number, perhaps to make it lighter or darker?

Add an HSV node. Set the color to white, and connect the color parameter to whatever you're trying to change the brightness of. Then set how bright in the Value parameter. That parameter is multiplied with the color parameter and what is plugged into the color parameter. It is a 3-element multiplication.

 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Fri, 30 December 2011 at 3:14 PM · edited Fri, 30 December 2011 at 3:17 PM

Quote - @ BB, seems I had it bass ackward but I know there's a real quick and simple way to get the blender node to do what fibbits wanted.  Not being at my Poser box, I was working from memory.  Oh well. :)

@ fibbits.  I tried my best from memory.  Couldn't post a screen shot, else I would have. 

Well here's how to do it with a Blender, but again it is overkill.

Input_1 = black and nothing plugged in

Input_2 = displacement map

Blending = 1 and plug in the mask

Recall Blender(a, b, f) = (1-f)a + fb

So Blender(black, displacement, mask)

You get:

(1-mask)*0 + displacement * mask

This is the same as:

displacement * mask

because the first term is 0. But why bother?

I know you guys don't care for the math, but if you were giving directions on how to turn left, I expect you'd suggest three right turns. giggle The math of multiplication with 1 or 0 is really fundamental - stop pretending it is hard. 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Fri, 30 December 2011 at 3:25 PM

file_476833.jpg

Sam,

Recall that the math helped me predict that there would be a ridge showing at the boundary between white and black?

I wired it up as you desribed and, sure enough, there is the ridge.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


SamTherapy ( ) posted Fri, 30 December 2011 at 3:44 PM

Thanks for the step by step.  I'm going to bookmark this thread.

Coppula eam se non posit acceptera jocularum.

My Store

My Gallery


RobynsVeil ( ) posted Fri, 30 December 2011 at 8:31 PM

Thanks for taking the time to explain these things, BB and KobaltKween. Explanations like these go a long way to demystifying not only the material room node stuff but also what goes on under the surface, which really is all maths.

Both Bagginsbill and KobaltKween have been very patient trying to teach me fundamentals of node behaviour and coding it. I can't say I've mastered it yet, but they have given me that maths perspective (and BB's explanation earlier was really good for those who wonder how matmatic sees nodes and connections) so I do tend to see things as an equation, now.

Doesn't mean I'm maths-minded... not by a long shot. It's more: I get what they mean now when they say: "then, fold in your egg-white"... :biggrin:

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.