Inverting normals bricks MDL halp

So I have a weird problem with my free Normal shader.

All it does is use the Normal brick, strips out the Y component, and uses that as a mask. That's cool.

Eeeexcept it seems to get... weird about Normal map. It treats the overall geometry right, and then seems to invert the effect of the normal map. If I set Normal Map to negative, great, the mask looks right but now it's clinging to the tops of... holes. Which is, again, not what I want.

I can fix the problem if I set X or Z scale to negative. So it seems that the Normal map is being 'understood' as the inverse of how it appears.

I tried accessing the Y component of the Normal map, but that ended up looking wacky and broken.

 

Anyone know of a coderly way of effectively flipping the scale like that, or otherwise inverting/rotating/??? the normal?

I tried multiplying the components of the normal by 1 or -1, but the only result that was noticeable was multiplying Y by -1, which simply flipped the whole mess upside down.

(First image is the effect of Snow Cover, which ... wuuut? Second is same thing but X scale is set to 100%. It looks right, but it's suuuuper inelegant to ask people to do that to all their stuff, and it'd be a big problem for figures and posing)

 

NormalWuut1.png
1097 x 881 - 785K
NormalWuut2.png
1097 x 881 - 771K

Comments

  • Oso3DOso3D Posts: 15,042

    Here's a Normal -> Base color example. If you look at it... all the 'bumps' seem reversed from what you'd expect. Doing something similar in 3DL does not do this, the layout of bump normals looks like you'd expect.

     

    ??? The heck?

     

    Normalwuut3.png
    1558 x 881 - 1M
  • hphoenixhphoenix Posts: 1,335
    edited September 2016

    Hmm.  Maybe if you posted a picture of the shader tree (and/or the MDL code) we might be able to figure it out a little easier.  Bump/Normal maps distort the surface normals to achieve their effect, so you might have to re-work how the bump map gets applied (i.e., have the bump map take its normal from the output of your calculations, rather than from the original surface geometry.....)

     

    Post edited by hphoenix on
  • Oso3DOso3D Posts: 15,042

    Well, the MDL is easy to produce the above;

    Bricks/Functions/MDL/state/Normal

    Connect it to Base Color in 'PBR Metallicity Base'. Put in a Normal map. And there you go.

    If I 'invert' the object along one axis (like X scale = -100%), I get the normal values I expect and it still looks right.

    Hrm.

Sign In or Register to comment.