Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug MaterialProperty Components are not working on both HybridRenderers V1 & V2

Discussion in 'Graphics for ECS' started by Opeth001, Jul 15, 2020.

  1. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,112
    Hello Everyone,

    im not sure why but adding the MaterialProperty Component is not working on both HybridRenderers V1 & V2.
    im using the official MaterialColor class from the hybrid renderer package.

    Thank you!
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,734
    probably going to need a bit more info than that

    unity version, the render pipeline, the shadergraph you're using, etc
     
    Opeth001 likes this.
  3. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,112
    im using :
    Unity 2019.4.3f1
    Universal Renderer Pipeline
    SimpleLit
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,734
  5. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,112
    im using
    Unity 2020.1.0b16
    im using the Latest URP version 9.0.0-preview 35
    hybridRendererV2 (0.5.2) is enabled, ( this line is debuged each time close the subscene Hybrid Renderer V2 active, MaterialProperty component type count 53 / 128 )
     
  6. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,112
    i just found new things

    1) the component MaterialColor is using the "_Color" shader property which is deprecated also when i try to see if this component is correctly added to the entity by filting them inside the Entity debugger, it seems like the component is duplicated.



    2) i created my own MaterialColorPropertyAuthoring using the new shader Property "_BaseColor" . but for no reason this one is not being added to the Entity in the Conversion workflow.
    Note the same authoring script correctly adds the MaterialColorProperty cd to the entity in Unity 2019.4

    Code (CSharp):
    1. [Serializable]
    2. [MaterialProperty("_BaseColor", MaterialPropertyFormat.Float4)]
    3. public struct MaterialColorProperty : IComponentData
    4. {
    5.     public float4 Value;
    6. }
    7.  
    8. [RequireComponent(typeof(Renderer))]
    9. public class MaterialColorPropertyAuthoring : MonoBehaviour, IConvertGameObjectToEntity
    10. {
    11.     public Color color;
    12.  
    13.     public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    14.     {
    15.         var colorProperty = new MaterialColorProperty { Value = new float4(color.r, color.g, color.b, color.a) };
    16.         dstManager.AddComponentData(entity, colorProperty);
    17.     }
    18.  
    19. }
     
    Last edited: Jul 16, 2020