This page provides information on the Corona Select Material.
The Corona Select Material lets you plug multiple materials into a single material editor node, and then choose which one of them to use in the actual rendering. To select a specific item, simply click the radio button next to that item's name.
See also: Corona Select Map
Material count – Specifies the number of materials that you wish to select between.
List of materials – Shows the names of all connected materials and allows selecting one of them.
Currently, the maximum number of materials nested inside a Corona Select Material is 100 (numbered from 0 to 99). When using the Compact Material Editor, only 25 items (numbered from 0 to 24) will be displayed in the list. To overcome this, you can use the Slate Material Editor or MAXScript, where adding up to 100 items is possible.
As stated in the Corona Select Material UI when material count is higher than 25, more items can be accessed through MAXScript. Below is a simple guide with a few possible use cases:
In the Compact Material Editor:
Set number of items in the Corona Select Material in the 1st material editor slot to 100:
meditMaterials.mtlCount = 100
Add a new Corona Material to the 1st slot of the Corona Select Material:
meditMaterials.materials = CoronaMtl ()
Select 5th item:
meditMaterials.selected = 5
In the Slate Material Editor:
Set number of items in the specific Corona Select Material (in this case called "mymaterial") to 100:
rootScene[#SME][#View1][#mymaterial____CoronaSelectMtl].Properties.reference.mtlCount = 100
Add a new Corona Material to the 1st slot of the specific Corona Select Material:
rootScene[#SME][#View1][#mymaterial____CoronaSelectMtl].Properties.reference.materials = CoronaMtl ()
Select 5th item of the specific Corona Select Material:
rootScene[#SME][#View1][#mymaterial____CoronaSelectMtl].Properties.reference.selected = 5
There is something wrong with numbering when adding and selecting materials through MAXScript!
Due to a small bug in the current version of Corona, the indexes start from different numbers, so for example if you assign a material to slot 1 of the Corona Select Material it will actually be assigned to slot 0. So to select it you will need to use selected = 0, not selected = 1.
How do I know what commands I should use?
You can open the MAXScript Listener (Scripting > MAXScript Listener...) and enable the MacroRecorder (MacroRecorder > Enable) to record various actions you perform in the material editor (such as creating new materials, changing the number of items in the Select Material, plugging different materials into different slots, selecting specific materials, etc). This can help you find the syntax which you will need to use, specific to your scene.
Assigning Different Materials to Objects
Three different carpaint materials are connected to a Corona Select Material, which is then applied to the car object. This way, you can cycle between different carpaint colors a single click.