Author Topic: Corona Mask Manager 1.0 Alpha  (Read 11112 times)

2015-05-24, 01:37:59

Gabriel Sumner

  • Active Users
  • **
  • Posts: 12
    • View Profile
Hi everybody,
a quick share of a script me and my bro were working on. It had to be a quick one, as I needed it asap in production.
What's the deal? Well, I haven't found an automated renderMask creation script for Corona so far, like AutoMatte for vray for instance (maybe i didn't search enough...)

First try was to create a wire color assign script, which was kindly provided by my brother (as well as the main window and ui programming).
While he was busy with this part, I delved deep into photoshop javascripting, i always find it fascinating to automate something :D
But not being a scripter at all (had just a bit of Java programming some years ago), i put together some pieces and made some really rough rapid prototyping of automatic mask extraction.
Soon I realized that wire color pass was leeding nowhere, as too much mask cleanup in photoshop would have been required.
So i turned to Mono Masks, and added this functionality as well.


wire color extraction in photoshop

wireColor assigment

resulting render elements

1) Maxscript: Corona Mask Manager 1.0 Alpha || Basic functions:
  • search scene for all assigned materials and assign 16. predefined wire colors to them. I didn't (and don't) need more for the project. If required you can change the array at anytime to add more colors. Predefined wire colors can be change for individual materials by selecting a material from the list and using the "Pick Wire Color" selector
  • create mono masks for all assigned materials, based on selection list includes
  • rename mono mask elements according to their correspoding materials (files can be easily stacked later in PS so you know which mat is behind each mask)
  • (pending) toolbox with currently a single function to "select objects by mat" (so I didn't have to use material editor for that)
Install: just run the ".ms" file

2) Photoshop javascript: coronaMaskManagerExtractor_1_0_alpha.jsx || Basic functions:
   On the currently opened file perform automated wire color extraction, based on the predefined wire colors in maxscript. At  any time additional colors can be added to the predefined color array.
As I stopped using it and turned to "mono masking" i just provide very few info here:
  • the extraction can fail due to resolution for very tiny objects (due to fixed color range threshold inside the script). The solution is to change the threshold value;
  • in my tests saving a ".tif" or any other non-HDR file out of corona VFB resulted in wrong wire color values (there is a slight shift). Due to that the script fails in most cases. Solution: save an "EXR"-wire color pass and conver to 8 bit in photoshop
  • i had better experience with "non-AA" wire color passes while refining the mask edges after the extraction process. Sidenote: "refine edge" functions in photoshop works differently from standard photoshop "smooth", "feather" etc. so use this if you want to feather and clean up the wire color masks.
Install: drop both files from the "zip" archive in the same folder, then in photoshop open up an image you need the masks to be extracted on. Go to "File > Scripts > Browse..." and select the file "coronaMaskManagerExtractor_1_0_alpha.jsx"
 
Overall notice: I had to work quickly and very rough, so I took a lot of little snippets from the internet. So expect a lot of bugs, as there are probably a lot of situations for the scripts to fail.
The major credits are listed in the header, if somebody feels his / her name is missing let me know. The script is a prototyped tool, I provide it as is, hope somebody can make use of it :)  Please take note of know issues in the maxscript header.
Everyone is free to add / modify anything to their liking, I will be happy to see this thing evolve in time. My current road map is listed in the header as well, provided i get some spare time ;)

Download the files here:
http://www.mediafire.com/download/c278ztimq9u36b4/CMM_1_0_alpha.ms
http://www.mediafire.com/download/43d6dxd5rmu1yz4/coronaMaskManagerExtractor_1_0_alpha.zip

CheerZ,
G.S.

2015-05-24, 10:22:37
Reply #1

GestaltDesign

  • Active Users
  • **
  • Posts: 64
    • View Profile
Great stuff Gabriel, this will save me a lot of hassle on current projects!
Really appreciated, many thanks!

2015-05-24, 11:33:52
Reply #2

Gabriel Sumner

  • Active Users
  • **
  • Posts: 12
    • View Profile
You're welcome! Be aware of bugs I didn't manage to sort out ;)

2018-02-13, 07:28:50
Reply #3

sverlo

  • Users
  • *
  • Posts: 1
    • View Profile
 Hi, Gabriel, and is it possible to make a script which will create mono-Cmasks from a selected layer (all objects in it)? with the name of this layer?

Thanks,

2020-04-17, 08:21:17
Reply #4

cjwidd

  • Active Users
  • **
  • Posts: 1077
    • View Profile
    • Artstation
@sverlo were you able to improve the script in the manner suggested?