Author Topic: Corona Randomizer  (Read 11294 times)

2023-12-01, 07:28:05
Reply #45

marchik

  • Active Users
  • **
  • Posts: 258
    • View Profile
_ include/exclude particular materials of the selected object when dealing with Multi/Sub-Object material types (useful to exclude trunks, branches, stems for example)

I would prefer it not to work with objects and its multi/sub-object material at all.  It is not difficult to take material from an asset using an eyedropper and then select only the necessary coronaphysicalmtls in its composition, manually excluding the bark and branches yourself, if necessary.
Sometimes you need to edit the bark, and in general it is not necessary to use it for plants, because you can take any several materials, even as part of several multi/sub-object materials, and “group” their editing using this script.


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 ...

similarly, I think such functionality is unnecessary, it will complicate creation of a script, but we already use multiple inputs/ouputs corona colorcorrect map to group our materials and get the possibility to edit them all together at once

2023-12-01, 15:31:25
Reply #46

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8856
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Small cosmetic issue with V3.4 - when it adds triplanar or mapping randomizer to Corona physical material, it places displacement map above bump map which makes shader tree look a bit untidy. Legacy material gets wired correctly.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-12-01, 15:51:55
Reply #47

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
lol yeah romullus, thats out of my hands. Its based on the subanims order, doesnt do it based on input order. Something I have no idea about. It gets even crazier when you have more inputs or different setups (as you can see from my spaghetti screenshots).

Regarding the color correct stuff ive have a look. Something might be possible.

2023-12-02, 14:20:30
Reply #48

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Where does the color correct go in the chain? Right after the bitmap?

What about when you have other nodes such as falloff/mix/tiles etc?

Something like this? Actually I wont be doing it this way, read below...
cc" border="0

Edit:
I think its going to be easiest as the front of the chain (like the screenshot), things get super complex when its at the end since if you have a triplanar in there or something with multiple inputs/outputs it will need to consider each one and you will end up with connections everywhere. Notice how when you add an 'Additional Output' how you lose the existing outputs unless you add them first? That thing there is a technical brain fart.

Otherwise I do have it currently working at the end of the chain... but its easy for the user to mess up if they then apply the triplanar/randomizer script. Well, actually its kind of working I suppose, I guess it depends on the order you do it in. I just realised this as I was typing this so I dunno, what do you think? I think it actually works better at the end of the chain now I think about it more. What I mean by that is it works in the order YOU push the buttons, but its always at the end of the diffuse chain. Example: diffuse > mix > falloff > colorcorrect > material. instead of diffuse > colorcorrect > mix > falloff > material.

Adding ColorCorrect first, Randomizer Second:
cc-first" border="0

Adding Randomizer First, ColorCorrect Second:
cc-second" border="0

Simplified view of just the ColorCorrect with 4 materials (diffuse only):
cc-4mats" border="0

Keep in mind you dont need to use the Randomizer with this, I'm just testing multiple scenarios in case something breaks. But you get to see it because these things can be things that happen in production (or by accident, or user choice really).
« Last Edit: 2023-12-02, 17:00:14 by James Vella »

2023-12-02, 17:49:13
Reply #49

marchik

  • Active Users
  • **
  • Posts: 258
    • View Profile
Where does the color correct go in the chain? Right after the bitmap?

What about when you have other nodes such as falloff/mix/tiles etc?

Something like this? Actually I wont be doing it this way, read below...


Edit:
I think its going to be easiest as the front of the chain (like the screenshot), things get super complex when its at the end since if you have a triplanar in there or something with multiple inputs/outputs it will need to consider each one and you will end up with connections everywhere. Notice how when you add an 'Additional Output' how you lose the existing outputs unless you add them first? That thing there is a technical brain fart.

Otherwise I do have it currently working at the end of the chain... but its easy for the user to mess up if they then apply the triplanar/randomizer script. Well, actually its kind of working I suppose, I guess it depends on the order you do it in. I just realised this as I was typing this so I dunno, what do you think? I think it actually works better at the end of the chain now I think about it more. What I mean by that is it works in the order YOU push the buttons, but its always at the end of the diffuse chain. Example: diffuse > mix > falloff > colorcorrect > material. instead of diffuse > colorcorrect > mix > falloff > material.

Adding ColorCorrect first, Randomizer Second:


Adding Randomizer First, ColorCorrect Second:


Simplified view of just the ColorCorrect with 4 materials (diffuse only):


Keep in mind you dont need to use the Randomizer with this, I'm just testing multiple scenarios in case something breaks. But you get to see it because these things can be things that happen in production (or by accident, or user choice really).

Yes, I understand this nuance perfectly.

I believe that the most convenient and logical thing would be to simply add colorcorrect at the end of the chain in any cases, immediately before entering the material. This script is needed when you already have ready-made material, and most often it will be material of vegetation, (leaves or grass) without additional maps (maybe another color correction map, but mostly without triplanar and so on) in the chain. And people will use it knowing what and why they are clicking, so foolproofing is not musthave here;

in any case, you can always click randomizer after color correct if you suddenly need it.

2023-12-02, 18:13:24
Reply #50

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Ok cool, thats pretty much how its functioning now. Just a few last things to add for the Translucency and were ready to roll.

You can add triplanar, randomizer, color correct diffuse or color correct diffuse + translucency in any order you prefer.

Only exception will be: color correct diffuse + translucency. This will be similar to the Randomizer + Triplanar button, it does both actions at once.
« Last Edit: 2023-12-02, 18:16:54 by James Vella »

2023-12-03, 11:28:50
Reply #51

James Vella

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

Version 4.0 Features:
- Added Color Correct Diffuse: Applies a colorcorrect node to all selected materials for the Diffuse
- Added Color Correct Diffuse + Translucency: same as above but also plugs the diffuse into a new color correct and then into the Transluceny Color.
- Undo should be more stable now, I havent been able to crash it yet so fingers crossed.
- You can apply these in any order: CoronaRandomizer, Triplanar, Color Correct Diffuse or Color Correct Diffuse + Translucency. (one potential issue is putting the color correct after the triplanar since it creates a new output called "MultiOutputChannelTexmapToTexmap". I have no idea how to handle this or if this would be something you do anyway).
- To keep consistency this works the same way as before, objects take priority so if you want to apply to selected materials de-select the objects in the viewport.
- Order of the input/output relies on selection order in the viewport (example below). Material selection dont really have an order (that I can find, so you might end up in spaghetti town! But it works so thats a plus lol)
- Randomizer settings: Rolled up by default, once you set your settings and save them no need to see this unless you want to change something, then just roll it it back down.

UI:
UI" border="0

Color Correct Diffuse + Translucency:
CC" border="0

Selection Order:
OrderMat" border="0
OrderGeo" border="0

Fun Example: Color Correct Diffuse + Translucency > Mapping Randomizer > Triplanar = Spaghetti City!
Crazy-Town" border="0

Notes:
Thanks for the suggestions Tom. I have been thinking about a convenient way to do this (similar to the Randomizer Settings Rollup). It may be possible, for this release I just wanted to make sure you guys can play with the new features asap. I was also thinking maybe some presets would be better similar to the Randomizer Settings? So for example a checkbox for foliage which does subtle changes, happy to hear some suggested settings such as brightness -5, contrast -10 etc. Just thinking of things from the top of my head but happy to explore what's most useful in a production workflow, I mean that's what the tools are designed for to make your job easier. Since its a community project feel free to toss ideas around and come to a conclusion on best practice before I jump back into the code. Cheers
« Last Edit: 2023-12-03, 12:12:12 by James Vella »

2023-12-03, 12:38:28
Reply #52

marchik

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

Version 4.0 Features:
- Added Color Correct Diffuse: Applies a colorcorrect node to all selected materials for the Diffuse
- Added Color Correct Diffuse + Translucency: same as above but also plugs the diffuse into a new color correct and then into the Transluceny Color.
- Undo should be more stable now, I havent been able to crash it yet so fingers crossed.
- You can apply these in any order: CoronaRandomizer, Triplanar, Color Correct Diffuse or Color Correct Diffuse + Translucency. (one potential issue is putting the color correct after the triplanar since it creates a new output called "MultiOutputChannelTexmapToTexmap". I have no idea how to handle this or if this would be something you do anyway).
- To keep consistency this works the same way as before, objects take priority so if you want to apply to selected materials de-select the objects in the viewport.
- Order of the input/output relies on selection order in the viewport (example below). Material selection dont really have an order (that I can find, so you might end up in spaghetti town! But it works so thats a plus lol)
- Randomizer settings: Rolled up by default, once you set your settings and save them no need to see this unless you want to change something, then just roll it it back down.

UI:


Color Correct Diffuse + Translucency:


Selection Order:


Fun Example: Color Correct Diffuse + Translucency > Mapping Randomizer > Triplanar = Spaghetti City!


Notes:
Thanks for the suggestions Tom. I have been thinking about a convenient way to do this (similar to the Randomizer Settings Rollup). It may be possible, for this release I just wanted to make sure you guys can play with the new features asap. I was also thinking maybe some presets would be better similar to the Randomizer Settings? So for example a checkbox for foliage which does subtle changes, happy to hear some suggested settings such as brightness -5, contrast -10 etc. Just thinking of things from the top of my head but happy to explore what's most useful in a production workflow, I mean that's what the tools are designed for to make your job easier. Since its a community project feel free to toss ideas around and come to a conclusion on best practice before I jump back into the code. Cheers

I can't say about the settings presets, I usually just change the gamma, saturation and hue to change the shades of the foliage. But each time these will be different settings.

I checked the script and it works like a charm. You can also give it the ability to recognize a Multi/Sub-object material in order to apply color correction to the materials it consists of, if we use a script with "selected objects mode". At the moment, when you run a script with the selection of an object to which a Multi/Sub-object material is assigned, it does nothing.

Otherwise, everything works perfectly, the implementation of the sequential apply of color correction + randomizer + triplanar is simply amazing, personally I am starting to get confused in these spaghetti when its applied :D
« Last Edit: 2023-12-03, 13:17:34 by marchik »

2023-12-03, 12:56:19
Reply #53

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
I checked the script and it works like a charm. You can also give it the ability to recognize a Multi/Sub-object material in order to apply color correction to the materials it consists of, if we use a script with "selected objects mode". At the moment, when you run a script with the selection of an object to which a Multi/Sub-object material is assigned, it does nothing.

Try restart 3dsmax or something, should work just fine. I tested with both object/material selection with multi-sub and it functions just the same. Can you show me a gif or something? The script just looks for Corona materials, it doesnt matter if its in a multisub it should work the same. Edit: Ah I see what you mean now, ill take a look, should be fairly straight forward. For now as a workaround you can select the materials instead of the object, ill update this in 4.1 soon.

Multi-sub:
Multisub" border="0

Otherwise, everything works perfectly, the implementation of the sequential apply of color correction + randomizer + triplanar is simply amazing, personally I am starting to get confused in these spaghetti when its applied :D

Ha yeah, imagine doing it manually.... brain explodes.
« Last Edit: 2023-12-03, 14:49:22 by James Vella »

2023-12-03, 14:39:35
Reply #54

James Vella

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

Version 4.1 Features:
- Now working with Multi-Sub when selecting in object mode.

Notes:
- Thanks for the bug notification marchik!
- As always save your scene before using the script. Multiple undos when using MappingRandomizer & Triplanar can crash your scene. I think its due to how 'Additional Mapping' works but thats far too complicated for me to understand what its actually doing.
- As for the selection order, that could be pure co-incidence after some more testing. Give me your feedback while you use the script since now I have no idea what order its doing it in but it seems to be OK for the most part.
- In regards to your specific comment romullus, that bump/displacement ordering in Physical is due to the ordering of the naming in the subanims. The Legacy and Physical have different naming conventions within the material (on the backend). Its a bit of a pain to work with but I'm sure the Corona team have more experience with this stuff than I do... either that or they are also pulling their hair out. I think I like my grey streaks so ill be doing my best to keep my hair for now =D
- Also due to the nature of how the new buttons work (ColorCorrect Diffuse and or Translucency) that will definitely switch the order of inputs/outputs. The more you use it the more you will understand why it works this way, but to put it simply it needs to process all the other bitmaps like gloss, bump, height etc as well as keeping track of the diffuse/translucency. This also applies to the additional node you get when you do it in reverse order (Mapping/Triplanar then Color Correct. If you are doing it in reverse order for whatever reason you're going to have to put up with an extra node in your spaghetti network ha!). I'm not going back to that as long as its working, so please don't ask :)
« Last Edit: 2023-12-03, 16:21:36 by James Vella »

2023-12-03, 19:47:52
Reply #55

marchik

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

Version 4.1 Features:
- Now working with Multi-Sub when selecting in object mode.

Notes:
- Thanks for the bug notification marchik!
- As always save your scene before using the script. Multiple undos when using MappingRandomizer & Triplanar can crash your scene. I think its due to how 'Additional Mapping' works but thats far too complicated for me to understand what its actually doing.
- As for the selection order, that could be pure co-incidence after some more testing. Give me your feedback while you use the script since now I have no idea what order its doing it in but it seems to be OK for the most part.
- In regards to your specific comment romullus, that bump/displacement ordering in Physical is due to the ordering of the naming in the subanims. The Legacy and Physical have different naming conventions within the material (on the backend). Its a bit of a pain to work with but I'm sure the Corona team have more experience with this stuff than I do... either that or they are also pulling their hair out. I think I like my grey streaks so ill be doing my best to keep my hair for now =D
- Also due to the nature of how the new buttons work (ColorCorrect Diffuse and or Translucency) that will definitely switch the order of inputs/outputs. The more you use it the more you will understand why it works this way, but to put it simply it needs to process all the other bitmaps like gloss, bump, height etc as well as keeping track of the diffuse/translucency. This also applies to the additional node you get when you do it in reverse order (Mapping/Triplanar then Color Correct. If you are doing it in reverse order for whatever reason you're going to have to put up with an extra node in your spaghetti network ha!). I'm not going back to that as long as its working, so please don't ask :)

I think I've found an issue, in the previous version when you select materials and apply the script - it creates a CoronaUVWRandomizer map for each material, 4.1 creates one UVWRandomizer map for 2 materials. I've attached a video to explain

PS similarly, I thought that you could teach it to work with CoronaLayeredMtls applied to an object, similar to Multi/Sub-object, so that it will create map for all materials that are connected to this CoronaLayeredMtl

PPS please tell me how I can make a donation so you can buy yourself a couple of pints of good beer and wet your gray hair :D

2023-12-04, 05:24:07
Reply #56

Tom

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

Thanks a lot for these new versions James, this is excellent.

I was just asking why you guys would ever want to add a CoronaMappingRandomizer or a Triplanar map to foliage materials ? I don't honestly see what's the point doing that, as it will mess up the already existing mapping of the model. Can you explain?

I tried version 4.1, it works really well so far.
The thing is, when I deal with vegetation material, what I usually do is:

_ colorcorrecting the diffuse channel
_ plugging the diffuse into a new colorcorrection map, that I plug into the translucency slot

The color correction on the Translucency slot has pretty much all the times the same settings, the ones you can see on the screenshot below.

And here your script doesn't help as it doesn't put the color correction at the right place, so I have to do it by hand (again, have a look at the screenshot to see what I mean).

If this is something you could allow for the script to change, that would be fantastic, if not, that's ok too, your script is already very useful as is and, like Marchik said, more than happy to do a donation for it, thanks again.


2023-12-04, 09:50:44
Reply #57

marchik

  • Active Users
  • **
  • Posts: 258
    • View Profile
Hi guys,

Thanks a lot for these new versions James, this is excellent.

I was just asking why you guys would ever want to add a CoronaMappingRandomizer or a Triplanar map to foliage materials ? I don't honestly see what's the point doing that, as it will mess up the already existing mapping of the model. Can you explain?

I tried version 4.1, it works really well so far.
The thing is, when I deal with vegetation material, what I usually do is:

_ colorcorrecting the diffuse channel
_ plugging the diffuse into a new colorcorrection map, that I plug into the translucency slot

The color correction on the Translucency slot has pretty much all the times the same settings, the ones you can see on the screenshot below.

And here your script doesn't help as it doesn't put the color correction at the right place, so I have to do it by hand (again, have a look at the screenshot to see what I mean).

If this is something you could allow for the script to change, that would be fantastic, if not, that's ok too, your script is already very useful as is and, like Marchik said, more than happy to do a donation for it, thanks again.

no, of course I don’t add triplanar or randomizer for vegetation. I actually thought that this could be done in the form of a separate script, but having everything in one script is also convenient.

I agree about the sequence for transluency color, it would be more convenient, I didn’t think about it

2023-12-04, 17:00:17
Reply #58

James Vella

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

Version 4.2 Features:
- Fixed Randomizer & Triplanar to work as it did previously in Version 3.4
- Works with object selection: Multi-Sub & CoronaLayeredMtl

Notes:
- I noticed an issue with the Color Correct Diffuse + Translucency. This button doesn't do what it should when selecting a single material. This should be fixed when I re-write the code for 4.3 with the updated functionality for Tom.

I think I've found an issue, in the previous version when you select materials and apply the script - it creates a CoronaUVWRandomizer map for each material, 4.1 creates one UVWRandomizer map for 2 materials. I've attached a video to explain

Ah yeah, I messed it up trying to refactor/clean up the code. Thanks for the feedback.

PS similarly, I thought that you could teach it to work with CoronaLayeredMtls applied to an object, similar to Multi/Sub-object, so that it will create map for all materials that are connected to this CoronaLayeredMtl

Done.

And here your script doesn't help as it doesn't put the color correction at the right place, so I have to do it by hand (again, have a look at the screenshot to see what I mean).

If this is something you could allow for the script to change, that would be fantastic, if not, that's ok too, your script is already very useful

Ill take a look at this for Version 4.3, I wanted to fix these issues first with Randomizer & Triplanar so you can keep working as normal with the latest version. I thought it was going to be an easy change but its actually far more difficult that I first thought. Let me think about it some more, I'm sure its possible.

PPS please tell me how I can make a donation so you can buy yourself a couple of pints of good beer and wet your gray hair :D

more than happy to do a donation for it

Ha thanks guys, no need.
« Last Edit: 2023-12-04, 17:20:01 by James Vella »

2023-12-04, 18:13:01
Reply #59

marchik

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

Version 4.2 Features:
- Fixed Randomizer & Triplanar to work as it did previously in Version 3.4
- Works with object selection: Multi-Sub & CoronaLayeredMtl

Notes:
- I noticed an issue with the Color Correct Diffuse + Translucency. This button doesn't do what it should when selecting a single material. This should be fixed when I re-write the code for 4.3 with the updated functionality for Tom.


I finally decided to test and figure out how it would actually work with a real asset and at the moment I imported a tree that in its material has a separate map for diffuse and a separate map for tranc color, after using the script we get what the map for tranc color not used at all. (attached a video)

In real production (before applying all the scripts) we usually have 3 situations:

1) diffuse and tranc color are specified by different independent maps "X" and "Y"
2) Map "X", goes into the Diffuse slot and in the Trans Color slot there is a map "X", but passed through ColorCorrect.
3) The same map "X" goes into the Diffuse and Trans Color slots.

After applying the script, we should get a Corona Color Correction map, which would allow us to change the parameters for the Trans color slot regardless of Diffuse. And this should work for all 3 cases I mentioned. In other words, the script must be applied “from the end” creating CoronaColorCorrect immediately before entering the material, regardless of what was inserted into the Trans color slot before.