Search Unity

Question Optimize Blob shadow by projector

Discussion in 'General Graphics' started by namdao1227, Nov 9, 2023.

  1. namdao1227

    namdao1227

    Joined:
    May 10, 2020
    Posts:
    8
    Because I baked the lighting, I used a projector to display blob shadows for the character. However, when using the projector, I noticed an abnormal increase in batch count, and I'm unsure why there are so many draw call commands, as shown in the two images below. I want to ask if there's a way to optimize this, and if there are alternative methods to fake shadows besides using a projector. Thank you. image (1).png image (2).png
     
  2. tw00275

    tw00275

    Joined:
    Oct 19, 2018
    Posts:
    92
  3. namdao1227

    namdao1227

    Joined:
    May 10, 2020
    Posts:
    8
    I appreciate it. I tried it, and it works quite well on URP. However, my project is using the built-in pipeline, so I'm not sure if there's any other way to optimize or fake shadows.
     
  4. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    985
    The projector requires re-rendering all geometry affected by it. This is because the projected image is rendered using an additional pass. For this reason it's recommended to use it very sparingly or not at all.

    For the BiRP - If you are using deferred rendering then you absolutely should replace it with some kind of decal system. If you are using forward then you might want to look into some other kind of system like using quads and raycasting for blob shadows. The results won't look as nice and could actually be more expensive so, I'd consider doing a simple test case to see if the performance is worth it before fully committing to that. If you're getting the framerate you want with the projectors already then it'll be a lot of extra work for nothing.