selection loop with a clause

I wonder if someone could point me in the right direction with this:

I have modified a script that converts all scene materials to plain random coloured materials.

I am trying to add a clause, so the script ignores materials that have a refraction colour less than black and/or have refractance map enabled.

The script as I have it is attached (it has been written to function with Vray).

Any help would be massively appreciated!

Thanks

Danny

AttachmentSize
channels.ms1001 bytes

Comments

Comment viewing options

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

Such a useful code! I did try

Such a useful code! I did try your code posted and it really works. I'm familiar with different programming languages but I'm not familiar with these one. Can anyone tell me where I can undergo training in terms of programming?-testosterone booster

Thank you for your informative post, it gives me a big help

how to boost testosterone

FATdan's picture

this time the output looks

this time the output looks like this:

#(VRayMtl, Multimaterial, VRayOverrideMtl, VRayBlendMtl, Blend)
filtMTL()
createStdMtl()
OK

Which all looks good... however, nothing changes in the scene...
I'm probably missing something straight forward but I can't see it.

Thanks

barigazy's picture

insert code method

Look under "INPUT FORMAT > Filtered HTML" for more tags

barigazy

FATdan's picture

--thanks

--thanks
barigazy's picture

If I understand you

If I understand you correctly, you need a function that will filter all VRay materials with black reflection color and assigned reflaction map.
For that i create "filtMTL" function.
If state is true then all theses materials will be converted to Standard Flat-Colored material.

barigazy

FATdan's picture

ahhh. it's actually the other

ahhh.
it's actually the other way around. Sorry I should have been clearer in my explanation.

Currently the script is used to convert a scene into solid colours per material. The rendered output is then used by the post production dep. What we are doing manually is converting all the glass materials (and alike) back to glass.

This is so that when glass objects cover another object, the channel render shows what is seen through the glass.

So, I am trying to get the script to basically ignore the mats that have transparency so they render the colours beyond them.

I hope that makes sense. Let me know if not.
I have attached an example of where this occurs.

Thanks for the help with this!!

AttachmentSize
channels_example.jpg 90.55 KB
barigazy's picture

Now you can change filtMtl

Now you can change filtMtl function what to filter out.

fn filtMTL mtl = isKindOf mtl VRayMtl and mtl.reflection != black and mtl.texmap_refraction == undefined

Also why not find all glass mtl and put in opacyty slot VRayColor map with pure black color when you want to extract wall behind, and then remove VrayColor map for the final render

barigazy

FATdan's picture

Ok. Great. Could this be "or"

Ok. Great. Could this be "or" instead of "and"?

black or mtl.texmap_refraction

The opacity is a good idea although I actually need to keep the refraction so it deforms the rendered serface behind.

Thanks again for the assistance on this.
I've got some more work to do with it but I'll let you know how I get on.

Danny

barigazy's picture

About "or" Yes u can use it

About "or"
Yes u can use it but your fn need to find mtl that have both main proerties of glass shader (reflection and reflaction). Thats the reason why i use "And" instead of "or".
Cheers!

barigazy

barigazy's picture

In your case, i think it is

In your case, i think it is better to start for-loop like this
for mtl in scenematerials do ...

barigazy

Comment viewing options

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