Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Using Flatkit water with entities

Discussion in 'Graphics for ECS' started by instriker_911, Dec 13, 2022.

  1. instriker_911

    instriker_911

    Joined:
    Mar 31, 2022
    Posts:
    27
    Hi,

    I'm using the Flatkit shaders within my ECS project. It's working well up to now, but now I'm trying to add the Flatkit water shader, but then I get the following error:


    A BatchDrawCommand is using a pass from the shader "FlatKit/Water" that is not SRP Batcher compatible. Reason: "Material property is found in another cbuffer than "UnityPerMaterial"" (_FadeDistance)
    This is not supported when rendering with a BatchRendererGroup (or Entities Graphics). MaterialID (0x5) MeshID (0x1CE) BatchID (0x1)

    Did someone got this kind of error when using 3rd party shaders, and what would be the work around in a case like this?

    Thank yoU!
     
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Shaders need to be SRP Batcher compatible to work with Entities Graphics. If the 3rd party shader author has not written their shader to be compatible, you can try to fix it yourself, or give feedback to the 3rd party author and hope that they fix it.

    In this case, the first thing I would try is see whether this _FadeDistance property could be easily moved inside the UnityPerMaterial constant buffer without otherwise disturbing the shader.
     
    instriker_911 likes this.
  3. instriker_911

    instriker_911

    Joined:
    Mar 31, 2022
    Posts:
    27
    FYI, in that case, after contacting the 3rd party owner on discord, they made me available a version of the shader that is compatible with Entities.
     
    JussiKnuuttila likes this.