Announcement

Collapse
No announcement yet.

How to prevent masked material affect shadow rendering from dynamic light setup?

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

    How to prevent masked material affect shadow rendering from dynamic light setup?

    Hello, is there anyway to prevent the masked part of the material affect the shadows of the object? Basically i want the object to cast the shadow as if it were completely opaque

    https://unrealengine.com/marketplace/en-US/profile/MKM

    #2
    You can use #IF SHADOW_DEPTH_SHADER pre-processor directive in custom node to separate material graph for shadow depth shader and keep it fully opaque there.
    I think in newer engine versions it is already included as material expression.

    Comment


      #3
      That did the trick, thank you so much!
      https://unrealengine.com/marketplace/en-US/profile/MKM

      Comment


        #4
        Hey,
        I have the exact same problem. I'm quite new to this more advanced Material Stuff, I never coded a single line in my life and I just can't make it work. Can someone please describe what to do here a little more detailled?
        Thank you very much!

        Marvin

        Comment


          #5
          Yeah, there's a newish node in the editor called Shadow Pass Switch, so custom code is no longer needed. It works like any other switch. "Default" is the runtime/visible material feature and the "Shadow" input is what you want the material to do when the mesh is redrawn for the dynamic shadow pass.

          Keep in mind the shadow mesh shader is relatively simple, so Opacity Mask and World Position Offset are the only inputs that have an affect. But you can use it for some pretty cool things
          Lighting Artist @ Rockstar Games
          ArtStation
          Twitter

          Comment


            #6
            Hey, thanks for the help but I'm obviously doing something wrong and I just dont know what.
            This is my current Setup. Shouldnt the Opacity on the Shadows be completely solid? Cause it's just behaving like the ShadowPassSwitch node isn't even there.

            Thanks
            Marvin

            Click image for larger version

Name:	DepthFade_debug_001.jpg
Views:	449
Size:	92.4 KB
ID:	1740500

            Comment


              #7
              Wouldn't the value need to be 0 instead of 1 because it's then interpreted at dynamic shadow pass as a non-opaque shadow?

              Comment


                #8
                No, if the value would be wrong the shadow wouldn't be existing at all if I'm correct. But its behaving like the ShadowSwitch wouldn't even be there. But It cuts out the Alpha.
                Tried inverting it anyway, but didn't work.

                Cheers,
                Marvin

                Comment


                  #9
                  Originally posted by Marvin Tischler View Post
                  Shouldnt the Opacity on the Shadows be completely solid?
                  Opacity mask of material in shadow pass is not correlated with opacity of shadows in any meaningful way.

                  Comment


                    #10
                    Works for me in 4.24. Make sure you're using Cascaded Shadow Maps, since this won't work for baked, Distance Field, or screen space shadows.

                    Click image for larger version

Name:	shadow.JPG
Views:	456
Size:	248.9 KB
ID:	1741227
                    Last edited by rosegoldslugs; 04-03-2020, 02:19 PM.
                    Lighting Artist @ Rockstar Games
                    ArtStation
                    Twitter

                    Comment


                      #11
                      Solved it! I was completely going mad here cause I couldn't figure out what it is. In the end Raytracing had to be disabled in the Project Settings in order for it to work.

                      Thanks for the help guys!
                      Much love

                      Comment

                      Working...
                      X