View Full Version : UserScript: AO multipass helper

10 October 2005, 02: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_COLOR, vector(1.0,1.0,1.0));
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);

main(doc, op){

10 October 2005, 04:03 PM
thanks c)hri

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

10 October 2005, 04: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.

CGTalk Moderation
10 October 2005, 04: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.