Jump to content
Hash, Inc. Forums

Investigating displacement


Recommended Posts

  • Hash Fellow

[Edit: This side discussion has been split off from topic AMC Gremlin]

Investigating further...

Here is a comparison of displacement effects:

First with a Gradient Material set to transition from RGB 128  to RGB 129 and Displacement set to 100000%

Second is that  gradient rendered to a TGA and used as a Displacement map

Third is that gradient rendered to an OpenEXR and used as a Displacement map

Gradiant128-129Comparison.jpg

 

The Material is able to calculate an exact value for every pixel between the 128 and the 129 levels, creating a perfectly smooth slope.

The TGA map, as expected, has one stair step from 128 to 129

The EXR has 8 steps. EXR uses a 16 bit floating point format to store values, but it maps our 0-255 range for black to white to -1.0 to +1.0. From what I read about 16-bit floating point numbers, there 1024 possible values between 0 and 1 (and thus, 2048 between -1 and +1) which matches the result above , with 8 steps between our 128 and 129 gray values.

 

So it seems that A:M is capable of rendering finer displacements, but EXR doesn't store the finer values needed.

According to OpenEXR docs, EXR can have 32-bit floating point data. Maybe there is an easy way to get A:M to write those?

 

  • Like 1
Link to comment
Share on other sites

  • Hash Fellow

Now this is interesting...

I took the single-patch rectangle and lit it with one very bright Kleig light set to 100% width softness and rendered that with no other lights on it to a TGA and to an EXR.

If you load and view those images they look like the top frame, below. It looks like the light has very quickly clipped out to full white in the middle.

When I apply those as Displacement maps we get the result in the lower two frames.

The TGA version on the left shows that the gray values reach "white" and go no further. But the EXR version has recorded values that surpass white and create displacement above and beyond what the TGA map could do.

 

This shows that A:M displacement is able to interpret EXR values beyond 1.0. If we could make maps with those extra values we could probably have smoother displacement effects.

LightCardTest.jpg

 

Link to comment
Share on other sites

  • Hash Fellow

One of my false memories from childhood is the Ajax commercial with the White Knight who got your clothes "whiter than white".

But it never really said that! Ajax is just "stronger than dirt."

 

 

Link to comment
Share on other sites

  • Hash Fellow

This 16 bit floating point is turning out to be more complicated than I thought...

 

An EXR rendered with a gradient from RGB 64 to RGB 65 has 16 steps instead of 8.

image.png

 

 

If the gradient was 192-193, we get 2 big steps and 4 small ones...

image.png

 

 

Link to comment
Share on other sites

  • Hash Fellow

This image compares seven different narrow grayscale gradients rendered to EXR and used as displacement maps.

These results roughly align  with what I've read... the precision of floating point variables decreases as the value gets farther from zero.

From RGB 0 to RGB 1 the increments are so small that the stepping  is nearly invisible, but from RGB 254 to RGB 255 the precision only allows a few steps.

I can't explain why these have uneven steps and don't match the previous examples. Possible difference... these were shot with an orthogonal camera instead of a perspective camera... ??

 

GradCompares.jpg

 

 

 

Link to comment
Share on other sites

  • Hash Fellow

Here is the same test, except that the EXR maps were rendered with 1 pass instead of 4.

One  pass actually got a smoother progression of gradient  values, even though the number of pixels in the decal is the same either way.

I can't imagine what math mishap would cause the difference. But there it is.

 

image.png

Link to comment
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...