I'm working with models for juiced and have located a 4 byte section that controls how far a vertex will "deform" on impact.
The first 3 bytes [xyz] are always same value per vertex with last byte always 0.
E.g.
55 55 55 00
4f 4f 4f 00 ect.
My assumption is that devs used vertex color to set this value per vertex which would allow some sections of part to deform less or not at all.
Max value of 255 so I think it is int8? Maybe? Still rather new to this so please excuse my ignorance.
I've had a look at maxscript reference site but not finding anything that jumps out as a solution.
Anyone have an example script laying around?
Maxscript - how to import and export vertex color?
-
- Posts: 10
- Joined: Wed Dec 02, 2020 1:16 pm
-
- Posts: 40
- Joined: Mon Sep 15, 2014 5:13 am
Re: Maxscript - how to import and export vertex color?
Here is some example code to help if it can.
Code: Select all
Color_array=#()
for x = 1 to vertCount do (
r = readByte f #unsigned
g = readByte f #unsigned
b = readByte f #unsigned
a = readByte f #unsigned
append Color_array (color r g b a)
)
msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
defaultVCFaces msh
setShadeCVerts msh true
setCVertMode msh true
for j = 1 to UV_array.count do setTVert msh j UV_array[j]
for j = 1 to Face_array.count do setTVFace msh j Face_array[j]
for j = 1 to Color_array.count do setVertColor msh j Color_array[j]
-
- Posts: 10
- Joined: Wed Dec 02, 2020 1:16 pm
Re: Maxscript - how to import and export vertex color?
Hey I was able to get that to work.
how can I handle that on export?
I assume getVertColor but is there any additional code needed to write it back as byte sections?
how can I handle that on export?
I assume getVertColor but is there any additional code needed to write it back as byte sections?
-
- Posts: 10
- Joined: Wed Dec 02, 2020 1:16 pm
Re: Maxscript - how to import and export vertex color?
Also I'm getting vivid colors (yellows,reds,greens) from the values when it should be all shades of greys.
If all color values are the same across rgb I should get shades from white to black only correct?
Edit: the first mesh seems to load colors correctly.
If all color values are the same across rgb I should get shades from white to black only correct?
Edit: the first mesh seems to load colors correctly.