ScriptSpot

Script

Material Override Excluder

By DaveWortley · Credited author: Dave Wortley · 2015-06-07

Version
1.4
Version requirement
3dsmax 6+
Other software required
Vray 2.0 +
Date updated
2015-06-15
Votes
3
Description

Do you use the Vray Material Override to do chalk renders and wish that it would allow you to exclude certain materials? Like VRayLightMtl and any refractive materials like glass? Well now you can using this little script. It sets up a Shell Material which allows you to switch from one material setup to another. So even if those pesky VRayLightMtls and refractive materials are within Multi-sub materials then you’ll still be able to exclude them. Give it a go, test it out and let me know how it works for you! Cheers to Fraggle from the Chaosgroup forums for giving me the motivation to do this one. It should be easy enough to hack it for Mental Ray or other renderers, feel free to ping me a message with any specific requests, I'll add Corona soon.

 

Additional Info

Usage

Choose the Material Editor Sample Slot you want to get your Override/Chalk Shader from, that’s down bottom left in Slate or one of the sample slots in the Compact-Material-Editor. Keep the excludes on for whichever materials you want to preserve (let me know if you want more there). You can keep refractive materials and automatically desaturate refraction / fog / exit colour/maps. You can choose to keep opacity maps/bump maps/ displace maps this will work with nested materials, multi-sub, VrayBlends etc… You can also exclude by a material name, and using Wildcards you can exclude all materials which have glass in their name for instance by putting in *glass* into the name exclude box. You can also get your the objects you have in your include/exclude List in the VRay Material Override Exclude Dialog. Press ‘Create Override Setup’ and your scene is now ready to render with override materials on, you can press ‘Go Material’ at any point to return to the original materials, and press ‘Go Chalk’ to go back to rendering chalks. Press ‘Remove Override Setup’ to revert back to how your scene was, even if you close and reopen the script. Hold Shift on the ‘Go Override’ and ‘Go Material’ buttons to turn just the selected objects to Override or Material.

Installation

Download the MCR File Run it using the Maxscript(now called Scripting in 2016) Menu -> Run Script or Drag and drop it from your hard drive into the viewport.

You'll find the macro under 'DW Tools'

Changes

v.1.2 Updated to fix, bug when not using Vray Material Exclude List, and extra layer of warning messages added.

v.1.3 Updated to add override to objects with no materials.

 v.1.4 Update to allow overrider of XRefScene Materials, and exclude by name can have multiple inputs using commas to separate.

 

Attachments

Tags: clay, override, Material Override, Chalk, Render Exclude, Excluder

Comments (23)

Tommy_LedZep · 2015-06-30

By the way: it would be nice to have the possibility to save and load presets, so the user doesn't have to repeat the same steps each time he uses the script :)

Thank you

Corona!

mishalobanov · 2016-07-19

corona renderer!

Bug with diffuse color

Tommy_LedZep · 2015-06-16

I found the following bug:
_ when I setup a VRayMtl with let's say a pink color on the diffuse slot and a refractive value of 0.5, this material is not overriden (assume that "keep Refractive VRayMtls" is ticked), but the wrapped material created by the script ignores the diffuse color.

Monochrome Refractions

DaveWortley · 2015-06-17

Max.. There is an option which sets the refractions to monochrome, untick this if you want to keep the colour.

Tommy_LedZep · 2015-06-18

Ah ! Ok, sorry I didn't notice that.
It works fine, thank you Dave :)

Multiscatter ready

Tommy_LedZep · 2015-06-16

Hi,

Just to let you know that I tested the script with Multiscatter and it seems to work fine so far.
In my projects I sometimes use RailClone too, so it would be nice if you could have your script working with it too :)

1rv · 2015-06-16

I can't make the script work well with VrayProxy vegetation (only trunk get white, the rest is rendered as usual). Any ideas why?

Superb

Stirling · 2015-06-16

This is so useful. Thanks for doing it!

One question: I'm having trouble getting the override to work with Forest Pack Pro objects, namely the grass which still renders with it's material. Any idea why this might be?

Thanks again

ForestPro

DaveWortley · 2015-06-16

Ah yes, pesky ForestPro with it's bizarre way of storing materials internally... I'll look into it, should be fairly simple to do.

I guess I'll need to check RailClone and PFlow as well.

Really great but

Tommy_LedZep · 2015-06-11

Hi Dave,

Your script is really great but it does not work with objects that don't have any material assigned (ok I understand it is impossible to create a shell material without any base material). That's a point you could try to improve.

Another thing: I need some help with the use of wildcards. The script works well when using a single string like *glass*, but when I enter let's say 3 strings, like for example *glass* *arch* *concrete*, the script does not work anymore: these materials are then replaced by the override one which is not what I want. I must do something wrong here: can you please help me ?

Thank you so much !

DaveWortley · 2015-06-11

Good ideas, I'll cover off the no material override pretty easily.

For your other suggestion I'll add it so it can take comma separated entries. Example...
*Glass*,*arch*,*concrete*

Will that work for you?

Also I need to cover XRefScene materials as well and make sure groups are working too.

That would be great

Tommy_LedZep · 2015-06-11

Thank you Dave: that would work for me :)

v.1.3

DaveWortley · 2015-06-15

Now works on objects with no materials applied to them.

Thank you but ...

Tommy_LedZep · 2015-06-15

Hi Dave,

Thank you for the great work !
I downloaded the last 1.3 version, but when I drag and drop the .mcr on the 3dsmax viewport, I have the following Maxscript FileIn Exception error: "-- Syntax error: at<, expected -- in line:

So I didn't go further with new version and didn't test it yet.
... is this message normal ?

More New Features

DaveWortley · 2015-06-15

Hmmm... it worked for me, try again with the latest version.

I've added the multiple text input using commas "*Glass*,*water*" and also made the script work with XRefScenes as well.

Improvement idea

Tommy_LedZep · 2015-06-15

I closed 3dsmax, and manually deleted the old .mcr, then I opened 3dsmax again, draged and droped the new .mcr and now I have the script working fine :)

I really appreciate it so far but one thing that is still missing (at least to me) is when dealing with big scenes containing a lot of various vegetation objects for example, coming from various providers. In such a situation, I think you will agree that it is a pain to rename one by one each material you want to exclude from the override setup whereas all of these objects are probably already stored in only few layers ... So it would be much easier, to exclude such objects, to have the possiblity to exclude entire layers lists of objects rather than doing it only by their material names ... I know it is probably a bit complicated to script but it would definitely give a lot more interest to your script which is already very helpful.
As I know you are also working on another script called Include/Exclude: maybe you could make the two ones working together ? Or making just one awesome script that would do both jobs ?

Anyway, thank you again Dave !

Include / Exclude

DaveWortley · 2015-06-15

I'm designing this to be used with the Include / Exclude system I'm developing. I'll somehow merge the two scripts at some point.

Awesome !

Tommy_LedZep · 2015-06-15

That would be awesome !!
I am ready to wait a little bit more to see that :)
Thank you again,
Cheers

Question for those that use this.

DaveWortley · 2015-06-16

Should I default the script to get the material from the VRay Material Override Slot in the render settings dialog rather than getting from first slot in the material editor samples?

Tommy_LedZep · 2015-06-16

Yes Dave: personally I think it would be better if the script would pick the material from the VRay Material Override Slot in the render settings dialog. It seems more handy to me.

Bug Fix

DaveWortley · 2015-06-10

Big bug where the script only worked when you had 'Get Object Exclude from VRay' on if you had objects listed in your VRayMaterialOverride Inc/Exc list.

V1.2 Bug Fixes

DaveWortley · 2015-06-09

Small bug with using VRayMaterialOverride Material.

And put in protection to force user to use a VRayMtl Material.

very interesting!

mustafa mamdouh · 2015-06-09

I think that would be very useful to setup quick scene for lighting balance on gray model .. Thank you so much for that