|
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 = 0; vert < 3; vert++)
{
// Vertex Color
p4_vcolor[vert].x = 0.0f;
p4_vcolor[vert].y = 0.0f;
p4_vcolor[vert].z = 0.0f;
p4_vcolor[vert].w = 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
|
|
|
|
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 :)
|
|
|
|
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].w = 1.0; }
if (bExportAlpha)
{
int i_vcolor = p_trimesh->mapFaces(-2)[i].t[vert];
p4_vcolor[vert].w = p_trimesh->mapVerts(-2)[i_vcolor].x; }
|
|
|
|
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
|
|
|