setMapVert not showing color changes in viewport

setMapVert not showing color changes in viewport

tagopinath
Enthusiast Enthusiast
601 Views
1 Reply
Message 1 of 2

setMapVert not showing color changes in viewport

tagopinath
Enthusiast
Enthusiast

Hello Everybody,

 

3ds Max SDK :

I have a mesh object created using the Mesh class. I am trying to set face colors using setMapVert for the mesh. 

 

I found some code in MaxScript (https://forums.cgsociety.org/t/vertex-color-in-viewport-max-2009/1563863/4), when I tried this without converting into either poly or mesh, then colors changes are not happening. If I convert my mesh into poly or mesh, then, the script is working fine. 

 

I tried to implement this using SDK, but i am getting the same result which i got while running the script (not converting to poly or mesh)

 

The following codes, added as a script (for testing)

 

setCVertMode $ on
$.vertexColorType = 5
$.vertexColorMapChannel = 1
meshop.setmapsupport $.mesh 1 on
meshop.applyuvwmap $.mesh #face channel:1

 

The following, i have added in sdk.

 

the_mesh.setMapVert(1, the_mesh.faces[fIdx].v[0], clr);
the_mesh.setMapVert(1, the_mesh.faces[fIdx].v[1], clr);
the_mesh.setMapVert(1, the_mesh.faces[fIdx].v[2], clr);

 

I am updating the mesh and calling redrawviews also.

 

Is this the method of implementing? What i am doing wrong?

can anyone please suggest me ideas how to implement this logic?

 

Regards,

Gopinath.

0 Likes
Accepted solutions (1)
602 Views
1 Reply
Reply (1)
Message 2 of 2

tagopinath
Enthusiast
Enthusiast
Accepted solution

Hello,

 

I was able to solve this. No need for below two lines

 

meshop.setmapsupport $.mesh 1 on 
meshop.applyuvwmap $.mesh #face channel:1

 

and, i need to change the mapping channel (say, some 6 or 7) and for that, i need to set texture vertices and set default color.

the other codes mentioned, works fine.

 

Thanks again.

Regards,

Gopi.

0 Likes