Search Unity

Question How can I blend more than 4 textures in PolyBrush?

Discussion in 'World Building' started by suppertbw, Sep 26, 2021.

  1. suppertbw

    suppertbw

    Joined:
    Mar 16, 2016
    Posts:
    34
    Code (CSharp):
    1.  
    2. float div = 1.0/((IN.color.r+IN.color.g+IN.color.b+IN.color.a) + (IN.UV4.r+IN.UV4.g+IN.UV4.b));
    3.              
    4. float3 finalCol = mainCol*IN.color.r + tex1Col*IN.color.g + tex2Col*IN.color.b + tex3Col*IN.color.a + tex4Col*IN.UV4.r + tex5Col*IN.UV4.g + tex6Col*IN.UV4.b;
    5. finalCol *= div;
    6.  
    I use this piece of code to blend 7 textures in PolyBrush. However, I can't brush sixth or seventh texture. Even if I select the texture, it still brushes fifth texture's color. I've read the document and it said "we can use all of the [ UV0, UV2, UV3, UV4, Color, Tangent ] attributes to apply textures". In reality, it seems not.
     
  2. suppertbw

    suppertbw

    Joined:
    Mar 16, 2016
    Posts:
    34
    Eventually I found it!
    Do not use surface shader, then everything is working!