Announcement

Collapse
No announcement yet.

Object Space NormalMap

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Object Space NormalMap

    Hi there,

    I was wondering if anyone got a material setup for using object-space normal maps?
    My meshes are not deformed (just moved/rotated/scaled) and I want my normal maps to be in object space and I unchecked the "Tangent space normals" in the material so that it uses world-space normals.
    However the lighting rotates with the the object now, which means the normals need to be transformed from object space to world space somehow. I can't seem to figure out how to do this.

    In the material I tried the "Transform Vector" node(local to world) to transform the normals given by the object space normal map(making sure the normals
    are in -1|+1 range) into worldspace but it doesnt work .

    Maybe any of you guys have a clue how to do this correctly or even a working material that uses object-space-normal maps?

    Thank you very much
    Syphorlate

    #2
    Is there a particular reason you want to use object space normal maps?

    Comment


      #3
      I am not sure, but I remember having issues with retrieving local transform with Transform Vector node. Perhaps, you could try using Transform Position node instead.

      Comment


        #4
        Hey , can someone tell me / us what
        (making sure the normals
        are in -1|+1 range)
        means ? I am researching on that topic too, but there is not much to find on that kind of topic. I would greatfully appreciate if you share some insights on that

        Comment


          #5
          Show material graph and how it does not work when you transform normal map from object space to world space.

          Comment


            #6
            Okay, I got it to work.

            I baked an object space normal in Blender, and imported it into UE4

            Click image for larger version

Name:	
Views:	1
Size:	137.9 KB
ID:	1427698

            The compression method in UE4 is set to Vector Displacementmap, not Normalmap, sRGB off.

            Click image for larger version

Name:	
Views:	1
Size:	218.8 KB
ID:	1427699

            This is the material graph, I re-range the normalmap from 0-1 to -0.5,0.5 and invert the blue channel. Then I transform the vector to Worldspace.

            Click image for larger version

Name:	
Views:	1
Size:	104.3 KB
ID:	1427700

            Seems to work!

            Attached Files

            Comment


              #7
              NormalMap compression does not work for other than tangent space normals because it's assumes that z is always positive and reconstruct it from x and y. You still need to multiply normal with 2 to get unit length normal. This isn't strictly needed because engine will normalize the normal for you.

              Comment


                #8
                Hi, 1 year later, I use this forum to document my discovery and to help me in the future so I archive my material here.

                I use Power(X, 0.4574), then no need to uncheck the sRGB all the time, otherwise you may get confused when there are many textures and you forget one of them.
                I transform the normals with the invert of the scale: Multiply(N, Divide(1, Scale_XYZ)).
                Click image for larger version  Name:	Material.jpg Views:	1 Size:	120.8 KB ID:	1621818

                Here is the result:
                Click image for larger version  Name:	Mesh.jpg Views:	1 Size:	57.6 KB ID:	1621816
                Last edited by mandaxyz; 05-20-2019, 01:10 PM.

                Comment


                  #9
                  Originally posted by Kalle-H View Post
                  NormalMap compression does not work for other than tangent space normals because it's assumes that z is always positive and reconstruct it from x and y. You still need to multiply normal with 2 to get unit length normal. This isn't strictly needed because engine will normalize the normal for you.
                  What compression would you use in UE4 for object-space normal maps?

                  Comment


                    #10
                    Originally posted by motorsep
                    What compression would you use in UE4 for object-space normal maps?
                    When saving an Object Space NormalMap texture from Blender for example then the compression is not NormalMap, but it's the default compression.
                    Last edited by mandaxyz; 05-20-2019, 12:31 PM.

                    Comment

                    Working...
                    X