Hello,
I recently got vertex colour shading working in my mobile engine as a cheap and easy alternative to lightmapping etc, especially for large outdoor areas.
The only slight problem I've encountered is exporting the data from Max. The amount of vertex colours that are generated when baking vertex lighting data in max is often 3 or 4 times more than the number of vertices. To make things easier and faster, I'd like to have just one colour value per vertex.
In the MaxScript help it even says "Many game engines
still support just one color vertex per mesh vertex. Using MAXScript, it is
possible to develop a utility to reduce the numbers and achieve a one-to-one
correspondence" but doesn't give the slightest clue as to how
My MaxScript knowledge isn't great and I can't figure out how to do this.
Do any of you have experience with vertex colours and happen to know how to do this? I'm kind of amazed it isn't an option in the Assign Vertex Colors utility actually, given they even acknowledge a lot of engines only support a single colour per vertex.
Cheers.
Replies
The last line applies the function to currently selected object, you can just as well loop all the geometry in scene instead or loop multiple selected objects instead.
Cheers.
I don't suppose you have or know of a script to dynamically split/detach a mesh into smaller chunks (from a uniform grid for example) do you? I've written something that does this engine side, but it's slow, and again it would be much better if I could do it before exporting.
Let me know if you had something else in mind.
And strangely it doesn't show up by default, you have to go back to the modify panel and the Vertex Paint panel pops up. You then have to click one of the top two buttons "Vertex color display", unshaded and shaded.
A little fiddly like most stuff in Max, but very easy and very fast once you know, much faster than lightmapping.
FYI, the vertex colour channel is actually just channel 0, ie the one before default UVs
Thanks again to Swordslayer, I modified my exporter with the above script, and now Vertex Colours are showing up perfectly in my engine, and look exactly as they do in Max.