Search Unity

Question Render Objects material override with entities? (in URP)

Discussion in 'Graphics for ECS' started by Arnold_2013, Jan 6, 2023.

  1. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    285
    I am trying to do a Material override in a URP "Render Objects" step. (This worked in ECS 0.51, but its not working in ECS 1.0). I can't find anything about it, but maybe its because it is an URP issue combined with the entities renderer...

    Unity 2022.2.1f1, ECS1.0-pre15, URP, in editor

    To give an Idea. The left rock is a "gameobject outside of subscene" receiving 'fakelight'. The right rock is a "converted entity from a subscene" previously this one would also light up :

    FakeLight.PNG


    These are my settings (GameObject, Converted Entity and Render Object) :
    The Layer Mask is FogOfWarObjects, which on the GameObject is Layer 12, and the Entity also shows layer 12.
    Note: The override Material is at element 8 in the RenderArray -> Material List, but its only there because I added a test cube with this material into the sub-scene to make sure the material was available. So it would not be there by default, and it might not be needed to function.

    Although Forward+ would allow more realtime lights, this is a VR game and is currently not an option.

    GameObjectLayer.PNG EntityData.PNG

    URP_Settings.png
     

    Attached Files:

  2. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    285
    So the shader is a transparent shader. And switching the Queue from Opaque to Transparent makes it work for the entities. I guess this makes some sense... But when its in the Transparent Queue the GameObjects don't get the material override....
    The Rocks can all be entities, but for the terrain this is not an option.

    upload_2023-1-9_9-33-30.png

    Just to have a solution for now, I do a separate override for the game objects where the Queue is Opaque... This adds more GPU cost... So any insight is still appreciated.

    upload_2023-1-9_9-40-18.png
     
  3. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Material overrides should work in Entities 1.0, and as far as I know there shouldn't be any intentional difference between Opaque and Transparent in this regard.

    I would recommend checking the scene with RenderDoc with debug symbols enabled, to find out if there is somehow incorrect data being passed to the entity rendering.

    In case it turns out to be a Unity bug, I would encourage you to submit a bug report with a repro project so we can take a look at it.
     
    Arnold_2013 likes this.
  4. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    285
    Reported this as a Bug with small example project on 9th of januari, but its still "open". IN-28290.

    Edit Update : Moved to "InReview" an hour ago :)
     
    Last edited: Feb 3, 2023
  5. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    This issue is confirmed to be a BatchRendererGroup bug. It should already be fixed in 2023.1, and will also be fixed in a future release of 2022.2.
     
    Arnold_2013 likes this.
  6. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    285
    Thank you