[Closed] Write vertex illumination?
I can’t seem to access the vertex illumination channel.
I’ve written scripts to bake vert colours either to a solid colour:
for i = 1 to numverts do
(
try (polyop.setvertcolor $ 0 i (color 190 190 190)) catch ()
try (meshop.setvertcolor $ 0 i (color 190 190 190)) catch ()
)
And I’ve written a script that bakes a skylight AO onto an object:
AssignVertexColors.ApplyNodes obj vertexPaint:obj.modifiers[#VertexPaint]
However, I want to modify both to access the illumination channel too. Any pointers?
The vertex illumination channel is -1 and the vertex alpha channel is -2.
Ah!
So, instead of:
try (polyop.setvertcolor $ 0 i (color 190 190 190)) catch ()
I just have to use
try (polyop.setvertcolor $ -1 i (color 190 190 190)) catch ()
Genius! Thanks!
Any idea on the AssignVertexColors? The listener is giving me nothing.
Not quite sure what you’re trying to do with the AssignVertexColors… Do you just want to be able to see the colours you assign the verts in the viewport? If that’s the case use this:
$.vertexColorType = #illum
setCVertMode $ true
No, I’ve two different funtions in the same script, both to edit vertex colours. I want to replicate that for the illumination.
Currently they both work with Vertex colours, so this part:
try (polyop.setvertcolor $ 0 i (color 190 190 190)) catch ()
Loops through every vert in a selection of objects that I pass in and sets the vertex colour to a default gray colour. After that I build a skylight and generate ambient occlusion on all objects on my scene. This is where I use the Assign vertex colours to bake this lighting data into my geo.
I do it in two stages because the 190,190,190 is a good base colour to work with and gets baked directly into the object, whereas the AssignVertexColours applies the light bake from the skylight (with radiosity and exposure settings) in a vertex paint modifer, so I can alter the strength, blur a little, paint corrections etc. before I flatten.
We have also started storing a different type of occlusion in the vertex illumination channel, so at the moment I just build the skylight, calculate the radiosity and then manually go to the tools panel and assign that lighting information to the vertex illumination channel.
What I want to do is end up with two buttons in my tool that allows me to back the lighting data into the vertex colour AND and vertex illumination channels.
It doesn’t work using your following script to baking AO to vertex color channel,
AssignVertexColors.ApplyNodes obj vertexPaint:obj.modifiers[#VertexPaint]
Object vertex color turn out is still default white color in stead of AO color.
Seems like only using Assign Vertex Color in Vetex Paint Modifier and ultility does the job.
How can I assign verex color ( AO, not constant color) using script, any solution? Tks.
Thanks.
Did you use C++ or something? Any detail explaination?
It’s impossible to do it using Max Script, isn’t it?
i use AutoIt3 http://www.autoitscript.com/autoit3/
first i used “AutoIt Window Info” to find the button ID: CLASS:CustButton; INSTANCE:33
VertexPaint_Assign.au3 is the source code
just 2 line :
WinActive ( “Command Panel” )
ControlClick ( “Command Panel”, “Assign”, “[CLASS:CustButton; INSTANCE:33]” )
then compile to VertexPaint_Assign.exe
Thanks, it’s interesting workaround.
But,I still perfer to be able handle Assign Vertex Color within my script instead of attached any other patches.
Anyway,here is what I am trying to do to help our artists to create vertex color in MAX,
http://www.scriptspot.com/3ds-max/vertex-color-tools-1
Feel free to try it. It’s sample script,but do hope it helps.