PDA

View Full Version : UserScript: AO multipass helper


c-hri
10-28-2005, 03:57 PM
hi folks,

I played around with the new script manager and wrote a short script which should help to improve the AO multipass workflow a bit.
The script walks through all materials in the scene, disables all channels except of the luminance channel. The luminance channel is filled with a plain white color.
So the multipass workflow looks like that:
* run the script
* disable all lights in the scene

copy-paste the script code into the script manager, assign a script name. save it. script can be called via the Plugin menu -> user scripts

Be aware that previous material settings will be lost, its a one-way-ticket. It don't works for the old shaders like danel, etc.
Material updates are'nt displayed immediately (coders: help!)

I know the script is far from being perfect, but hey: it's my first one (for c4d) :)



---------------------------------
vistitMaterial(op) {
if (op == null) return;
// enable luminance
var lum = op->GetChannel(CHANNEL_LUMINANCE);
if (lum) {
var bc = new(BaseContainer);
bc->SetData(CH_BRIGHTNESS,1);
bc->SetData(CH_COLOR, vector(1.0,1.0,1.0));
bc->SetData(CH_MIXMODE,0);
bc->SetData(CH_MIXSTRENGTH,0);
lum->SetContainer(bc);
op->SetChannelState(CHANNEL_LUMINANCE, true);
}
// disable other channels
op->SetChannelState(CHANNEL_COLOR, false);
op->SetChannelState(CHANNEL_TRANSPARENCY, false);
op->SetChannelState(CHANNEL_REFLECTION, false);
op->SetChannelState(CHANNEL_ENVIRONMENT, false);
op->SetChannelState(CHANNEL_FOG, false);
op->SetChannelState(CHANNEL_SPECULAR, false);
op->SetChannelState(CHANNEL_SPECULARCOLOR, false);
op->SetChannelState(CHANNEL_GLOW, false);
op->SetChannelState(CHANNEL_DIFFUSION, false);
op->Update();
vistitMaterial(op->GetNext());
}

main(doc, op){
vistitMaterial(doc->GetFirstMaterial());
}
---------------------------------

JoelOtron
10-28-2005, 05:03 PM
thanks c)hri

This will be very helpful for setting up straight depth pass renders too!

JoelOtron
10-28-2005, 05:14 PM
I am setting up a thread under resources for user scripts.
I've posted this there too along wih some others that have turned up here.

http://forums.cgsociety.org/showthread.php?p=2776293#post2776293

CGTalk Moderation
10-28-2005, 05:14 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.