Author Topic: In scene variable gizmo for Corona SelectMaterial / SelectMap  (Read 2376 times)

2021-10-28, 14:52:21

LKEdesign

  • Active Users
  • **
  • Posts: 100
  • I'm addicted to Corona Render and I need NO cure.
    • View Profile
    • LKE Design Web-site
Sitting with a collection and trees and make Material setups for the four seasons. I do it by making a CoronaSelectMtl with four materials - which work fine  - BUT it could be SO much cooler if you could switch the Selected material by a global variable in your scene  - could be a Gizmo with number list or textbox. You could then reference this Variable Gizmo on all the relevant selectMtl's and you could fx. change season on a whole scenes vegetation by one click!

This could be relevant for both the SelectMap and the SelectMtl.

By the way, it could be a big help too if you could add a customized tag to each item in the SelectMxx  - like you can in the MultiSub Material - this could make selection choices more clear.

Thanks
All the best,
LKE Design
See my work at: http://www.lkedesign.dk/en/portfolio_en.html

2021-10-28, 15:17:29
Reply #1

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8828
  • Let's move this topic, shall we?
    • View Profile
    • My Models
BUT it could be SO much cooler if you could switch the Selected material by a global variable in your scene  - could be a Gizmo with number list or textbox. You could then reference this Variable Gizmo on all the relevant selectMtl's and you could fx. change season on a whole scenes vegetation by one click!

But of course you can do this already - Max has pretty powerful parameter linking system.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-10-28, 21:04:11
Reply #2

LKEdesign

  • Active Users
  • **
  • Posts: 100
  • I'm addicted to Corona Render and I need NO cure.
    • View Profile
    • LKE Design Web-site
You are right Romullus, I didn’t think of it. I have now linked all the select Materials with a Floating Limit Controler in the Additional Parameters, it could be cool though to have some interface in the scene workspace to handle the switch, but haven’t found a smart way yet to do this.
Any suggestions?
All the best,
LKE Design
See my work at: http://www.lkedesign.dk/en/portfolio_en.html

2021-10-29, 00:17:10
Reply #3

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8828
  • Let's move this topic, shall we?
    • View Profile
    • My Models
You can add custom atribute to almost any scene object, like helper, or editable poly and wire that attribute to any parameter in material editor, so you don't have to open material editor each time when you want to change a map in select CoronaSelect texmap.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-11-03, 16:21:52
Reply #4

LKEdesign

  • Active Users
  • **
  • Posts: 100
  • I'm addicted to Corona Render and I need NO cure.
    • View Profile
    • LKE Design Web-site
In continuation on my voyage to automate my tree and plant season setup, I have met a problem. Don’t know if it specifically is a Corona problem, - maybe you can tell me.

I have now made a setup where all trees are made of a Multisub material with a CoronaSelectMtl in the leaves material slot. The selector consist of 5 leaf materials, - WinterSnow (naked branches - see below), Winter (naked branches), Spring (light green leaves, with a random number of invisible leaves), Summer (Full blown green, no hidden leaves) , Autumn, golden brown leaves, with a possibility to hide random leaves).

Each tree has also a linked CoronaSelectMtl that handles the visibility of the snow on the branches, - only visible in the WinterSnow selection, - the rest of the time its attached an Invisible material (opacity = black).

Right now I handle the change of season by a Float Limit controler, that link the Selected properpty on each CoronaSelectMtl that handles all the Season on each tree / Plant. So when the work is done all you have to do is to find ONE of the CoronaSelectMtl’s and change the season - and all will be changed. Works great!

See the setup in the attached screendump.

Now the cumbersome part is to link all those damn Select materals, - and sometimes you delete some plants and sometimes you add some plants - so it is hard to manage in the long run.

I had figured a way to come around that by making a max script with a user interface with a list of the seasons , that would look up all CoronaSelectMtl’s  in the scene having the prefix “Season” in its name, and change the select number to a number associated with the selected season in the list.

Here is an example of a name on such a CoronaSelectMtl “Season - Leaves - AM_Birch_01-04”

However, it appears to me, when I select a season in the material editor, that the CoronaSelectMtl can’t be reached per say????

Here is an example ….

sceneMaterials["msEvermotion_Forrest_Beech_Undergrowth"].materialList[2].selected = 3

So the line above refers to a multisub material, named "msEvermotion_Forrest_Beech_Undergrowth", which has a CoronaSelectMtl in the 2nd slot which now has changed the value to 3!!??

Are there no way I can let a script collect all the CoronaSelectMtl’s in the scene - check if it has “Season” in the first part of the name and then change the selected value to them all?

Help!!?


All the best,
LKE Design
See my work at: http://www.lkedesign.dk/en/portfolio_en.html

2021-11-03, 19:16:32
Reply #5

Frood

  • Active Users
  • **
  • Posts: 1919
    • View Profile
    • Rakete GmbH
sceneMaterials["msEvermotion_Forrest_Beech_Undergrowth"].materialList[2].selected = 3

This should work. But keep in mind that the index is zero based. So "selected=3" means actually slot #4. Additionally you don't get the material if it is only in SME but not the scene when using "sceneMaterials".

Are there no way I can let a script collect all the CoronaSelectMtl’s in the scene - check if it has “Season” in the first part of the name and then change the selected value to them all?

Try this:

Code: [Select]
for m in getclassinstances CoronaSelectMtl where findstring m.name "Season"==1 do (
m.selected=2 -- change to your desired season here
)


Good Luck



Never underestimate the power of a well placed level one spell.

2021-11-04, 15:56:31
Reply #6

LKEdesign

  • Active Users
  • **
  • Posts: 100
  • I'm addicted to Corona Render and I need NO cure.
    • View Profile
    • LKE Design Web-site
SUPER!!!! Thanks a million - it works like a charm ;)
All the best,
LKE Design
See my work at: http://www.lkedesign.dk/en/portfolio_en.html

2021-11-10, 18:02:58
Reply #7

LKEdesign

  • Active Users
  • **
  • Posts: 100
  • I'm addicted to Corona Render and I need NO cure.
    • View Profile
    • LKE Design Web-site
Here you can see the result - a handy little script that can switch between seasons ;)
The explanation can be found on the video description ....

Thanks to Frood for the help ;)

All the best,
LKE Design
See my work at: http://www.lkedesign.dk/en/portfolio_en.html