Chaos Corona for 3ds Max > [Max] Corona Goodies - User Contributions

Autodesk Physical to Corona Physical Material Converter

(1/4) > >>

James Vella:
Ok well I cracked something together, again without some real-world examples it may be missing some features or break (see the screenshot at the bottom). Feel free to give me feedback and send me some material cases. Warning: Still in test phase, save your files and don't send me death threats... pretty please. Script attached to this post.

This is what it converts:
- Diffuse (if it cant find Diffuse texture it will use the Swatch Color)
- Roughness
- Opacity
- Metal
- Normal
- Multi-Sub materials supported

Other notes:
- Autodesk Physical Material to Corona Physical Material
- Using CoronaBitmap nodes instead of standard Bitmap nodes
- Keeps naming convention from Physical Material map nodes instead of 'CoronaBitmap' naming
- Gamma 2.2 for Diffuse, Gamma 1.0 for all other textures
- Normal texture goes into the 'Corona Normal > Input Image' node. If you use standard Bump I can put a clause in there to swap it over if it doesn't find your naming convention. For example if "_Normal.png" not found in texture name then place in "Additional Bump Mapping" slot instead.
- If Metal texture used then Corona Physical Material switches Metalness to 'Metal'. Again can be scripted to find a value instead and switch it on if < 0 or whatever.
- Careful regarding Metal Materials, follow the PBR guide, for Diffuse textures lowest black value 40, highest white value 240 otherwise your Metals will blank out at lower values. Metal textures still can use the 0-255 range. We could use the standard workflow Corona introduced when converting from Vray materials with Metal but I have my doubts about this 'Mix' value (for those who have done their own comparisons).
- Do not stack Multi-Sub materials within Multi-Subs.
- The script works scene wide, not on selected objects. Only converts Autodesk Physical Materials so wont affect Corona or Vray materials etc.
- Currently only working with bitmap nodes plugged in as per the screenshots below, I need real-world material cases to test all situations. Default material import settings from sketchup or whatever is best for fastest workflow. For example if by default a material imports with multiple nodes between the bitmap and material then this script will not work.

Install:
- Drag the .ms file into 3dsmax
- Customize > Customize User Interface > Toolbars > Category: Vella > Automate PhysicalToCorona > Drag this to your toolbar.
- Click the button

Autodesk Physical Material


Corona Physical Material - Converted with script


Autodesk Physical Material (Multi-Sub)


Corona Physical Material (Multi-Sub) - Converted with script


Example of how the script will break (currently) if there are extra nodes between the bitmaps and the material (In the Autodesk Physical Material). This is why I need real-world examples of imported materials. Once I have a few examples I will put some try/catches in so it skips over anything it cant find so the script will be more stable (Reminder I'm not a pro scripter, there is some recursive things going on I need to get my head around, enough for today).


However there is a fairly simply workaround for now I could do that wont break, that is just copy the entire tree into the nodes. So that means whatever nodes connect to each material input will be retained. This means that the Bitmaps will be standard Bitmap nodes instead of CoronaBitmaps. But you could just use the Corona Conversion script after to convert those from Standard Bitmap to CoronaBitmap if you want, Let me know your thoughts. Here is an example.

James Vella:
Ok update on this. Script attached to this post v01.1.0.

Install:
- Delete the old toolbar button (if you used previous versions)
- Drag the .ms file into 3dsmax
- Customize > Customize User Interface > Toolbars > Category: Vella > Automate PhysicalToCorona > Drag this to your toolbar.
- Click the button

Notes:
- Now works with multiple input nodes (such as color correction, falloff, etc)
- Skips any crashes now using try/catches (for those reading my code, yeah its a bit overkill but better safe than sorry lol)
- Supports the same textures as previously
- Using standard Bitmaps in this version (you can convert using Corona Converter to CoronaBitmap if you wish)
- Gamma 2.2 for Diffuse, Gamma 1.0 for all other textures (as previously)
- Still no nesting Multi-subs in Multi-subs (probably could add this if its a common request, recursive loops still do my head in)
- Undo (ctrl-z)

Autodesk Physical Material


Corona Physical Material - Converted with script


Autodesk Physical Material with additional nodes


Corona Physical Material with additional nodes - Converted with script


Autodesk Physical Material (Multi-Sub)


Corona Physical Material (Multi-Sub) - Converted with script

cumalot:
Hi, tnx for script, but can You make it for legacy corona mtl?

James Vella:

--- Quote from: cumalot on 2023-06-22, 11:23:22 ---Hi, tnx for script, but can You make it for legacy corona mtl?

--- End quote ---

Are you using glossiness or roughness workflow?

For example we have 2 situations:
1. Roughness texture can be put into a Color Correction node (inverted) to appear as glossiness
2. If the Autodesk Physical Material is using glossiness then we just copy that bitmap into the glossiness slot.

Dont worry ill just have it do both depending on which one is being used.

Edit:
Just be aware the reason I went with the Corona Physical is because both are Physical workflows. The Corona Legacy Mtl doesnt have Metal so if your material uses metal then that texture will be removed and the fresnel set to 999. Is this what you expect?

Alternatively you will need a fairly complex setup that does the metal as a mask, a bit of math to transfer the IOR to the Specular which is then used as a Reflection texture, which will mess up any workflow that already uses a Reflection texture. Also the Diffuse controls the color of Metal in Physical instead of Reflection for Legacy. For example if you download a model that is unwrapped with some areas with metal and dielectrics masked in this will not work. Not sure if thats a standard situation for your workflow but again if other people use the script and it gives them strange outputs they will be disappointed. Again examples are a must here, I need to know what users actually need on a daily basis. I dont know how the sketchup files appear on import and how the material setups look so without examples I'm just giving a blanket solution which may not be useful to what people in this thread actually need.

You are best sending me an example scene with 2 boxes, 1 with a metal workflow and 1 with a dielectric workflow.

I have written about the differences between the new Physical and Legacy workflows in the past you can see what I mean - Check the section on "Down the Rabbit Hole".

https://jamesvella.wordpress.com/2020/04/20/2019-9-2-substance-designer-to-vraycorona/

James Vella:
Small update, attached to this post:

Supports both Roughness and Glossiness from Physical Mtl.




Example Glossiness (inverts the texture using a Color Correction node for the Corona Physical Mtl):




If no texture then the Roughness value will be used (or inverted for Glossiness):


Converted from Roughness:


Converted from Glossiness:

Navigation

[0] Message Index

[#] Next page

Go to full version