Search Unity

Question I give up. What is this all about? Pixel shadows bug

Discussion in 'High Definition Render Pipeline' started by p3k07, Oct 15, 2022.

  1. p3k07

    p3k07

    Joined:
    Mar 30, 2014
    Posts:
    10


    It seems when you have a bunch of real time point lights together and their ranges overlap the neighboring light, then this glitch occurs.
    Why?????? Why can it render fine until it hits that one sweet angle that destroys the entire visual feel. Baked lighting is not an option either.
    Please explain what is going on and how to resolve it.
    I swear, every time i pick unity up, the thing just never works as you would expect it too unless you have an infinite pool of indev knowledge.
     
  2. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    Have you tried increasing the punctual light limit on the hdrp asset ?
     
  3. REDACT3D_

    REDACT3D_

    Joined:
    Nov 8, 2020
    Posts:
    222
    wow that is a lot of lights in the scene

    I wonder if the number could be reduced by creating a single light with a cookie cutout for each celling light. so one light for the room rather than 50? are you baking your lights? is that why so many? Or using LOD groups?

    what is the light radius on all of those lights I wonder? are they like 0 to give hard shadows or are they normally casting soft shadows (need a before and after image)
     
  4. p3k07

    p3k07

    Joined:
    Mar 30, 2014
    Posts:
    10
    I played with that but I'm using the High Fidelity asset which already seems to be beefy enough.

    Yup. I've not really spent that much time dabbling with lighting effects before so I don't really know what I'm doing, but I know I must be doing something wrong. I tried using cookies on the lights and glitchy pixel shadows still appear. I don't quite understand what you mean about using one light with a cookie cut out though? I was only able to apply the cookie to all the lights in the scene. Baking takes too long and doesn't give me the same feel as real-time. But maybe I'm doing something wrong there too?
    Not using any LOD groups currently and the light radius' were set to 4.
    I feel like I'm going to need to watch a ton of tutorials on the bloody lighting system just to get this to go away.
    Thanks for the suggestions.
     
    REDACT3D_ likes this.
  5. RevC2

    RevC2

    Joined:
    May 2, 2021
    Posts:
    49
    A bunch? Looks like you have quite some lights. Just to clarify, if you have 1 realtime shadow casting light per lamp, with a big range, you are going in the wrong direction, that's not how good and optimized lighting is usually done. One point light uses 6 shadowmaps (like a cubemap) to create shadows.

    1 - As Redact said, use one spotlight with shadows on and a good cookie texture to cover fair portions of the corridors, you can half the number of lights and having them as spotlights frees up a lot shadowmaps calculation. Then, you can start adding more no casting shadows lights if you need some pool of light here and there to improve visuals.

    2 - If you still want to have one light source per lamp, turn them at least into spotlights pointing down, and have another non casting shadow light illuminate the back part of the spotlight's cone.

    Also, for each light you have control over fade distance, shadows fade distance, those are very important settings.

    BTW, if you master those points above you can even get far better results in terms of artistic results by halving the amount of resources. In no engine you can throw dozens of huge overlapping shadow casting pointlights without having troubles somewhere in the rendering process. Lot of the lighting I see in the screenshot could also be baked.
     
    p3k07 and REDACT3D_ like this.
  6. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    HDRP has a limit of how many lights can overlap in a 32x32 screen pixel tile.
     
  7. RevC2

    RevC2

    Joined:
    May 2, 2021
    Posts:
    49
    Well big part of choosing to go the baked lighting way is to have a picture of how lighting is dynamic in your game. If you shouldn't be able to turn off every light, than baking it's the way to go. First of all, remember that you can be very selective to what bake and what not. Quality will benefit, look at this screenshot, that's really hard to achieve with only realtime lighting

    upload_2022-10-15_14-48-54.png

    Regarding baking times: I don't know the size of your map, but to bake lights in your corridor it shouldn't take more than a couple of minutes with GPU lightmapper.
     
    p3k07 and REDACT3D_ like this.
  8. REDACT3D_

    REDACT3D_

    Joined:
    Nov 8, 2020
    Posts:
    222
    Well, unless you're using Realtime raytracing, lighting is mostly "faked" by the render on the actual textures when they're drawn. One huge mistake new folks always make is spamming lights in a scene. like it's logical right? this is a light blub so it should be a light emitter, right? just seem logical.

    but lighting in game engines is not set up logically like that, it is set up to maximize Realtime
    performance. It's actually a core part of what makes 3d rendering 3d rendering!

    If you have the patience and time, I'd reccomend this video for helping to visualize what's going on.



    HDRP is a little different from URP but once you get used to all the things that change in the settings and such the effect you can get out of the box are worth it imo

    not related to your lights but for example when I would normally use a line render in combination with emition textures and all kinds of mechanisms to simulate a realistic laser beam.. in HDRP can just use a spotlight with the Orthographic Cube shape and a cookie to give the beam roundness.

    See how it reflects on the shiny metal tin can
    Capture.PNG

    Capture1.PNG
    it's actually a better optical solution then faking it with a line render. It'll cast shadows, reflect on metalic or shiny surfaces while also emitting the trail with volumetrics. And with the auto exposure, it even seems to change in intensity with the light. Oh and you can make it any color super easy. Built-in. But because it's a single light that casts shadows, i've got to take this into consideration later on.

    It's worth it to learn HDRP even if the documentation is spotty
     
    Last edited: Oct 15, 2022
    seoyeon222222 and RevC2 like this.
  9. p3k07

    p3k07

    Joined:
    Mar 30, 2014
    Posts:
    10
    Hey those points actually make a lot of sense. I think I'll just make a smaller room to begin with and play with the setups you've suggested. Thank you!
    I also agree on your reasoning for baking the lights too. I need to play around with it more. That screenshot looks glorious. Definitely something I'm aiming for.

    Yup, that's pretty much what I did xD I knew it felt wrong! Thank you for the link too. I'll give it a watch now.

    Thank you again. You guys have given me something more to work with now. If I manage to resolve I'll be sure to update!
     
    REDACT3D_ likes this.
  10. RevC2

    RevC2

    Joined:
    May 2, 2021
    Posts:
    49
    Nice, a good place where to start for light cookies is here

    Also, test different maps and setups, it's always good to practice, but I won't change the design just to accomodate lighting. Keep your corridor as is and try this approach "2 - If you still want to have one light source per lamp, turn them at least into spotlights pointing down, and have another non casting shadow light illuminate the back part of the spotlight's cone" plus cookies.
     
    p3k07 likes this.
  11. REDACT3D_

    REDACT3D_

    Joined:
    Nov 8, 2020
    Posts:
    222
    1.png 2.PNG
    3.PNG
    4.PNG
     
    p3k07 and RevC2 like this.