Home Technical Talk

Autodesk 3ds Maxscript Proper Vertex Colors And Texture Coordinate Conversions (For Vertices Only)

polycounter lvl 6
Offline / Send Message
MrQuetch polycounter lvl 6
Hello, everyone and anyone who is willing to help. I posted a similar topic awhile ago for GML model conversions, and have subsequently been able to port those models to GML - thanks to the help of the user "monster". I am now porting my models to other gaming consoles, and have been able to export every model in the past just fine. However, I am running into some new problems. Before, my models would be exported in separate triangles with individual vertex positions for those triangles. This works for some video game systems, but not others. I want to be able to solve this problem for the other systems.

Before, I would get the face from the mesh, and then print out all of the information for that face - vertex positions, texture coordinates, colors, etc. What I want to do now is get all of the vertex elements from the mesh instead of doing it by only faces. I can get the vertex positions printed accurately, but the colors refuse to get formatted correctly. How can I get the correct vertex color from the actual vertex the color belongs to? Similarly, how can I get the right texture coordinates? I have already tried "GetVertColor", and "GetTVert" with no success. Unfortunately, I'm not able to progress at this point.

I have searched in many other places, and still cannot get the help I need. Any at all is greatly appreciated.

Replies

  • Swordslayer
    Offline / Send Message
    Swordslayer interpolator
    In general, map vert coordinates: meshop.getMapVert obj channelID textureVertID
    vertex colors: meshop.getMapVert obj 0 colorVertID -- multiply by 255 if you don't want 0-1 range

    Note that vertex indices will match geometry indices only in some cases, there can be many mapVerts per one geometry vertex as well as one mapVert that can be used for multiple verts. If that's the case, you can go face by face and for all the faceVert indices get the matching mapVert indices.
  • MrQuetch
    Offline / Send Message
    MrQuetch polycounter lvl 6
    In general, map vert coordinates: meshop.getMapVert obj channelID textureVertID
    vertex colors: meshop.getMapVert obj 0 colorVertID -- multiply by 255 if you don't want 0-1 range

    Note that vertex indices will match geometry indices only in some cases, there can be many mapVerts per one geometry vertex as well as one mapVert that can be used for multiple verts. If that's the case, you can go face by face and for all the faceVert indices get the matching mapVert indices.
    Thanks, Swordslayer.

    I managed to solve my problem. I didn't use the code that you suggested, but I will keep that in mind for when I absolutely need it most. Again, thank you for pointing me in the right direction.
Sign In or Register to comment.