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

Directional Lights and HDRP

Discussion in 'High Definition Render Pipeline' started by ahnchin, Jun 10, 2020.

  1. ahnchin

    ahnchin

    Joined:
    Nov 26, 2016
    Posts:
    5
    Hey y'all! I'm having some difficulties with the directional light, and I'd appreciate any help.

    The first issue I'm having is that only one directional light can be active at a time. If I enable any other ones, the first one is immediately overridden. Is there a way to have two directional lights?

    The second issue I'm having is with adding cookies to the directional light. I've managed to get it to project, but since the texture type has to be "default" instead of "cookie", I can't seem to stop the texture from repeating like before by setting it to "spotlight".

    Thanks!
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,211
    What version of HDRP are you using? I just tried adding two directional lights to a scene, and it seemed to work fine in HDRP 7.4, though I do feel like I've seen it mentioned that only one directional light is allowed.

    Anyway, as for the cookie, it seems I can get a cookie-like feel with normal textures by setting the Cookie and the Surface Texture. Not sure if that'll work in your case.

    upload_2020-6-10_12-35-31.png
     
  3. ahnchin

    ahnchin

    Joined:
    Nov 26, 2016
    Posts:
    5
    Thanks for the help and reply! The issue I'm having with the cookie isn't so much that it's not appearing, but rather that it's appearing and tiling itself. I can't seem to get it to only display once. I appreciate your help, though!
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,211
    Well, if it's a directional light, I don't think there's any choice but to tile it. A directional light is effectively infinitely wide, so it doesn't really make any sense to just display the texture "once". For example, let's say you have a large outdoor scene lit by a directional light. The area might be a mile wide. You'd need an impossibly large cookie to apply any reasonable detail to an area like that.

    Unless I'm misunderstanding. Do you have an visual example of what you're trying to achieve?
     
  5. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    936
    Hi,

    >he first issue I'm having is that only one directional light can be active at a time. If I enable any other ones, the first one >is immediately overridden. Is there a way to have two directional lights?

    You can't have more than one directional light casting shadow, but you can have lot of directional lights, as long as only one cast shadow.

    >but rather that it's appearing and tiling itself
    Expected with directional light, guess what you are looking for is local directional light, that we call Box light:
    https://docs.unity3d.com/Packages/c...gh-definition@7.4/manual/Light-Component.html
    (See box shape in spotlight)
     
  6. ahnchin

    ahnchin

    Joined:
    Nov 26, 2016
    Posts:
    5
    Thanks for the help, both of you! I'll give the box light a try. I could be wrong, but I thought in the standard render pipeline, adjusting the cookie type allowed directional lights to have cookies behave the same way as spotlights. I might be completely wrong though, it's been a while since I touched Unity in general. ;) Just wanted to remove some unwanted splotches of light.



    I've tried disabling the shadows in the second light, but it seems to still disable my original light. Though it's really just to add some light and color into the shadows so I think I'll try giving the box light a try. Thanks! :)

     
  7. raghadalghonaim

    raghadalghonaim

    Joined:
    Apr 22, 2020
    Posts:
    54


    Is there any way to overcome the shadows limitations?
    I'm able to sacrifice performance, but I want a multishadow
     
  8. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    441
    @dgoyette how did you create directional flowmap ?
     
  9. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,211
    I think it's just something I downloaded while experimenting with cookies to inform this post. I think it came from this page: https://catlikecoding.com/unity/tutorials/flow/directional-flow/ I'm not actually using it in any of my projects, so I don't know how useful it is. But that's where it came from, anyway.
     
    valarnur likes this.
  10. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    936
    Use Box light instead, they have no limit on shadow (as they don't use cascade)