Script for detecting unassigned Effect IDs

Hi everybody!

At the moment we are working on a big full CG project where we unfortunately need a shitload of Multimattes (vray). And as Artists not always consider putting IDs for everthing the renderings often miss some IDs or multiple Objects share the same ID or whatever.

We are using GBuffer, Effect ID Channels and the Vray effect IDs. So, huge mess so far.

So I started writing a script that lets you pick all objects that share the same GBuffer and that share the effect ID. Also with the possibility to select all objects which have no GBuffer and no effect ID at all.

Worked pretty well so far in testing scenes but then came the big "fuck, I didn't consider that" moment. We're using a lot Multi/Sub Objects and theres the problem.

for gbuffer and effect id I was using lines like this:
////
for o in objects where o.gbufferchannel == IDNR do selectmore o

for o in objects where o.material.effect_id == IDNR and o.material.override_effect_id == on do selectmore o
////

but when the Multisub comes in, i have the problem, that multiple objects have the multisub, connected by Material ID, so theres no way to acces the shader by
$.material.effect_id

so the result is an error, that the effect ID is undefined for the selected shader (the multisub). What a surprise :D

I'm sorry I'm not to good at scripting and I'm really destroying my head with this.
So is there a way to check if the shaders of a multisub have effect ID's and select the objects that are using those shaders? Or some workaround? Perhaps highlighting the shaders without Effect IDs in the SME? I hope this was not too confusing.

Thank you a lot,
and have a great day!

Alex

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
triff's picture

EffectsChannel Set

Have a look for 'EffectsChannel Set', exactly what I was after.

'V-Ray MultiMatte / Object ID Manager' and 'Material ID Organizer' do the job for ObjIDs and Mat/EffectsIDs respectively, but the first one does them all.

Tried to post links but the spam filter blocked me, all are on Scriptspot.

Chief Pixel Bully | http://triff.co

kernberg's picture

Hi, Thanks for your reply! I

Hi, Thanks for your reply!

I already iknow the material-id-organizer, but i am trying to understand the scripting behind it and the material organizer is also not taking a look at the gbuffer id's.

Thanks :)

pixamoon's picture

`

oki, oki

I'll do later Organizer for all IDs but for now try this:
It will select all objects with material ID = 0 and objects without material.

for o in objects do (
	--if o.gbufferchannel == 0 do selectmore o
	if o.material == undefined then 
		selectmore o
	else
		if classof o.material != Multimaterial then 
			if o.material.effectsChannel == 0 or ( classof o.material == VrayMtl and o.material.effect_id == 0 and o.material.override_effect_id == on ) do selectmore o
		else 
			for i = 1 to o.material.numsubs where o.material.materialList[i] != undefined do (
				if o.material.materialList[i].effectsChannel == 0 or ( classof o.material.materialList[i] == VrayMtl and o.material.materialList[i].effect_id == 0 and o.material.materialList[i].override_effect_id == on ) do selectmore o
				)
)

This is only simple code how to go deeper in multisubmaterials

kernberg's picture

Hi, Thanks for your reply! I

Hi, Thanks for your reply!

I already iknow the material-id-organizer, but i am trying to understand the scripting behind it and the material organizer is also not taking a look at the gbuffer id's.

Thanks :)

pixamoon's picture

`

try Material ID Organizer :
http://www.scriptspot.com/3ds-max/scripts/material-id-organizer

it has also possibility to assign up to 255 standard MatIDs

Best,
Pixamoon

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.