Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / SDK / Getting the full vertex color RGBA
  RSS 2.0 ATOM  

Getting the full vertex color RGBA
Rate this thread
 
34007
 
Permlink of this thread   Subscribe to this thread
avatar
  • pmsimard
  • Posted: 03 September 2009 03:04 AM
  • Location: Montreal
  • Total Posts: 34
  • Joined: 27 August 2006 02:28 PM

Hi,

I’m trying to get the vertex color information that was painted using the VertexPaint modifier but that as been collapse.

I manage to get the RGB information but I’m missing the Alpha value.

here is a part of the code:
I export face by face and i get the info from a trimesh

for(int vert 0vert 3vert++)
{
    
// Vertex Color
    
p4_vcolor[vert].0.0f;
    
p4_vcolor[vert].0.0f;
    
p4_vcolor[vert].0.0f;
    
p4_vcolor[vert].1.0f;

    if 
(bExportVColor)
    {
       int i_vcolor 
p_trimesh->vcFace[i].t[vert];
       
p4_vcolor[vert] =  p_trimesh->vertCol[i_vcolor];
    
}
}

This works but unfortunately it return me only RGB info so the fourth value get back to 0.0

I tried changing

p_trimesh->curVCChan = -2;

and then getting the vertCol again but it just give me the same thing as when I am on

p_trimesh->curVCChan 0;

Any idea…

Thanks



Replies: 0
avatar
  • Hybrid666
  • Posted: 30 September 2009 03:36 AM

Hi,

it’s stored separately:

TVFace* alphaFaces = rMesh.mapFaces(MAP_ALPHA) // MAP_ALPHA or MAP_SHADING
UVVert* alphaVerts = rMesh.mapVerts(MAP_ALPHA) // only the x/u coordinate used

float Alpha = 1.0f;

if (alphaFaces)
{
int AlphaIndex = alphaFaces[FaceIndex].t[VxIndex];
Alpha = alphaVerts[AlphaIndex].x;
}

that should do it :)



Replies: 0
avatar
  • pmsimard
  • Posted: 30 September 2009 03:49 AM

thanks…

I was looking for the proper mapchannel to read from.

In the end it give me this. The vertex color ID is 0 and the Alpha color ID is -2

BOOL bExportColor p_trimesh->mapSupport(0)
BOOL bExportAlpha 
p_trimesh->mapSupport(-2)

...

if 
(bExportColor)
{
 int i_vcolor 
p_trimesh->mapFaces(0)[i].t[vert];
 
p4_vcolor[vert] =  p_trimesh->mapVerts(0)[i_vcolor];
 
p4_vcolor[vert].1.0;
}

if (bExportAlpha)
{
 int i_vcolor 
p_trimesh->mapFaces(-2)[i].t[vert];
 
p4_vcolor[vert].=  p_trimesh->mapVerts(-2)[i_vcolor].x;
}


Replies: 0
avatar
  • Hybrid666
  • Posted: 30 September 2009 11:23 PM

Yeah, that’s what MAP_ALPHA is defined to :)

See mesh.h for more details:

#define NUM_HIDDENMAPS 2
// indexes for hidden maps are -1-(their position in the hidden map array).
// (These negative indexes are valid for methods such as mapSupport, mapVerts, etc.)
#define MAP_SHADING -1
#define MAP_ALPHA -2



Replies: 0




   
  Settings Choose Theme color: