Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Turning off Shadow Casting Mode for one entity

Discussion in 'Graphics for ECS' started by DeepDiveFestival, Jul 27, 2023.

  1. DeepDiveFestival

    DeepDiveFestival

    Joined:
    Jul 4, 2023
    Posts:
    2
    Is there a way to change the Shadow Casting Mode for one specific entity? Currently I am working on a project where we try to disable the mesh of an entity (and all children), only leaving the shadow behind, which is why turning the Shadow Casting Mode to Shadows Only would be optimal, but since it is a shared component it would move the entity to a different chunk. Is there a way to disable the mesh and only leave the shadow behind in a more efficient manner?
     
  2. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    677
    If it's just one entity, that's just one more chunk.

    If it's a bunch of entities, it's still just one more chunk(type).

    Do you think this needs optimization?
     
  3. DeepDiveFestival

    DeepDiveFestival

    Joined:
    Jul 4, 2023
    Posts:
    2
    Yeah I was thinking of a more "ecs-like" way to handle the problem, since moving entities to different chunks all the time does not seem to be the most productive way of working with ecs.
    I do have the chunk-moving-method for now and the performance is still great, but if something "better" comes up I would rather take that.
    Thank you for the answer!
     
  4. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,008
    I don't believe there is currently anyway to do this without modifying or replacing the culling pipeline of Entities Graphics. I've personally replaced the culling pipeline, and it would be pretty easy to add support for what you want to do. However, I'd probably have to give you support as a one-off mod as it is a fairly niche use case and comes with some performance overhead (albeit smaller than your alternative).