Applying Normal Maps (texture) in Material X...

   6548   14   3
User Avatar
Member
11 posts
Joined: 1月 2021
Offline
Hi guys,

I’m wondering if someone can help me out with this one.

I have a megascans material I’m trying to rebuild in Material X.

For Base Color, Specularity, etc, I use a MtlX Triplanar to apply the textures. I’m using an MtlX Position/MtlX Multiply combo piped into Pos to control the tile size of the textures (thanks Brian). So far so good.

For Normals I’m not entirely sure I’m doing the right thing. I use the same MtlX Triplanar to select the Normal Texture, set the signature to Vector 3 (per the online documentation), then pipe the output into the In of a MtlX Normal Map, then subsequently into the MtlX Standard Surface Normal.

The problem is my model ‘triangulates' in areas and ‘breaks up’ at various seams. In certain areas things look good. In other areas there are clear errors.

Any ideas how to apply a Normal Map when building an MtlX Material? Better yet, does anyone have a working example of a Megascans material ‘converted’ to Material X?

Thanks in advance.
User Avatar
Member
8041 posts
Joined: 9月 2011
Offline
Using a normal map with triplanar mapping doesn't make sense. Normal maps require a well defined tangent space to transform the normal. Triplanar mapping is typically used when there aren't any uv's, which means there aren't any tangents. You could define a tangent space using the projection planes of the triplanar map, but that means each projection would need to compute a shading normal from the tangent normal, and then blend after. Something you could do with a clever shader, but not something built in to materialX.
User Avatar
Member
11 posts
Joined: 1月 2021
Offline
I see..

I guess I'm wondering how Megascans wraps this into their shader, for example when you export from Bridge to Houdini as a Redshift/Triplanar, I can clearly see a Normal there (under Megascan Files).

In any case thanks for the explanation.
User Avatar
Member
8041 posts
Joined: 9月 2011
Offline
Crounder
I guess I'm wondering how Megascans wraps this into their shader, for example when you export from Bridge to Houdini as a Redshift/Triplanar, I can clearly see a Normal there (under Megascan Files).

Redshift might have a triplanar shader for normal maps that handles it correctly.
User Avatar
Member
11 posts
Joined: 1月 2021
Offline
You're probably right!
User Avatar
Member
77 posts
Joined: 10月 2016
Offline
Any resolution for this? i been using normal maps with triplanar before thought its a straightforward thing
User Avatar
Member
158 posts
Joined: 7月 2005
Offline
Did you find a solution?
I see normal texture issues as well when switching to an MtlX Standard Surface material, but the same surface looks totally fine with a USD Preview Surface material and the good old principal one.
User Avatar
Member
21 posts
Joined: 5月 2016
Offline
Old post, but I'll add here for posterity. Set the normal input in the triplanar to Vector 3 > add an mtlxNormalMap node > set to object space > outputs automatically to world space > plug into normal.



In Unreal this can be done with a vector 3 multiply setting R and G to the X strength multiplier and leaving B at /X. Other renderers
just have a strength float built in, but I can't see how to split out the vector 3 in MatX?

This is how I set it up in MatX. Strength effect working as expected.

EDIT: actually it isn't working as expected. Back to the drawing board....
Edited by Danny McGrath - 2024年7月21日 12:54:37

Attachments:
normalX.jpg (101.6 KB)

User Avatar
Member
8041 posts
Joined: 9月 2011
Offline
Danny McGrath
EDIT: actually it isn't working as expected. Back to the drawing board....

MaterialX is lacking the required building blocks to implement this.

Required steps:

  1. Planar projection x3 ✔
  2. get blend weights from normals with respect to planar projection space ✔
  3. compute tangents with respect to a projection ❌
  4. build matrix from row vectors ❌
  5. transform normal using a matrix ✔
  6. blend vectors in world space ✔
  7. surface material accepts world space normals ✔

actually, this might be possible now, I see create matrix nodes and creating the tangent space could be done by projecting the space bivectors to the surface using its normal.
Edited by jsmack - 2024年7月21日 13:29:39
User Avatar
Member
21 posts
Joined: 5月 2016
Offline
I was going to set it up using the Karma triplanar hex shader but the map input doesn't have vector 3 for the normal map.

Thanks for the detailed breakdown. I'll look into the create matrix nodes.

On another note, this may seem like a silly question but how does MatX deal with the simple task of switching the Y swizzle on normal maps? I see that there used to be a nice collection 7 or so normal map related COPs in the old game tools version of the Lab tools, but I assume they are now deprecated?
User Avatar
Member
3 posts
Joined: 3月 2017
Offline
Hi! Just wanted to chime in and say, I was hoping to move to Karma, but the lack of a proper tri-planar workflow is probably the main reason holding me back.

I hope the developers take note, for anyone in an industry like motion graphics, where speed is essential, I'm pretty sure that not having this feature is a huge deal.
User Avatar
Member
40 posts
Joined: 10月 2022
Offline
DiegoCP
Hi! Just wanted to chime in and say, I was hoping to move to Karma, but the lack of a proper tri-planar workflow is probably the main reason holding me back.

I hope the developers take note, for anyone in an industry like motion graphics, where speed is essential, I'm pretty sure that not having this feature is a huge deal.

What about 'Hextiled Texture' and 'Hextiled Triplanar' nodes? They can both output color and normals.

I'm not sure whether the normals are correctly oriented when used. If there are no bugs, it should work out of the box.

For Redshift, there are some OSL scripts for triplanar mapping, but Karma doesn't support OSL for now.
User Avatar
Member
21 posts
Joined: 5月 2016
Offline
Antti1999
DiegoCP
Hi! Just wanted to chime in and say, I was hoping to move to Karma, but the lack of a proper tri-planar workflow is probably the main reason holding me back.

I hope the developers take note, for anyone in an industry like motion graphics, where speed is essential, I'm pretty sure that not having this feature is a huge deal.

What about 'Hextiled Texture' and 'Hextiled Triplanar' nodes? They can both output color and normals.

I'm not sure whether the normals are correctly oriented when used. If there are no bugs, it should work out of the box.

For Redshift, there are some OSL scripts for triplanar mapping, but Karma doesn't support OSL for now.


Yes, you're right, I've just checked it and the Hex triplanar seems to work fine with normals. You can just set the input to 'normals' instead of the usual Vector 3.
User Avatar
Member
3 posts
Joined: 3月 2017
Offline
Antti1999
What about 'Hextiled Texture' and 'Hextiled Triplanar' nodes? They can both output color and normals.

Indeed, they seem to work ok in my tests, but they add a lot more blurred areas, and only work ok with very organic textures. Anything like a stone wall texture, which will look fine on a tri-planar projection, will break on Hex.
User Avatar
Member
21 posts
Joined: 5月 2016
Offline
DiegoCP
Antti1999
What about 'Hextiled Texture' and 'Hextiled Triplanar' nodes? They can both output color and normals.

Indeed, they seem to work ok in my tests, but they add a lot more blurred areas, and only work ok with very organic textures. Anything like a stone wall texture, which will look fine on a tri-planar projection, will break on Hex.

It looks like there's no blending at all on the normal channel. The other channels blend, but the blend slider in the normal node does nothing. The sharp seam is always there no matter what the setting is.
  • Quick Links