Author Topic: Corona Randomizer  (Read 11084 times)

2023-11-21, 21:42:23
Reply #30

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Thanks for the screenshot, that can be a checkbox. Same with the High Quality blending from what I'm hearing.

is it really necessary to have a selected object with the material applied? Is it possible to implement the use of a script with selected material that is not assigned to any object?

From my understanding (happy to be wrong if someone knows otherwise), it can be applied to either selected objects, a selected object(s) material or all scene materials. Can you show me a situation where you find this useful? Just to clarify further, the reason I chose this route is that if its not specific to the selected object(s), it will apply to every single material in the scene.




2023-11-22, 06:00:15
Reply #31

marchik

  • Active Users
  • **
  • Posts: 258
    • View Profile
Thanks for the screenshot, that can be a checkbox. Same with the High Quality blending from what I'm hearing.

is it really necessary to have a selected object with the material applied? Is it possible to implement the use of a script with selected material that is not assigned to any object?

From my understanding (happy to be wrong if someone knows otherwise), it can be applied to either selected objects, a selected object(s) material or all scene materials. Can you show me a situation where you find this useful? Just to clarify further, the reason I chose this route is that if its not specific to the selected object(s), it will apply to every single material in the scene.

no, of course it is not an option to apply this to all scene materials at once.
As an example, materials from Megascans, you add 5 of them using Bridge to the scene at once and do not assign them to specific objects yet, because you want to combine them into one CoronaLayeredMtl, it would be convenient to select them in material editor and add a randomizer directly to them. But if the option is between “everything” and "assigned to object", then of course it’s better to leave it as it is now

2023-11-22, 12:03:26
Reply #32

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Updated to include Stochastic & HQ Blending as buttons (CoronaMappingRandomizer).

Script attached to this post.

Version 3.2 Features:
- Stochastic Button: Changes U|X: -1.0 to 1.0, V|Y: -1.0 to 1.0, W|Z: 0 to 360, Randomize each tile (on)
- HQ Blending Button: High quality blending (on/off)
- Save as Default Button: Save your enabled/disabled buttons as your new default settings for when you re-open the script
- Reset all Settings Button: Reset your default settings to the original settings for the CoronaMappingRandomizer

Notes:
- I currently broke some functionality so dont press Randomizer twice in a row for the same object lol. When I fix it ill update this as v3.1 (Fixed, v3.1)
- Broke undo now, lol. Incoming (Fixed v3.2)

UI:
UI" border="0

Stochastic Button + HQ Blending (off) Output:
Mapping" border="0

In regards to your question about currently selected materials @marchik. I think its possible, however it needs to be handled differently in slate/old material editor. Ill take a look at this another day. Out of curiosity, does anyone still use the old material editor or just slate?

Also didnt really know what to call the Stochastic button so I went with romollus suggestion, if I understand correctly (oops, forgot the word 'Mapping'). Either way it tells you what it does on the tooltip.

As always, save your scenes before running the script, let me know if you encounter bugs/crashes.
« Last Edit: 2023-11-22, 16:53:13 by James Vella »

2023-11-23, 16:33:13
Reply #33

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Updated to include selected Material as well as Object selection, more details in the Features section.

Script attached to this post.

Version 3.3 Features:
- If no object selected then select a material to apply the CoronaRandomizer to. Objects take priority over materials so as long as an object is not selected in the viewport and a material is selected in the slate editor it will apply the script to the selected material. Does not work with multiple material selections. Does work with multiple object selections.
- Updated tooltips
- Updated Instructions
- Updated checkbox naming

UI:
UI" border="0

2023-11-23, 22:13:06
Reply #34

marchik

  • Active Users
  • **
  • Posts: 258
    • View Profile
Updated to include selected Material as well as Object selection, more details in the Features section.

Script attached to this post.

Version 3.3 Features:
- If no object selected then select a material to apply the CoronaRandomizer to. Objects take priority over materials so as long as an object is not selected in the viewport and a material is selected in the slate editor it will apply the script to the selected material. Does not work with multiple material selections. Does work with multiple object selections.
- Updated tooltips
- Updated Instructions
- Updated checkbox naming

UI:
UI" border="0

I didn’t have time to answer yesterday, but there’s a new version already, I checked everything, it works like a charm, thank you very much again.

I don’t even know what you can add to it anymore, maybe it’s possibility to add randomizer to several selected materials in SME at once? now it only applies to the last one selected :D


2023-11-24, 08:34:47
Reply #35

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
maybe it’s possibility to add randomizer to several selected materials in SME at once? now it only applies to the last one selected :D

Hah, yeah that is the intention. After reading through the maxscript docs I cant find a way to make this possible. If someone knows or has an example of how to do it I'm all ears (oh I think I found an example by pixamoon, it may work, fingers crossed!).
« Last Edit: 2023-11-24, 08:53:55 by James Vella »

2023-11-24, 09:11:50
Reply #36

Frood

  • Active Users
  • **
  • Posts: 1922
    • View Profile
    • Rakete GmbH
Hey James,

have not (again :) looked at the script but it should work straight like this:

Code: [Select]
if (sme.getview sme.activeView)!=undefined then (
selectedNodes = (sme.getview sme.activeView).GetSelectedNodes()
if selectedNodes.count!=0 then (
for sNode in selectedNodes do (
if (superclassof sNode.reference == material) then (
format "Doing something with '%'\n" sNode.reference.name
)
)
)
)


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

2023-11-24, 10:06:20
Reply #37

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Thanks Frood, yeah this is similar to pixamoons snippet, its working in theory... just gotta find out why I keep breaking it with my undo lol. My life is just full of undefined lately :D
« Last Edit: 2023-11-24, 10:12:14 by James Vella »

2023-11-24, 10:31:49
Reply #38

Frood

  • Active Users
  • **
  • Posts: 1922
    • View Profile
    • Rakete GmbH
My life is just full of undefined lately :D

Fortunate :) Everything is possible then.


Good Luck



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

2023-11-24, 12:00:56
Reply #39

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Script attached to this post.

Version 3.4 Features:
- Can now select multiple materials in the slate editor
- Remember, objects take priority so deselect all objects if you intend on converting selected materials instead
- Updated instructions

Notes:
- Big thanks to Frood! this actually ended up being the solution for this situation that worked best.

UI:
UI" border="0

2023-11-26, 03:01:49
Reply #40

marchik

  • Active Users
  • **
  • Posts: 258
    • View Profile
Script attached to this post.

Version 3.4 Features:
- Can now select multiple materials in the slate editor
- Remember, objects take priority so deselect all objects if you intend on converting selected materials instead
- Updated instructions

Notes:
- Big thanks to Frood! this actually ended up being the solution for this situation that worked best.

UI:
UI" border="0
hope this will be added to corona's power tools

2023-11-26, 15:15:06
Reply #41

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8856
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Agree, this and converter scripts from/to physical material deserves nice high resolution icons and place next to official Corona scripts. Thank you very much James!! Your scripts are incredible time savers.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-11-26, 17:00:47
Reply #42

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Agree, this and converter scripts from/to physical material deserves nice high resolution icons and place next to official Corona scripts. Thank you very much James!! Your scripts are incredible time savers.

You're welcome. Glad you find them useful :)

2023-11-30, 11:21:40
Reply #43

marchik

  • Active Users
  • **
  • Posts: 258
    • View Profile
Agree, this and converter scripts from/to physical material deserves nice high resolution icons and place next to official Corona scripts. Thank you very much James!! Your scripts are incredible time savers.

You're welcome. Glad you find them useful :)

Wouldn't it be impudent to ask you to write another similar script?
It would be cool if we had the opportunity to add a Corona colorcorrect map using a similar method.
Only for selected materials (no objects involved) and with a choice of Basecolor (and/or) Translucency color map slots.

This can be extremely convenient for vegetation when setting up scatters. Forest Pack has a similar script built into it, but it works a little clumsily and uses a proprietary map that is not so easy to control.

I have attached a gif file with an approximate explanation of how I see it

2023-11-30, 12:42:10
Reply #44

Tom

  • Active Users
  • **
  • Posts: 236
    • View Profile
    • www
Hi,

I didn't dare ask, but I confirm it would be extremely helpful, and I'm sure a large number of 3D artists would be interested in such a script, starting with myself.

What I have in mind, is a script that would allow to:

_ add a CoronaColorCorrect map on Diffuse only, Translucency only, or both Diffuse and Translucency

_ include/exclude particular materials of the selected object when dealing with Multi/Sub-Object material types (useful to exclude trunks, branches, stems for example)

Ideally in addition, once the CoronaColorCorrect map has been added, the script could offer the possibilty to:

_ change the CoronaColorCorrect properties in a row for all objects selected: Brightness, Contrast, Saturation, Hue, Gamma etc ...

So that it's possible to change all of these settings for multiple objects in a row  :)


I know it's a lot of work, and I don't know if this is something you would be willing to do but it would be very useful and a huge time saver.