Corona Physical to Autodesk Physical Material Converter

By user request I am releasing this script for free. Script attached to this post.

Notes:

  • You can copy/paste, change, learn from it or do whatever to suit your own workflow if you know maxscript.
  • Works on scene materials (any object with a Corona Physical Material applied). Not on selected objects so be aware this will convert everything in that scene.
  • Currently works with Standard Bitmap, not CoronaBitmap. For example will keep the bitmap as CoronaBitmap instead of converting it to Standard, will update in next verison.
  • Be aware this is version 01 so there is probably issues to iron out, your feedback is required to make this better. FYI I don’t plan on developing this long term, maybe or maybe not, no promises but for the time being happy to work on it in my spare time.

Install:

  • Drag the script into your 3dsmax viewport.
  • Customize > Customize User Interface > Toolbars > Category: Vella > Automate CoronaToPhysical

Version 1.0 Features:

  • Base Color
  • Roughness or Glossiness
  • Anisotropy Amount / Rotation
  • IOR
  • Metal
  • Refraction (could be incorrect, still trying to work out how this works in Autodesk Physical)
  • Thin Shell
  • Opacity
  • Emission / Self-Illumination
  • Normal / Bump (numeric values kept default 0.3, let me know if this is an issue)
  • Displacement
  • Clearcoat Amount / Roughness / Bump
  • Numerical values such as Base Color Amount, Roughness Amount, IOR value etc.
  • Color swatches such as Base Color, Self-Illumination etc.

Exporting to FBX:

  • FYI, export does not support the use of the ‘Additional Bump’ parameter. I have kept it for now since it will work directly in 3dsmax but could create an issue for exporting to FBX. Your feedback is required as I don’t know the real-world implications.
  • Currently all nodes are kept during the conversion so this also poses a problem for exporting to FBX. For example if you have your Base Color in a Falloff node then the Falloff is kept on conversion. Again real-world examples can help. I might even put a pop up if you prefer such as “Are you exporting to FBX Yes/No?”. This way you can either keep all the nodes or just keep the bitmaps.

Corona Physical Material:
corona.jpg

Autodesk Physical Material:
phys.jpg
JV_CoronaToPhysical_v1.0.ms (9.35 KB)

Hi James, thank you for the effort! I would love to try your script, since converting from Corona to Autodesk physical material is what i do quite often, but the problem is, that i almost completely adopted Corona bitmap by now and it looks that your script is not supporting it. If at any point you will bring support for Corona bitmap, i will be first in line to test the script and provide you with the feedback. And again, thank you for doing what, honestly speaking, should have been done by Corona team long time ago.

:smiley: Working on it now

Script attached to this post.

Hmm it works but not in the way I wanted it to. I wanted it to be recursive, ill work it out later but for now you can use the updated version which will do the job (Corona Bitmap to Bitmap).

Notes:

  • Just a test for now since it should copy all the bitmap settings as well like coordinate offsets, real-world, blur etc. That will be the next small update.

Version 1.1 Features:

  • Corona Bitmap to Standard Bitmap conversion

Corona Physical Material:
cb-corona.jpg

Autodesk Physical Material:
cb-phys.jpg

JV_CoronaToPhysical_v1.1.ms (12.5 KB)

Nice!! I will let you know how it worked, once i have time to test it. Thank you very much! :]

Tried both scripts briefly and i love them! I found few small issues with CP->AP script.

1 - anisotropy mapping is completely wrong. Judging from the visual preview the tool sets anisotropy to some off the charts value that’s not even possible to set with the spinner. And that happens even if Corona material has zero anisotropy.
2 - bump strength gets ignored, it always converted to Autodesk’s stupid default 0,3 which is really annoying. On the other hand i love when that happens with your other script, because in that case script inadvertently fixes stupid incoming bump to Corona’s proper default, which is not good when you’re working with old fashioned bump maps and arbitrary strength values, but great when you’re dealing with normal maps.
3 - cosmetic issue - when Corona physical is populated with Corona bitmaps, the script replaces them with standard bitmaps and strips paths from the Corona bitmaps, which leaves empty CB husks. Maybe it would be possible to handle this somehow more elegant if not too much work for you?

Overall i really like those two little tools a lot - saves quite some manual work!

Sure thing.

  1. Yeah the anisotropy is very different between the 2 engines. I had a feeling there was more work to do on this. Actually I made a typo so actually broken so ill update this soon and try it out and let me know your findings. This is with the typo fixed, weirdly the values show the same but the material ball looks correct, take a look at the bottom of this post. Its almost like the material editor doesnt update the values correctly but should be working… I might be missing something.

  2. Can you show me what you prefer to happen with the bump map with some screenshots?

  3. What do you mean empty CB husks? Can you show some screenshots?

Anisotropy:
anis-0.jpg

anis-1.jpg

anis-2.jpg

anis-3.jpg

Maybe also put your feedback for the Corona Physical to Autodesk Physical in that thread to keep it separate from this script for less confusion. - Conversation moved back to this thread, ignore this comment.

Ok give it a try, let me know your findings. Script attached to this post.

Version 1.2 Features:

  • Bump & Normal map numeric values copied from Corona.
  • Bitmap gamma from Corona and Corona Bitmap.
  • All bitmap settings copied from Corona Bitmap (excluding the Output Curves).
  • Anisotropy fix (hopefully, might need further testing as I have my doubts).

JV_CoronaToPhysical_v1.2.ms (14 KB)

I tried 1.2 and i see some issues has been fixed. Thank you!

1 anisotropy - zero anisotropy is now converting to 0 in Autodesk physical as well, all other settings are still wrong. I think that might be because i’m using Max 2024 and it seems you’re still on the older version. It seems that Autodesk has changed something in the Physical material code, because i see in your screenshots that anisotropy has 0 to 100 (or -100 to 100) range, but in Max 2024 it has -1 to 1 range. Either way, i’m quite happy with this result so far, because i rarely use anisotropy, especially in materials that i need to “downgrade” to ADSK physical.

2 - bump strength is now handled correctly, but the script no longer converts Corona normal node to Max normal node - i think it did so in previous version. Could you look into that please?

#3 - it looks that the issue with the stripped Corona bitmap paths is gone. Script works correctly here.

One additional issue - i noticed that if Corona bitmap is not plugged directly to material, but through some other Max node, like mix, composite, etc., then script does not convert those Corona bitmaps to regular bitmaps and leaves them like they are. It would be great if this can be fixed.

Ah yes that would be much better actually with a -1 to 1 range. Unfortunately Im not using 3dsmax 2024 yet but might look into it soon. Dont hold your breath on this one.

Ah crap I broke it, thanks ill address this in the next update.

Great!

Ah yes you are correct, I can take a look at this for the next update. It wasn’t working previously (it does work with standard bitmaps, not corona bitmaps). Thanks for spotting this. Also on this you want to keep those mix / composite nodes right? Hmm composite node should be fun lol.

I think something like 95% of my converted materials are very simple, consisting of single bitmap node plugged into material slot, so personally for me it’s not very relevant. I just accidentally noticed this issue and decided to report in case it’s not too complicated to fix. If it’s too much hassle to keep existing node structure, i would be content if the script would simply convert Corona bitmaps to bitmaps and plug those bitmaps directly to material (first bitmap in line would be fine, i guess), just please do not delete old composite, mix, or whatever nodes, so user could have reference how to rebuild the old node structure. That’s my point of view on this. Other users might have other opinions, but since nobody else seems to care to give you the feedback… ;]

Hah yeah I also just use simple setups, but it would be nice for it to keep those nodes. Hopefully when I get my head around it ill post an update on that but… there is a workaround for now since its far more complicated than I expected.

Before you use the script use the Corona Converter to convert CoronaBitmap to Bitmap. This will keep all nodes in-tact mix/falloff etc and also makes sure all Bitmaps work correctly. This also means all your Output Curves and specific Bitmap settings all carry over correctly too:
cbitmap.jpg

Script attached to this post.

Version 1.3 Features:

  • Fixed Normal node for Physical material with Normal/Bump textures

Edit:
Also if any devs would like to chime in as to why its so hard to recursively look for CoronaBitmaps that would be very useful insight. For example when recurvisely looking for standard bitmaps it works fine, when I try the same method with CoronaBitmaps I keep hitting walls.
All good, think I worked it out. Think it has to do with classinstances, probably easier to use that than what Im currently doing.
JV_CoronaToPhysical_v1.3.ms (14.1 KB)

Ok fixed the CoronaBitmap conversion issue scene wide, turns out I was just overcomplicating it - noob mistake.Script attached to this post.

Version 1.4 Features:

  • Converts CoronaBitmap to Standard Bitmap scene wide
  • Keeps all nodes in the hierarchy eg. Diffuse > Falloff > Basecolor.png or Composite nodes etc. Doesnt really matter how deep the hierarchy goes it just searches for the Bitmaps/CoronaBitmaps.

Notes:
The official Corona converter which converts CoronaBitmap to Bitmap is far more fleshed out than this. It also handles Curves in the Output which mine doesn’t. Ill get to this one day if its a user request. For now more interested in finding bugs in the current code or implementing other features that are necessary (user feedback).
JV_CoronaToPhysical_v1.4.ms (11.8 KB)

Hi,

Thanks for your work, just a note because I quickly looked at the script. As you have discovered, using the getClassInstances way is the best to go. I’d not just walk through the materials and convert if CoronaPhysicalMtl or Multisub classes are found (“for i in sceneMaterials do”), but just like this instead:


	for i in getClassInstances CoronaPhysicalMtl do
	(
		p = convertToPhysicalMtl i
		replaceInstances i p
	)

This way you get all CoronaPhysicalMtls, even those plugged into a Blend material for example. And you do not have to care about supporting all classes able to handle multiple material inputs. Same of course when it comes to CoronaBitmap conversion. For the latter, you may examine Martin Geupels original Corona converter script. Search for function “convertCoronaBitmapToBitmap” and “convertFrom_CoronaBitmap”. Not sure when looking at the license info in the header if you would be allowed to just copy convertFrom_CoronaBitmap().

And: please check “animate off” context :smiley: You could wrap the entire script into one to make it easy :smiley:

Good Luck

Thanks Frood! Ill take a look at this when I’m fresh tomorrow.

Very good point about Blend materials, I didnt even consider that!

Yes I did see some script references with animate off, I was wondering if it makes much of a difference. Is that for the user in case they have it switched on?

Hi,

yes, you are creating animation keys running the script without using “animate off” and having autokey active.

Good Luck

Holy crap, thanks Frood that is one hell of a shortcut. Thank you!

This is very helpful while I stumble my way through maxscript :smiley:

Please feel free to join in the thread every now and then and guide my stupidity :smiley:

Script attached to this post.

Version 1.5 Features:

  • Bugfix: Normal_Bump, when ‘add gamma’ is used and texture is loaded as 2.2, automatically applies gamma 1.0 to Normal_Bump texture.
  • Updated replace CoronaPhysicalMtl method: thanks to Frood. Which means it searches through all hierarchies such as Blend/Multi-Sub/Nested Multi-sub etc.

Corona Physical Material:
corona.png

Autodesk Physical Material:
phys.png
JV_CoronaToPhysical_v1.5.ms (11.7 KB)

Hi James, found another minor issue. When converting Corona material and maps with stripped paths, only maps in Base colour slot remains with stripped paths, all other maps have they paths fully linked (assuming that before conversion their status was “found”). Not a biggie really, but if it’s not too much work to fix this, that would be quite nice.

Script attached to this post

Version 1.6 Features:

  • Converting now works with stripped texture paths

Test it out and let me know if its working how you expect.
JV_CoronaToPhysical_v1.6.ms (12.3 KB)