Author Topic: Corona Physical to Autodesk Physical Material Converter  (Read 6263 times)

2023-07-17, 16:58:22
Reply #15

Frood

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

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


Good Luck



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

2023-07-17, 17:53:30
Reply #16

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
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:

Code: [Select]
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 :) You could wrap the entire script into one to make it easy :)


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 :D

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

2023-07-18, 14:09:21
Reply #17

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
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" border="0

Autodesk Physical Material:
phys" border="0
« Last Edit: 2023-07-18, 14:13:08 by James Vella »

2023-07-21, 21:30:25
Reply #18

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8854
  • Let's move this topic, shall we?
    • View Profile
    • My Models
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.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-07-22, 20:47:31
Reply #19

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
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.

2023-07-22, 21:25:50
Reply #20

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8854
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Thank you!! I will let you know if i run into some more issues.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-07-22, 22:17:54
Reply #21

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
No worries.

One thing that got me thinking is that since it takes the whole node tree (Falloff > Mix > Bitmap) it could potentially be an issue for those who use any Corona classes such as (CoronaColorCorrect > Bitmap) or (CoronaMultiMap). Considering those 2 classes alone have things that dont translate to standard (Color Correct) then it wouldn't appear the same anyway. I would also like to keep the script simple (for now) with just a click/run scenario instead of building a UI that asks you questions.

Maybe once this one is bug free and covers most user requests (which is just you so far romullus haha) ill just adapt it to a second script that removes all corona class nodes between the Diffuse > Bitmap. This would be the FBX exporter version of this script. Just me thinking out loud FYI.

2023-07-23, 07:08:44
Reply #22

James Vella

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

Version 1.7 Features:
- Bugfix for CoronaNormal resetting bitmap settings (U/V offset etc.) when using CoronaBitmaps

2023-07-24, 15:54:02
Reply #23

James Vella

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

Notes:
- I updated the script to match how it works in the PhysicalToCorona script scene wide, only for objects with materials applied. Figured you might want this for this script as well romullus :)
- Just realized another bug when Add Gamma is enabled... wont copy bitmap settings such as U/V offsets etc. Ill come back to this with a fresh head. (these CoronaBitmaps are not so easy to work with, its difficult to troubleshoot :S)
- Ok worked out that bug above, updated in this version.

Version 1.8 Features:
- Materials convert only for scene materials that are applied to objects
- Bugfix for CoronaNormal stripped paths reverting when 'Add Gamma' enabled
« Last Edit: 2023-07-24, 16:43:50 by James Vella »

2023-07-24, 18:44:29
Reply #24

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8854
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Nice! Thank you! :]
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-07-25, 10:26:15
Reply #25

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8854
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Hi James,

I noticed an issue that is not directly related to your scripts, but rather to how Max is managing the scripts and customization. I dragged your scripts to the viewport and added them as a buttons to the toolbar. max automatically has copied the scripts to 3ds Max>ENU>usermacros folder for future reference. So far so good. The issue is that now when i download new version of your script and drag it to the viewport, Max is updating the script, but doesn't copy it to usermacros and referencing to it from download folder instead. This is especially problematic because after restart old version from the usermacros folder is being used and not the recent version, unless i drag and drop the newest file again. I probably could rename the recent script file and place it to the usermacros folder manually and that should work permanently, but since your scripts are being developed at the rapid pace, that procedure would be quite a chore. I wonder if there's more convenient way to handle this?

P.S. i just realized that because of this issue, i might had given you false feedback quite a few times :/


Scratch that, it looks like i misunderstood how Max is handling this, when it copies script to the usermacros folder, it strips comment section with script version and that part has confused me. It looks that actual script is updated properly and i was always using the recent one. Sorry for the confusion.
« Last Edit: 2023-07-25, 10:35:40 by romullus »
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-07-25, 12:34:32
Reply #26

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile

2023-07-25, 13:50:34
Reply #27

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8854
  • Let's move this topic, shall we?
    • View Profile
    • My Models
All good. Maybe if you could move comments section after "macroscript" line, so that 3ds Max won't be stripping it away and the user would have ability to quickly check which version he's using, that would be nice.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-09-13, 13:10:53
Reply #28

Ink Visual

  • Active Users
  • **
  • Posts: 169
    • View Profile
Hi James!
Many thanks for you script, it works great!
I encoutered a problem in one of our scenese where it gave me an error referring to one of the Corona Mix maps we were using.
All converted fine when I removed this map from the scene. Shall the script be also converting Corona Mix map  to composite?
Thanks!

2023-09-13, 14:03:51
Reply #29

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Thanks for the feedback and comments Ink Visual.

Converting to composite will be quite a big job, Ill take a look later this week and see if something is doable - otherwise no plans at this stage.

Regarding the script crash, I can update it so it warns you instead but continues to work either way.

As an alternative do you think it would be ok to extract the "Base Layer" and use that bitmap instead? Or do you need the composite for Physical material?