Search Unity

2nd vertex color channel from 3ds max

Discussion in 'Shaders' started by Samhayne, Jul 29, 2018.

  1. Samhayne

    Samhayne

    Joined:
    Jun 15, 2009
    Posts:
    45
    Hi guys,

    I'm currently investigating how to make Unity get the data of a 2nd vertex color chanel set in 3ds max.

    So in 3ds max the VertexPaint modifier has this channel setting...



    Can I access these channels somehow from Unity?
    (Google totally lets me down here...)

    If not... then I probably have to put the 2nd vertex color info in some UV channels I guess
    using some MaxScript?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    Map Channel 2 is a UV set. Unity will import it as the second UV on the mesh, however Unity will only get the first two components of any UV for imported meshes, so if you need a second vertex colors you’ll have to spread it out over two UV sets, so ultimately you’ll need to use a maxscript to copy the blue channel into map channel 3.
     
    Peter77 likes this.
  3. Samhayne

    Samhayne

    Joined:
    Jun 15, 2009
    Posts:
    45
    Hello racing snail! :)

    Thank you for you reply.

    That's what I feared... and it sounds like I should rather use channel 4 then in the first place and copy the data from there to the UVs.

    Can you point me to some good site for that information or do you already have a similar script at hand?
    I never wrote a MaxScript so far.
    The closest thing I've found so far and which I'd use as a starting point was some script from YouTube here which as least seems to fiddle around with channels:


    But maybe you got something better...
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    Dealing with vertex colors using 3ds Max are the bane of my maxscript existence. Every geometry type and modifier deals with vertex colors in a different way, and some you can read, but not set color, others can set but not read, some can do both but the data to denote which vertex to read from is totally different from how to set it. And sometime modifiers the way you set the UVs the same way that you set the color, and others it's totally different. Fun times all around.

    I haven't looked at the script you linked to, but hopefully it can get you somewhere.
     
    yzhao105 likes this.
  5. Samhayne

    Samhayne

    Joined:
    Jun 15, 2009
    Posts:
    45
    :-/

    Thank you, bgolus!