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.

MaterialPropertyBlock's SetVectorArray does not work as expected with Standard shader.

Discussion in 'General Graphics' started by pointcache, Nov 23, 2018.

  1. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    570
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,006
    The problem is exactly the same as the one in the thread you linked to.

    The Standard Shader doesn't have the color value setup to be an instanced value. You'll need to write a custom shader to get that.
     
    pointcache likes this.
  3. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    570
    Before i posted i was looking through all the standard shader files and couldnt find any instanced props and was thinking - hey maybe im just stupid, and its in some other files.

    Baffling that its not enabled by default.
     
    Last edited: Nov 23, 2018
    bstockwell likes this.
  4. Smitzo

    Smitzo

    Joined:
    Mar 23, 2019
    Posts:
    10
    What if I make a copy of Standard.shader as for example "MyStandard", add the properties I need in UnityStandardInput.cginc to a UNITY_INSTANCING_BUFFER_START(MyProps), and use UNITY_ACCESS_INSTANCED_PROP(Props, "property") where needed, would it work?
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,006