Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Problem modifying shader to work with Single Pass (instanced) rendering

Discussion in 'Shaders' started by silverduck, Jun 12, 2019.

  1. silverduck


    May 16, 2010
    I'm developing for Magic Leap with Unity 2019.1 and need to use single pass (instanced) rendering and I'm trying to modify a shader that came with a particles asset so that it renders in both eyes instead of just the left eye.

    I followed Unity's guide for single pass instancing, but now I'm getting an error that I don't understand when I try to build. The error reads...

    "Non system-generated input signature parameter (BLENDINDICES) cannot appear after a system generated value."

    and it points to the beginning of the shaders frag function....

    float4 frag(VertexOutput i, float facing : VFACE) : COLOR {

    and the "VertexOutput" struct has been modified as such...

    struct VertexOutput {

    float4 uv0 : TEXCOORD0;
    float4 pos : SV_POSITION;
    float4 vertexColor : COLOR;
    float4 projPos : TEXCOORD1;

    UNITY_VERTEX_OUTPUT_STEREO //This has been added

    If I remove the UNITY_VERTEX_OUTPUT_STEREO line, I no longer get the error that is preventing me from building, but the shader fails to render in both eyes.

    The term BLENDINDICES doesn't appear anywhere in the code.

    I'm hoping that all I have to do is change the order of something, but I haven not been able to figure how.

    I'm not not particularly familiar with shader code so I'm not sure where to go from here. I hope I've provided enough relevant information and would appreciate any guidance or suggestions.
  2. silverduck


    May 16, 2010
    Just to leave an update here. I had a back and forth with the shader's original develop and it looks like he was able to solve the problem by making extensive changes to the shader. He also said he'd be updating the package on the asset store to solve this problem for everyone.
  3. marmosetofdeath


    Jun 29, 2019
    Would it be possible for him to share some information about what the problem was? I'm currently encountering a similar situation.
    jcellswo and SimonDarksideJ like this.
  4. jcellswo


    Aug 31, 2019
    I'm having a similar problem, but it doesn't render in either eye. It just leaves a sort of shadow where the asset with the shader should be.
  5. bgolus


    Dec 7, 2012
    If I remember correctly, the fix for this is to put the value using SV_POSITION at the top of the struct.