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

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:
    705
    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,295
    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).