Tue, Feb 25, 10:12 AM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Moderators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2025 Feb 24 11:54 pm)



Subject: Displacement maps and negative colors(?)


bopperthijs ( ) posted Fri, 18 January 2008 at 6:43 PM · edited Tue, 25 February 2025 at 10:08 AM

As the most of us know one of the disadvantages of displacement-maps this the fact that you can only have a positive or a negative value, so in other words you can only raise  but not lower a surface with the same map.I don't know if someone mentioned this before but I discovered a solution with a simple node-trick in the material room which I like to share with you.
For the examples I made a scene with two high resolution planes at the same location and rotation: One plane is for reference, colored red and made a bit transparant. The other plane is colored gray will have the displacement map. In the folowing message I'll show the material room setup.

Bopperthijs

-How can you improve things when you don't make mistakes?


bopperthijs ( ) posted Fri, 18 January 2008 at 6:48 PM

file_397934.jpg

This is standard setup: a small bitmap with a medium gray (127) surface and a white and a black dot, and the displacement value set to 200. As everyone knows who has used displacement maps before, this are grayscaled bitmaps who push or pull the surface of an object once rendered, dependimg on the gray values of the bitmap.

-How can you improve things when you don't make mistakes?


bopperthijs ( ) posted Fri, 18 January 2008 at 6:52 PM

file_397938.jpg

And this the result: as you can see the whole plane has been pushed outwards as you can see by the red reference plane: the white dot makes a raised cylinder and the black dot makes a lowered cylinder, but the bottom of the lowered cylinder is in fact in the same plane as the reference surface. This is the regular displacement behaviour.

-How can you improve things when you don't make mistakes?


bopperthijs ( ) posted Fri, 18 January 2008 at 7:07 PM

file_397939.jpg

Well this the setup for the solution: I attached a colormath node between the displacement map and the displacement value. In the colormath node I subtracted a grey value from the original bitmap, I picked the greycolor with the eyedropper from the original bitmap so the result for the gray region of the bitmap will be black, and the white dot will have a grey value; but what about the black dot? You can't negative colors can't you? Well in fact you can, only it isn't visible: we're used to calcualte with positive colorvalues where white is 255,255,255 and black is 0,0,0 and blacker than black shouldn't be possible But with colormaths it is, the result is a map with negative values but because the computer don't know how display them, (and your eye can't see it either) it is displayed as black, and the result works with the displacement value: See the resullt in the next post.

-How can you improve things when you don't make mistakes?


bopperthijs ( ) posted Fri, 18 January 2008 at 7:16 PM · edited Fri, 18 January 2008 at 7:17 PM

file_397940.jpg

This the result: the red reference square seems to be on top of it, but because it's transparant you see that grey square is in the same plane and that the black dot makes a recessed cylinder. So in this way you can use one map for recessed and raised parts of your surface, with a simple solution.

Interested? tomorrow I have some with gravity controlled displacement maps.

Best regards and happy renderings,

Bopperthijs

-How can you improve things when you don't make mistakes?


JOELGLAINE ( ) posted Sat, 19 January 2008 at 12:17 AM

VERY interesting!  I'm completely facinated by displacement maps, and haven't had the time to experiment with them much. I'll follow this with interest!

I cannot save the world. Only my little piece of it. If we all act together, we can save the world.--Nelson Mandela
An  inconsistent hobgoblin is the fool of little minds
Taking "Just do it" to a whole new level!   


muralist ( ) posted Sat, 19 January 2008 at 2:24 AM

Excellent!  Thanks,   This exactly solves a shader question for my colonial brick buildings.


diolma ( ) posted Sat, 19 January 2008 at 2:33 PM

@ bopperthijs,

Try the following: Take your greyscale bitmap output and put it through a math node. Subtract 127 from (or add  -127 to) it. Then plug that into your displacement node. This should give you your indent/outdent without moving the whole thing awayt from the base-plane...

PS: Note that the displacement node will take -ve as well as +ve values. -ve values displace "inwards". +ve value displace "outwards". 0 = no displacement.
By subtracting 127 from the greyscale, you are converting the 127 "flat" area to zero and the rest of the map accordingly :-)

Cheers,
Diolma



bopperthijs ( ) posted Sat, 19 January 2008 at 3:26 PM · edited Sat, 19 January 2008 at 3:27 PM

Hi Diolma,

But in that case the grey value has to be exactly  127, by using a colormath node you can select  the exact color with the eyedropper and be assured that after an subtraction the result always be black.

but thanks anyway for your response,

regards,

Bopper

-How can you improve things when you don't make mistakes?


nruddock ( ) posted Sat, 19 January 2008 at 3:28 PM

Attached Link: http://www.renderosity.com/mod/forumpro/showthread.php?thread_id=2616386

127 is not the right value, you need to use 0.5


diolma ( ) posted Sat, 19 January 2008 at 3:40 PM

OOps... nruddock, you are of course right, 0.5 not 127.

Sorry, Bopper - missed the 2nd part of your 4th post.
My mind was wandering. I think I'd better go and wander after it, make sure it's not getting up to more mischief...

Cheers,
Diolma



dburdick ( ) posted Sat, 19 January 2008 at 5:54 PM

The fundamental problem is that Poser handles displacement maps incorrectly versus how virtually every other 3D handles displacement.  The industry standard is that middle gray is 0, white is +1 and black is -1.  In Poser, Black is zero, Middle Gray is +0.5 and white is +1.  The workarounds suggested here are good ones.


nruddock ( ) posted Sat, 19 January 2008 at 7:10 PM

It's only a "standard" because those applications don't have nodes, meaning that there has to be a way of getting both +ve and -ve displacement with only a map.


bopperthijs ( ) posted Sat, 19 January 2008 at 7:20 PM · edited Sat, 19 January 2008 at 7:21 PM

Hi Nruddock, I missed that thread but is already a while ago. But I think by using a colormath node and the eyedropper you can choose the zero level of your displacement bitmap if you have a more complex map than my simple three colored map. I guessed someone has found this out earlier but I couldn't find a reference.
Thanks for the link.

regards,

Bopperthijs

But I have more in a next post....

-How can you improve things when you don't make mistakes?


dennisharoldsen ( ) posted Sat, 19 January 2008 at 8:16 PM

bopperthijs - thanks

this is a subject i know nothing about but would like to understand it.

i appreciate you sharing what you know. i will attempt to assimilate what you have said and look forward to your next post.


nruddock ( ) posted Sat, 19 January 2008 at 8:30 PM · edited Sat, 19 January 2008 at 8:31 PM

Quote - But I think by using a colormath node and the eyedropper you can choose the zero level of your displacement bitmap if you have a more complex map than my simple three colored map.

Certainly a good variation as some people will be more comfortable with picking a colour rather than working out what the number they want should be.


Angelouscuitry ( ) posted Sun, 20 January 2008 at 6:52 PM
kobaltkween ( ) posted Sun, 20 January 2008 at 10:49 PM

yeah, this has been known for ages, but it's absolutely great to see it crop up again.  this is exactly what i told one of the PC artists who  didn't want to include displacement maps in the Poser install of PC items.  so i hope that this technique gets better known, as it takes about 1 second to implement.



jdcooke ( ) posted Mon, 21 January 2008 at 12:10 PM

file_398173.jpg

(.....Large Image Warning!!!!.....) Just to show what is possible with Poser and displacment. By using the subtract node, you can adjust the amount of displacement in either positive or negative values. Note: the sphere stays exactly the same size and only the displacement information is affected. later jdc


JOELGLAINE ( ) posted Mon, 21 January 2008 at 2:22 PM

VERY cool! Keeping and eye on this! Thanks for the settings!

I cannot save the world. Only my little piece of it. If we all act together, we can save the world.--Nelson Mandela
An  inconsistent hobgoblin is the fool of little minds
Taking "Just do it" to a whole new level!   


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.