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

3dsmax - FBX: Vertex colors

Discussion in 'Asset Importing & Exporting' started by holmeren, Jun 12, 2008.

  1. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Hey
    I need to be able to get the vertex color through code think its called:"mesh_colors", but I havent succeeded. "Mesh_color" keeps finding... zip! Any ideas how to get vertex color info into Unity.
    I have tried map channel 1-2-3 in max.

    Cheers
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    I'm not sure I understand the question...

    You want to access vertex colors of a Mesh from a script? That would be Mesh.colors
     
  3. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Hey
    Yes... but mesh.colors (sorry) dont find any so it must be that my export is wrong, I think.
    (Im not the one scripting ;))

    Thanks
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    So apparently the vertex colors are not coming through. You could try this shader to visualize vertex colors:
    Code (csharp):
    1. Shader "!Debug/Vertex color" {
    2. SubShader {
    3.     Pass {
    4.         Fog { Mode Off }
    5. CGPROGRAM
    6. #pragma vertex vert
    7.  
    8. // vertex input: position, color
    9. struct appdata {
    10.     float4 vertex;
    11.     float4 color;
    12. };
    13.  
    14. struct v2f {
    15.     float4 pos : POSITION;
    16.     float4 color : COLOR;
    17. };
    18. v2f vert (appdata v) {
    19.     v2f o;
    20.     o.pos = mul( glstate.matrix.mvp, v.vertex );
    21.     o.color = v.color;
    22.     return o;
    23. }
    24. ENDCG
    25.     }
    26. }
    27. }
    I just tried creating a teapot in 3dsmax 2008, painted some crappy vertex colors on it, exported, and it did import with colors into Unity just fine.
     

    Attached Files:

  5. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Super Aras, thanks...
    What channel did you use in max (look in the vertex paint modifier)
    Are you using editmesh or editpoly?
    I dont understand why I cant get the vertex color info from max to Unity...

    CHeers
     
  6. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    1. created a teapot, 2. applied vertex paint modifier, 3. painted something.

    I don't remember which channel I did use (whatever was the default), and I did not use edit mesh or edit poly (though I don't see a reason why those should have any affect).
     
  7. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    well I just read in an old post that edit mesh or a maxs premade objects such as a teapot/sphere/box (primitives) was needed to get vertex color through to Unity.
    I cant find that post now....

    I have done excatly the same as you did but was told that there no vertex color info.....
    But I will try a again later (home with kids, damn strike!)