What is the Select Map / Material?


The Corona Select Map and Corona Select Material are available in Corona Renderer 4 and newer. They allow for plugging multiple maps / materials into a single material editor node, and then choosing which one of them should be used in the actual rendering. To select a specific item, simply click on the radio button next to that item's name:



This simple tool has an extremely wide variety of uses. Here are some examples:


1. Quickly changing the material which is assigned to an object:

The Corona Select Material is used to quickly switch between 3 variations of the car paint material. 



This is a one-click solution for comparing various car paint colors and fine-tuning them if needed. 



2. Quickly changing the environment:


Three different Corona Bitmaps are plugged into a Corona Select Map. This Select Map is then used for environment lighting and as a shadowcatcher backplate. 


Different environments, each loaded with just a single click. 

With the Corona Select Map there is no need to update the environment map in all places (if it is connected to more than one item). 



3. Creating presets / color schemes using the combination of Corona Multi Map and the Corona Select Map or Material:


In this example we are using 3 different Corona Multi Map "presets" which are then connected to the Corona Select Map. 

The purpose of the Multi Map is to distribute different colors among different sub-materials based on Material IDs. 



Different colors (specified in each of the Corona Multi Maps) are distributed among different objects based on their Material IDs. The color presets can be changed with just one click.

The sofa, the pillows, and the metal frame under the sofa are a single object with 3 different material IDs. 




How many items does it support? 


Currently the maximum number of materials / maps nested inside a Corona Select Material / Map is 100 (numbered from 0 to 99).

Note that 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 available. 



 

How to access and manage the Corona Select Material / Map through MAXScript?


As stated in the Select Material / Map UI, more than 25 items can be accessed through MAXScript. Here is a simple guide with a few possible use cases: 


In the Compact Material Editor:


Corona Select Map:


Set number of items in the Corona Select Map in the 1st material editor slot to 100:

meditMaterials[1].mapCount = 100


Add an empty Corona Bitmap to the 1st slot of the Corona Select Map:

meditMaterials[1].texmaps[1] = CoronaBitmap ()


Select 5th item:

meditMaterials[1].selected = 5



Corona Select Material:


Set number of items in the Corona Select Material in the 1st material editor slot to 100:

meditMaterials[1].mtlCount = 100


Add a new Corona Material to the 1st slot of the Corona Select Material:

meditMaterials[1].materials[1] = CoronaMtl ()


Select 5th item:

meditMaterials[1].selected = 5




In the Slate Material Editor:


Corona Select Map:


Set number of items in the specific Corona Select Map (in this case called "mymap") to 100:

rootScene[#SME][#View1][#mymap____CoronaSelect].Properties.reference.mapCount = 100


Add an empty Corona Bitmap to the 1st slot of the specific Corona Select Map:

rootScene[#SME][#View1][#mymap____CoronaSelect].Properties.reference.texmaps[1] = CoronaBitmap ()


Select 5th item of the specific Corona Select Map:

rootScene[#SME][#View1][#mymap____CoronaSelect].Properties.reference.selected = 5



Corona Select Material:


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[1] = CoronaMtl ()


Select 5th item of the specific Corona Select Material:

rootScene[#SME][#View1][#mymaterial____CoronaSelectMtl].Properties.reference.selected = 5




Troubleshooting


There is something wrong with numbering when adding and selecting maps / materials through MAXScript!

Due to a small bug in the current version of Corona Renderer (version 4 Hotfix 1) the indexes start from different numbers, so for example if you assign a material / map to slot 1 of the Corona Select Material / Map it will actually be assigned to slot 0. So to select it you will need to use selected = 0, not selected = 1. This will be fixed in the future. 


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 / Map, plugging different materials into different slots, selecting specific materials / maps, etc). This can help you find the syntax which you will need to use, specific to your scene.