Announcement

Collapse
No announcement yet.

Help Regarding Glass Shading with transparency maps and Two Sided!

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

    Help Regarding Glass Shading with transparency maps and Two Sided!

    I have a material/shader which represents glass with raindrops ontop of it.
    The problem with this shader is that it only works one sided, and I want it to be two sided.

    As of now, if I check two sided the material becomes extremely dark on one side and you can't look through it.


    My problem is that I want the material to be seen from all angles, and on the other side that the normals of the raindrop's green channel to be flipped.


    How do I achieve this, without doing it the hacky way by creating two planes ontop of eachother with normals facing different ways?


    Windows isn't letting me upload attachments now, i'll upload them as soon as windows lets me!

    EDIT:

    Oke here are the screenshots and a gif, i waited for the approval to upload them!

    Attached Files
    Last edited by PotatoShield; 09-17-2018, 02:59 AM.

    #2
    I was not able to reproduce the "becomes extremely dark on one side and you can't look through it" problem.
    However, you can fix the normal map issue by using a "lerp" with a "twosidedsign" as the alpha input. Use this lerp to switch between flipped and nonflipped normal map.

    Comment


      #3
      Having the actual geometry contain two overlapping polygons facing opposite directions is not "hacky", it's the better way to do it. When you use two-sided materials the geometry needs to be rendered twice.

      Comment


        #4
        Originally posted by Manoel.Neto View Post
        Having the actual geometry contain two overlapping polygons facing opposite directions is not "hacky", it's the better way to do it. When you use two-sided materials the geometry needs to be rendered twice.
        This is not true. Having two overlapping polygons will double the geometry and vertex shader cost. Using two-sided material just disables back face clipping and will not render anything twice.

        Comment


          #5
          Originally posted by somawheels View Post
          However, you can fix the normal map issue by using a "lerp" with a "twosidedsign" as the alpha input. Use this lerp to switch between flipped and nonflipped normal map.
          UE4 already does that for you internally, if you are using tangent space normals in material.

          Comment


            #6
            Originally posted by somawheels View Post
            I was not able to reproduce the "becomes extremely dark on one side and you can't look through it" problem.
            However, you can fix the normal map issue by using a "lerp" with a "twosidedsign" as the alpha input. Use this lerp to switch between flipped and nonflipped normal map.
            I uploaded some screenshots of my material and a gif, maybe that helps?

            Comment


              #7
              Originally posted by Kalle_H View Post

              This is not true. Having two overlapping polygons will double the geometry and vertex shader cost. Using two-sided material just disables back face clipping and will not render anything twice.
              Indeed it doubles the drawcalls if i'm not mistaken.

              Comment


                #8
                Originally posted by Deathrey View Post
                UE4 already does that for you internally, if you are using tangent space normals in material.
                Can you explain in greater detail, on how to set this up?
                Since i'm sure UE4 does not auto detect which side needs to flip the green channel of the normal map.

                Comment


                  #9
                  Originally posted by PotatoShield View Post

                  Indeed it doubles the drawcalls if i'm not mistaken.
                  It does not.

                  Comment


                    #10
                    Originally posted by PotatoShield View Post

                    Can you explain in greater detail, on how to set this up?
                    Since i'm sure UE4 does not auto detect which side needs to flip the green channel of the normal map.
                    GPU has built in flag SV_isFrontFace. When two sided rendering is used pixel normal is multiplied with MaterialParameters.TwoSidedSign which is negative when pixel that is rendered is from backfaced triangle. Normal map does not have anything to do with this. Remember that normal calculation can be arbitary.

                    Comment


                      #11
                      Originally posted by Kalle_H View Post

                      GPU has built in flag SV_isFrontFace. When two sided rendering is used pixel normal is multiplied with MaterialParameters.TwoSidedSign which is negative when pixel that is rendered is from backfaced triangle. Normal map does not have anything to do with this. Remember that normal calculation can be arbitary.
                      yes but what I want in this material, is that I can choose or tell UE4. to flip the green channel, on the side that's being double sided.
                      If I want this for the hacky way, i just duplicate the texture and flip it's green channel that way. but i don't want to do that because it's busy work and hacky.

                      Comment


                        #12
                        Originally posted by Kalle_H View Post

                        It does not.
                        how does duplicating an object with a different material, not increase draw calls?

                        Comment


                          #13
                          Originally posted by PotatoShield View Post

                          yes but what I want in this material, is that I can choose or tell UE4. to flip the green channel, on the side that's being double sided.
                          If I want this for the hacky way, i just duplicate the texture and flip it's green channel that way. but i don't want to do that because it's busy work and hacky.
                          Sorry I understood wrong.

                          Correct way to do it is using twosidedsign node.
                          https://docs.unrealengine.com/en-us/...s#twosidedsign

                          Comment


                            #14
                            Originally posted by Kalle_H View Post

                            Sorry I understood wrong.

                            Correct way to do it is using twosidedsign node.
                            https://docs.unrealengine.com/en-us/...s#twosidedsign
                            Aah oke i will try that one out!

                            Comment

                            Working...
                            X