PDA

View Full Version : Soft Selection to Vertex Colours.


DaveWortley
12-07-2008, 02:14 PM
So you've got some nice procedural effects working via volume selection, soft selections etc. But then in comp you need a mask. So how do you render the soft selection?

Well as far as I can tell this is the only way? Please tell me if I'm wrong.

(change Box01 to anything u like)
First run this.
channelInfo.addChannel $Box01


Then add a pre-render script.
channelInfo.CopySubChannel $Box01 2 0 0

channelInfo.PasteSubChannel $Box01 3 2 0
channelInfo.NameSubChannel $Box01 3 2 0 "-none-"
channelInfo.PasteSubChannel $Box01 3 2 1
channelInfo.NameSubChannel $Box01 3 2 1 "-none-"
channelInfo.PasteSubChannel $Box01 3 2 2
channelInfo.NameSubChannel $Box01 3 2 2 "-none-"

Then add a material with Vertex Color map in diffuse, and set to map 2. self illum 100

Or have I totally missed something?

DaveWortley
12-08-2008, 01:25 PM
Ok I need some pretty urgent help working out why this won't work when rendering multiple frame sequences.

Any ideas?

ZeBoxx2
12-09-2008, 12:56 AM
1. A pre-render script is only called at the beginning of the sequence, not for each frame. You'd want to look into adding a #preRenderFrame or #preRenderEval for that.

2.a Even with that, you may not be allowed to change vertex colors in those stages of the render progress. Only way to find out is to try.
2.b Which I just did, and although it 'works' (prerendereval, tried prerenderframe and max complained about missing uvw channel 2 and crashed), you need to...

3.a Redraw your viewports at the time of the render.. e.g. sliderTime = currentTime, make sure the viewport redraws.
3.b Or figure out some other way to get the copy/paste UVW bit to recognize the changed selection

btw, the code 'as is' seems to generate a ton of copy/paste modifiers, slowing down a render progressively.. may wish to add clean-up code to remove them when done at each frame.

ZeBoxx2
12-13-2008, 12:34 AM
out of curiosity - did you get this working to satisfaction?

DaveWortley
12-13-2008, 01:25 AM
Yeah I did. I had to write my own Render script to make it work.

Luckily the object envolved was a Cube so I could disable all the other modifiers make 6 cameras and then in Fusion render these on the UV layouts to be able to put the map back on the object again.

I simply didn't have enough time to work out how to Render to Texture using maxscript how I would have liked to... :( Would loved to be filed in.

To avoid the multiple UV Channel modifier problem, I simply added 3 before I ran the script and got the script to delete the first three before adding them again.

My script was very very slow with my volume select that I was using, but would like to hear if there's any way I can improve my script.


for i = 0 to 80 do --FRAME RENDER SEQUENCE LOOP
(

sliderTime = i --get Current time
at time i
(
--Get rid of old modifiers with Vert Data in
deleteModifier $CUBE_MORPHER 1
deleteModifier $CUBE_MORPHER 1
deleteModifier $CUBE_MORPHER 1

--Copy the vsel data channel to the r, g and b channels, (in hindesight I could have just used one channel and selected the channel in Fusion, which should improve performance)

channelInfo.CopySubChannel $CUBE_MORPHER 2 0 0
channelInfo.PasteSubChannel $CUBE_MORPHER 3 2 0
channelInfo.NameSubChannel $CUBE_MORPHER 3 2 0 "-none-"
channelInfo.PasteSubChannel $CUBE_MORPHER 3 2 1
channelInfo.NameSubChannel $CUBE_MORPHER 3 2 1 "-none-"
channelInfo.PasteSubChannel $CUBE_MORPHER 3 2 2
channelInfo.NameSubChannel $CUBE_MORPHER 3 2 2 "-none-"

--Render Script
frameN = formattedPrint i format: "04d"
path = ("c:/TEST/TEXMAP_CAM1_" + frameN + ".tga")
bm = Render frame:i camera:$Camera01 vfb:false progressbar:true
bm.filename = path
Save bm


--Clean up
gc()

)
)

PiXeL_MoNKeY
12-13-2008, 02:31 AM
Writing your own tool to do what a freeware plugin already does. Try Grant Adam's Blur Vertex Color (http://www.rpmanager.com/plugins/BlurVColor.htm) (NOTE: feature only available with 2009).New feature for 2009 version - can convert a stack vertex selection to vertex colours (allowing it to be used as a mask in a material etc.). UI snapshot and quicktime demo below.-Eric

DaveWortley
12-13-2008, 07:35 PM
Nice, but we use 3dsmax 9, so would have been a headache to deal with anyway, but will bare it in mind next time. Thanks!

Has anyone used it, is it fast?

CGTalk Moderation
12-13-2008, 07:35 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.