Page 1 of 3

displacement question - which color is 'neutral' ?

Posted: Fri Dec 05, 2014 1:51 pm
by portnicki
Hi,

I'm trying to find out how displacement maps work in Octane.

I have lets say a vase. I want to use a displacement map to create graphical patterns on it. No matter which image texture node I use (grayscale image OR Alpha image) with the displacement node - my whole vase puffs up. I would think that either no color at all (an alpha image) or a mid-gray color would be read as neutral for Octane. But that's not the case. What am I missing here?

Thanks!

Re: displacement question - which color is 'neutral' ?

Posted: Fri Dec 05, 2014 2:13 pm
by gordonrobb
In octane black is neutral. The only way you get negative displacent is to use the shift parameter. However, in my experience, in a lot of cases this causes tearing. No idea Whn it's going to be fixed.

Re: displacement question - which color is 'neutral' ?

Posted: Fri Dec 05, 2014 2:54 pm
by portnicki
gordonrobb wrote:In octane black is neutral. The only way you get negative displacent is to use the shift parameter. However, in my experience, in a lot of cases this causes tearing. No idea Whn it's going to be fixed.
hey gordonrobb, you are right. I did some more testing. It turned out that I just had some UVmap + ray epsilon problems and I thought that a black map was still pushing out my mesh. But it wasn't. I get a lot of black rims on my mesh and I'm already at the minimum ray epsilon value.
Had to work around it and use separate polygon mask-materials for every piece of the vase I wanted the displacement to work. Very tedious work :( but at least it works now.

thanks for answering!

Re: displacement question - which color is 'neutral' ?

Posted: Fri Dec 05, 2014 3:22 pm
by itsallgoode9
what negative shift value makes 50% grey? the value slider in the maya plugin goes fro 0-1000000

Re: displacement question - which color is 'neutral' ?

Posted: Fri Dec 05, 2014 8:03 pm
by miko3d
there seems to be a bit of confusion with exporting and dealing displacement maps in general , and I belive most of this comes from the old way of exporting from Zbrush (in 16 bits "evil" integer TIF format....)50% grey=no displacement is a consecuence of this approach and in my opinion is wrong and obsolete with the use of 32 bits float format (openEXR)
Just export from your favorite sculpt package in 32 bits and midpoint=0 then in your render package just import the image, set the scale value to 1 and midpoint to 0 and job done.It works.Remember, scale units are important and any scale change you do to the base geometry will need to be compensated.
In Octane unfortunately ,at the moment,we do have an extra layer of work to do, as it will clamp negative values to 0 ,you can easily workaround this by shifting (adding ) to the image a value equal or bigger than the minimum and shifting back within octane.But this has nothing to do with this 50% grey offset of the old 16 bits export fromZ brush.

Re: displacement question - which color is 'neutral' ?

Posted: Sat Dec 06, 2014 12:18 am
by gordonrobb
If you're using a ZBRush displacement map, you need to make shift value negative a half of the amount value. So if you're amount figure is 1, your shift value needs to be -0.5.

Re: displacement question - which color is 'neutral' ?

Posted: Sat Dec 06, 2014 7:00 pm
by miko3d
gordonrobb wrote:If you're using a ZBRush displacement map, you need to make shift value negative a half of the amount value. So if you're amount figure is 1, your shift value needs to be -0.5.

this is not correct ,you dont "need" to ,and to be honest its what confuses people and ends in situations like eye balling unnecesary values and offsets IMHO .
Getting Displacement maps from Zbrush to Octane(or to any decent 3D render) is pretty easy and accurate this days.Just stick to 0 as midpoint and preferable use 32 bits images (for micro high frecuency accuracy as we cant render with bump/Normal maps for now) and remember until Otoy adds support to use negative values you will need to shift them.
UV shell border holes are really the main issue at the moment in Octane (well hopefully by the latest build this will be Sorted!)

Re: displacement question - which color is 'neutral' ?

Posted: Sat Dec 06, 2014 9:16 pm
by gordonrobb
OK, I am completely confused by what you're saying. I said that if you're using a ZB displacement map you need to shift them to to get any kind of negative displacement as in Octane Black (0) is neutral. You said that this is not the case, and that getting ZB displacement is easy and then said you have to shift them to get negative values. If there is something wrong with my assessment of how to use displacement maps created in ZBrush, can you please let me know what it is. If it is easy, let me know because I cannot get it to work without using shift, and shift invariably causes tears in the geometry. I am honestly hopeful that I am wrong and you are right so that I can get it to work. Please share your process.

Re: displacement question - which color is 'neutral' ?

Posted: Mon Dec 08, 2014 1:11 pm
by miko3d
Hey GordonRob,No problem mate ,I will try to explain a bit better.

Its all about how to extract the data from zbrush and why some methods are not so useful this days,this may get a bit boring and trivial for some people,so apologizes... :geek: but i think its important:

Years ago, when 16/32 bits "float" image formats (like EXR) were not widely used, the way of storing data with more information than the tipical 8 bit (tga,jpg,etc...)was by using the 16 bit "Integer" format(like SGI16,"evil"TIF16 )

When we have 8 bits we have: 2^8 =256 or 0-255 range of integer values,and when we interpret this values to colors in an image we do so by saying 0= black 255=white.

16 bits Integer is just an extension of this, same process different range,as we now have a range of 2^16= 65536 values,again 0=black 65535= white, which is so much better when you need precision(like with displacement).

So back then we had to adapt or "convert" our displacement pure values to this image format to make it useable in our favorite 3D render.One way to do so was by normalizing the displacement amount and keep a max displacement factor.

Lets have a very simplified example,Imagine a plane geometry where you just displaced 2 values, one is a "pull" of 8.7 (+8.7) units and the other is a "push" of 3.5 (-3.5) ,the rest of the vertex are not touched (0).The problem is how do you store those values using an image format in an easy way that can be loaded later on in our render software.One solution was to normalize them, so if we know the maximum displacement is 8.7, its very easy for example just clamp the values to the range of (-8.7,8.7) divide by 8.7 (-1,1) halve it (-.5,.5) and add 0.5(0,1) .Now, if we multiply this normalized values by 65536 and get rid of any decimal, we have a fully interger 16 values that can be saved and loaded easily in our render of choice.

To get the correct displacement values in our render, we load the normalized values(0,1), the midpoint will always be 0.5,but we need to define the scale value or max displacement value for our model in our case (8.7) and of course our midpoint will be 0.5*maxValue,so we will need to shift by that amount (-0.5*8.7).

Now, lets do the same export from zbrush, but storing the values in a 32 bits "float" format like EXR,well we can just directly write 8.7, -3.5 and the rest will be 0.

We will load the image in our render and we should be able to just click render. Our scale will be 1 and offset 0 (remember we have stored the exact values)

The second workflow is so much easier and more important less confussing, thats why personally I would advise in adopting it.

In Octane,at the moment, is a bit different story, there is no need to normalize anything or get a proper scale as we can use EXR float images,but it doesnt like negative values,still all we need to do is add to the whole image a constant value, high enough to get rid of negative values and ofcourse smaller than the displacement bounds of the mesh and then offset in the displacement node.

Have a look to this link, even though it doesnt specifically talk about octane,it does better job in explaining this matter

http://www.cggallery.com/tutorials/displacement/

If you need any help with octane let me know,i could setup a very simple scene.

I hope it helps!

Re: displacement question - which color is 'neutral' ?

Posted: Mon Dec 08, 2014 4:23 pm
by gordonrobb
I get all of that in terms of how to create a good displacement map.

What I'm still confused about is why you say my comment ...

"If you're using a ZBRush displacement map, you need to make shift value negative a half of the amount value. So if you're amount figure is 1, your shift value needs to be -0.5."

....is wrong.