Page 1 of 3

Displacement Height

Posted: Thu Feb 24, 2011 5:49 am
by Burnum
Hello, I'm trying to learn how to use Displacement maps and I find that the Displacement height setting doesn't make sense to me.
So, if I understand how it works, I either get to choose a percentage of the longest edge of the associated object’s bounding box, or centimeters. thats it?

I'm trying to build a material to generate Aluminum Flex Conduit. My reference has an outside circumference of about 6.76cm, with ridges that have a depth of about .218cm deep. My UV map wraps around the circumference seamlessly once then tiles down the length. So, in my settings I used Tile XY Relative, with the map set to repeat once in X (around circumference) and 2.271 down it's length (it's not square) Now I'm trying the best way to determine how deep the displacement should be, and it's proving to be rather complicated... The percentage option at first seemed like the best option, but it just doesn't work, since it's using the longest bounding box edge of the entire model, not the UV tile size's X or Y side.... In the image below you can see I have a long section of this tube, so it's longest bounding box edge is VERY big relative to the small edges, yet ultimately this has nothing to do with the depth of the gaps. Besides the depth just goes nuts even at less than 1%, and since the entry fields force you to go to only 1 place that doesn't help... So that wasn't an option on my model, though it makes a nice render on the preview sphere...

Why don't we have a way to set it's depth as a percentage of a tile's X or Y? It would be great if the depth scaled perfectly with lets say the X tile size. (or y) I could then just say it's 3.23%, (if I'm doing my math right) and it would look the same on any size of tube.

The really mind bending part at the moment is, I'm currently using a depth of 7.7cm!?! (with tile at relative 1 to wrap it once around the tube) and it's actually starting to look about right! (not at all ok in the texture previews however) I came up with 7.7cm through trial and error, when % failed me, and the real depth of .218cm (that gets rounded to .2!) showed nothing much... 7.7cm can't be right, yet there it is in my sample image looking very similar to the real thing... (insert Twilight Zone music here) ok, i'm not a math whiz...

Image

Re: Displacement Height

Posted: Thu Feb 24, 2011 11:32 am
by itsallgoode9
is your displacement map fairly low contrast and not full white to black? My experience, if I've rendered out a displacement map and my settings were wrong, it would be very low contrast and although I could get it to work in maxwell, I had to set the CM height very very high, like you said. I believe the CM only works correctly if it's a full black to white value range.

Re: Displacement Height

Posted: Thu Feb 24, 2011 2:33 pm
by Half Life
Yep, as was stated displacement is not just about the input values but also about the greyscale values in the map as well (and the precision setting/mesh density factors in too)...

Displacement "offset" value is critical as that sets the greyscale value (in your map) that represents "no change" to the mesh typically if you leave this at the default then a grey of 128 represents no change and pure white represents 100% in the positive direction and pure black represents 100% in the negative direction.

The material previews are meaningless because you don't know the real scale of those objects unless you make your own test scene.

Best,
Jason.

Re: Displacement Height

Posted: Thu Feb 24, 2011 8:19 pm
by Burnum
This is a low res JPG version of my greyscale 32bit TIFF displacement map.
I'm using an offset of 1, so it only pushes into the model.

Image

Re: Displacement Height

Posted: Thu Feb 24, 2011 8:22 pm
by Burnum
if we had the option to set the depth relative to the UV scale, then the previews would work as well?

Re: Displacement Height

Posted: Thu Feb 24, 2011 8:28 pm
by Half Life
I notice in your specs that you are running an older version of Maxwell with Sketchup -- so 2
questions:

1) are you not using the new plugin?
2) Are you outputting this straight from Sketchup?

BTW, the answer is yes -- if you adjust the UV's then it will work right... but all the measurements are assuming you are using normalized (1m realscale) UV's.

If you are not then the measurements (height mm) input into displacement would not yield predictable results.

Best,
Jason.

Re: Displacement Height

Posted: Thu Feb 24, 2011 8:39 pm
by Burnum
Oops, need to update that!

I'm running 2.5.0.0 OSX 64bit, with the SketchUp 8 2.5.0 plugin.

But, in this case it's impossible to even consider setting up textures in SketchUp. SketchUp is just plain horrific with UV maps on anything but flat surfaces, so I have another tool I recently bought to help me generate usable UVs. It's called UVLayout.

Re: Displacement Height

Posted: Thu Feb 24, 2011 8:42 pm
by Half Life
I totally feel your pain on that one -- anyway, just make sure you have the scale for the UV's in that program to 1m x 1m scale... that is the most likely culprit.

BTW, 32-bit is overkill -- 16-bit will be OK and save on file size.

Best,
Jason.

Re: Displacement Height

Posted: Thu Feb 24, 2011 8:53 pm
by Burnum
Hmmm scale... I hadn't thought that replacing the UV nightmare that SU generated would change the actual scale of the model... I'll check into that.

this is a shot of the UVs SU generated...... :shock:
Image


Oh, and my 32bit grey map is only 1.8MB so its not that big a deal size wise, I want the finished displacement to be as smooth as it can be. :)

Re: Displacement Height

Posted: Thu Feb 24, 2011 9:04 pm
by Half Life
The scale of the model isn't something the material editor understands -- all it knows is the scale that the UV's tell it... so the UV's must be normalized (realscale) to allow the material editor to apply a displacement value in mm that will be correct.

Any other value in the UV scale will also result in the mm setting in MXED for displacement in mm to be wrong in an equal proportion.

I've been harassing the people at Sketchup to create a proper UV unwrap function for Pro users but I'm not holding my breath.

Best,
Jason.

Re: Displacement Height

Posted: Thu Feb 24, 2011 9:15 pm
by Burnum
I would rather not be working in Meters... I guess I need to learn how to Normalize? so if my Circumference is 6.759cm and depth should be .218cm I need to change it to 1m and whatever the equivalent depth would be?

I would happily work in mm, but the app for now is only cm for depth (rounded off to one place!) and either meters or relative for the UVs...

thats why I was surprised that we don't also have a relative setting for depth, that relates back to the UVs.

Re: Displacement Height

Posted: Thu Feb 24, 2011 9:19 pm
by Half Life
Well I only mean in relationship to size of the material itself -- how wide the grooves should be in relationship to to how deep... it's only relevant if it is absolutely critical to be dead-on otherwise I would just "eyeball it" to look right.

To clarify: displacement will use the setting you set to create "real scale" depth to the geometry -- however if you have the material defining the displacement set to any other scale then the 2 results will not match up... eg: too deep or not deep enough, which is all relative (to the overall scale of the width of the ridges and object overall).

Just context click on the field and select decimal precision to work in mm (or smaller).

Best,
Jason.

Re: Displacement Height

Posted: Thu Feb 24, 2011 11:02 pm
by Burnum
i'm still not sure I understand how if I make my UV use real scale of 1 meter, how does that make the depth correct? it's not 1 meter around the tube, it's 6.76 cm?

Re: Displacement Height

Posted: Thu Feb 24, 2011 11:15 pm
by Half Life
Maybe I should rephrase that -- the image that defines the displacement should be at a real scale meaning 1m = 1m... generally that would mean scaling the image to fit a 1m x 1m UV.

However if you have some other system to calculate the "real world" size of the image on the geometry then that would work just as well -- the only important thing is the relationship of the width of the map and the desired depth should be 1 to 1.

The displacement settings define the depth but the map defines the overall scale and the maps relationship to the geometry is defined by the UV's.

the simplest way I know to ensure that you get a 1 to 1 ratio is to use a 1m x 1m projector -- which keeps the math somewhat basic... but the Sketchup plugin uses an .25m x .25m projector for it's UV override so the size of the projector is not so important as long as you know what it is and adjust the map to fit the correct scale. (a 6.76 cm X 6.76 cm projector would work fine too)

Do you know the scale of your UV's and have you adjusted your map to fit a 1 to 1 ratio is basically what it comes down to... just because something wraps around a cylinder seamlessly does not mean it is correctly scaled down the length of the cylinder.

Conversely -- If you use a UV projector of 6.76cm x 2.98cm (2.9760156 rounded) which is your image extrapolated without distortion then you would set the tiling for 1 and 1 in Maxwell and you would get a correct result. (this is essential how the native Sketchup material tiling works)

The point is for you to set the image to tile correctly you either:

A) set the tiling to 1 and 1 (relative) in MXED and adjust the UVs to the correct scale(.0676m x .0298m).

OR

B) you set the UV's to 1m x 1m and adjust the tiling in MXED to your meters values (.0676m x .0298m) which would be what was known in previous versions as realscale.

There are variations on this -- for instance if you use the UV override of the Sketchup plugin the UV's will be .25m X .25m which will mean you will have to set your tiling at .2704m x .1192m (which is just .0676m x .0298m multiplied by 4)... or if you are feeling full of math power you could set it for tiling relative at 3.6982249 x 8.3892617 (which is just .25 divided by .0676m x .0298m ).

I suck at math, so for me I just set the UV's 1m x 1m and just set the map tiling at realscale in MXED makes me happy. :wink:

Best,
Jason.

Re: Displacement Height

Posted: Fri Feb 25, 2011 10:47 am
by Burnum
i'm still not getting this I guess... I'm working with objects that are far smaller than 1m. My image represents 6.759cm by 2.976cm. I have it set to relative, because it's not even close to meters, and I have it also set to tile at 1:2.271 (XY) because it's not square. this seems to work perfectly... does a UV box have a scale? Are they not always 1:1 and whatever scale they happen to fit in the model?

My process is this;
I build the model at real scale, so my modeled tube is 6.759cm in circumference, as it should be, and then I export that from SU into an OBJ file.
Then I take the OBJ into UVLayout to build a seamless tile that flows along the bent pipe. the UV box fits exactly to the circumference of the tube once, and tiles the rest of the way down the pipe.
This I then save again and import into Maxwell.

There isn't a way to change the "scale" of the UV box that I'm aware of, I just assume it's now 6.759cm square, since the model is suposed to be that size... As far as I understand it, it is what it is, (and I clearly have a lot to learn yet) and the model it's self is the dimensions it always was?? Do UV boxes have actual dimensions assigned to them as well that are different from the model? or do they somehow alter the model scale?

This brings up a different issue I just discovered... I'm actually not sure what size my OBJ files are after export from SU and import to Maxwell now, because I just put an exported OBJ and an exported MXS into Studio at the same time, and the MXS came in with a scale of 0.025 XYZ? But my OBJ files come in at a scale of 1.0 XYZ?

yep... I have a lot to learn still...