vector displacement materialx

   1873   5   1
User Avatar
Member
220 posts
Joined: Feb. 2016
Online
Hello,
Does anyone know if vector displacement maps are supported in materialx/karma? It appears to be according to the documentation. It says:

"(Float or Vector3) If Float, scalar displacement amount along the surface normal direction. If vector3, Vector displacement in (dPdu, dPdv, N) tangent/normal space."

I have no trouble with regular displacement maps. I am trying to use the vector displacement maps that you export from the ocean evaluate sop. (the reason I am doing this instead of the karma ocean lop is because that doesn't work with xpu).

The first image is the just a render with no displacement. It is the output of the ocean spectrum. So this the "ground truth". When I add displacement to a flat grid it should match this.

The second image is if I use my vector displacement map. See how it is flat and definitely not correct. If I scale the displacement it looks strange.

I read somewhere that vector displacement maps can be read xyz or xzy. So the third/fourth image is if I swap the y and z components of the vector. The result is almost perfect. You probably can't tell unless you are toggling back and forth, but the displacement heightwise (in y) is prefect. But its a bit off in the x and z slightly.

I should mention this works in mantra with the principled shader. If I set the displacement texture to vector and space to world or object space (not tangent).

Any tips/suggestions?
Edited by evanrudefx - Aug. 28, 2022 21:55:59

Attachments:
spectrum.jpeg (272.7 KB)
displace.jpeg (300.5 KB)
displace_yx.jpeg (356.6 KB)
mix.png (34.7 KB)

Thanks,

Evan
User Avatar
Member
8525 posts
Joined: July 2007
Online
try: +x -z +y
I mean just guessing, but since it looks like that mtlx displacement expects tangent space vector and I assume your UVs are aligned along +x and -z, and N points in +y, it could in theory work
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
220 posts
Joined: Feb. 2016
Online
tamte
try: +x -z +y
I mean just guessing, but since it looks like that mtlx displacement expects tangent space vector and I assume your UVs are aligned along +x and -z, and N points in +y, it could in theory work
Oh, if it expects tangent space for vector displacement, then it probably won't work 100% because I believe the ocean spectrums output is either object space or world space. If I use mantra to render this grid and set to use vector displace and use object space it works. But it doesn't work in tangent space.
Thanks,

Evan
User Avatar
Member
8525 posts
Joined: July 2007
Online
As I mentioned since your grid and UVs are aligned with world space you should be able to find matching tangent space just by shuffling the axes

Did you try what I mentioned?
If it didn't work it may be different axes/directions but should be easy to find match
Edited by tamte - Aug. 28, 2022 23:29:13
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1 posts
Joined: Aug. 2022
Offline
<h1>Hello</h1> I am new to all of this. How does it work?
User Avatar
Member
220 posts
Joined: Feb. 2016
Online
tamte
As I mentioned since your grid and UVs are aligned with world space you should be able to find matching tangent space just by shuffling the axes

Did you try what I mentioned?
If it didn't work it may be different axes/directions but should be easy to find match

It was more off than my default settings of xzy. Everything I do is close, but nothing is perfect. It should be good enough,however.
Thanks,

Evan
  • Quick Links