Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Disable or adjust shadow intensity on transparent surface (eg. water)

Discussion in 'High Definition Render Pipeline' started by greatermoss, Oct 4, 2022.

  1. greatermoss

    greatermoss

    Joined:
    Apr 10, 2021
    Posts:
    6
    Look at the attached picture! A tree casts a shadow into a body of water. The water is a plane with a HDRP Lit shader with a Transparent surface.

    1. Can I prevent the lit transparent object from receiving shadow?

    2. Maybe some shadow on the water is cool? Is there a way to adjust the intensity / color of the shadow?

    I took a quick peek at the generated code but could not find anything to help me right now. A thread on Stack Overflow suggested using the keyword _RECEIVE_SHADOWS_OFF, but this seems to be removed from the generated code.

    Any suggestion on alternative approach appreciated :)
    How do you make water? Do you have shadows appearing on the water surface?

    upload_2022-10-4_18-36-15.png
     
  2. boyaregames

    boyaregames

    Joined:
    Jun 23, 2021
    Posts:
    80
    On a plane in inspector there is a checkbox for "recieve shadow" as i remember
    Also you can tweek shadow dim in your Light source
     
  3. greatermoss

    greatermoss

    Joined:
    Apr 10, 2021
    Posts:
    6
    This option is not present in an HDRP Lit Shader.

    Screenshot_20221023_191207.png
     
  4. greatermoss

    greatermoss

    Joined:
    Apr 10, 2021
    Posts:
    6
    A workaround is to make the shader unlit and calculate the light manually. You can do this by transforming the normal information to world vectors, then taking the dot product for the normal vectors and the sun direction. It will work for multiple light sources, as long as they are directional. You just add more input vectors to the shader and evaluate the lighting for each one of them, eg. if you have a sun and a moon.

    Of course, this workaround will not work with points lights and much of other lighting effects.

    upload_2022-10-29_17-2-18.png
     
  5. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,741
    In the material, if you use "premultiply" in blending mode, you can then lower the value of the color to zero to dim the shadow and then you can use whatever alpha value. In fact i think that is the way it should be.
    esf.jpg 2.jpg srg.jpg