[DEPRECATED] Material Converter

This thread is for archive purposes only, use the convertor here: Corona Material/Lights Converter (legacy) - Corona for 3ds Max :: User Contributions - Chaos Forum

Hi everyone. I decided to create material converter from Vray materials to corona.
So here is the first version.
Script converts all scene materials which are:
VrayMtl
VrayLightMtl
Vray2SidedMtl
MultiMaterial
Be carefull and save your scene before converting script may crash max.
corona_scene_converter_1.0.mse (16.3 KB)

It would be nice if you could leave your code unencrypted. Related to their “TODO” naming, Corona Material maxscript functions will sure be changed somewhat soon and it would be much easier if such a converter could be improved by several people.
I started writing a converter too this weekend but there are 1 or 2 map slots which are not working properly and I’m not finished supporting finalRender and MentalRay materials. I also included converting maps (like vraydirt, vraycolor, etc) but there seem to be some native max maps which will lead to a crash with corona. I’m still trying to figure out which ones.

Dead Clown if you can convert Arch&Design to Corona that would be awesome !

I’ve converted so many scenes over the last couple of months and its a pain.

I’ve been after a material converter for months now.

I’m not to fussed about material settings, just mainly mapping paths.

Nice work GroveR, I’ll test this out with the couple of Vray scenes I have.

thanks

Ok, here is unencrypted code:
corona_scene_converter_1.0.ms (16.7 KB)

Javadevil: I’ll try to get Arch&Design mats done next weekend, currently there’s no time for scripting :wink:
GroveR_GoL: Thanks! :smiley:

Hi,
this is great! If you need any support from my side, let me know. I can also distribute it bundled with future builds.

BTW: I’ll be renaming and documenting all the parameters for the next build, so they have consistent meaningful names.

Very good :smiley: If you could provide a little “before and after” naming scheme it would be really helpful for us to replace all those already used properties in our scripts.

v0.07: latest version here: http://forum.corona-renderer.com/index.php/topic,66.msg522.html#msg522

Ok, I added some notes and versioning information to my Script for a first testrun.
I started with Vrays Scene converter script which delivered some good base-functions but there’s of course not much left now :wink:
MR ArchAndDesign material is not really tested yet, that would be a perfect job for Javadevil :wink:

Currently the Script is able to convert:

  • Standard mat
  • VrayMtl
  • VRayBlendMtl (just taking the basemat)
  • VRayLightMtl
  • VRay2SidedMtl (uses material 1 and sets translucency to values/maps from 2Sidedmtl)
  • MR_ArchAndDesign
  • Vray-specific maps

There are two available settings:

  • convert Specular settings from Standard Material to reflection in Corona
  • An experimental function to convert Vrays Glossy values to “more or less” similar looking glossys in Corona

RefractionIor mapslot is currently not wired correctly - Coronas map slot is pointing to the reflection ior slot, so I’m unable to convert this.
Be careful with Vray Light materials, it will try to convert those settings and generate an emission slot but this will crash 3dsmax when rendering (coronas emission slot bug). You might want to comment this out while the bug exists.

little update

  • restructured conversion functions, much better now
  • fixed translucency and anisotropy bugs in ArchAndDesign function
  • added a sorted list of all material functions as a start point for other materials (at the end of the file)

fantastic work guys :smiley:

Have you considered using more standard OSS tools, for example versioning & publishing the script somewhere like github or sourceforge?

mhh… Never used any of these things. All my “bigger” Scripts are inhouse tools so I’ve never considered such things. Furthermore, I’m just a self-taught maxscripter, never done any serious programming yet :wink:
Btw, just finished fR_Advanced and fR_Architectural :wink: I just don’t have finalRender for 2012 installed, so I can’t test it until tomorrow. So prepare for another version :wink: But it will be the last one until the new maxscript function names will be released (unless there are some serious bugs of course)

I haven’t either, but it looks like good idea, and helps you to keep track of the releases/lets other download it easily. You should also specify a licence, so the scripts can be safely used. I recommend Apache licence, if you dont mind other making their own versions of the script :wink:

Dead clown,

I’ll add errors I get here.

Heres the first Exception.

1 - Unable to convert : 1.4 type boolean.

If you add an option to convert a selection instead of the whole scene it would make it easier to find the material thats causing the exceptions.

@Rawalanche haha, thats pretty much how I felt.

Dead clown, your code is so cool, I’ve learned some new features from it. Thanks for sharing.

Ok, this should be a stable version.
@Javadevil: Yes, I had swapped two commands here. It tried to convert the Ior value to a checkbox state :wink:
@Keymaster: I will have a look on these license models. But, as this is a widely modified version of the VraySceneConverter I’m not sure if this is would be a “fair” thing to do. Anyway, I added a short comment at the beginning of the Script.
@GroveR_GoL: Thanks! I learned a lot from other people’s scripts, so I try to always keep my code open to others :smiley:

v0.04
supported materials:

  • Standard mat
  • VrayMtl
  • VRayBlendMtl
  • VRayLightMtl
  • VRay2SidedMtl
  • Vray-specific maps
  • MR_ArchAndDesign
  • fR_Advanced
  • fR_Architectural

changelog:

  • Added fR_Advanced
  • Added fR_Architectural
  • fixed ArchAndDesign problems: anisotropy spinner*10, use refractmap slot, removed alpha from reflectioncolor
  • added Debug conversion functions, will be removed or refined later
  • Blend material works now
  • Shellac will be converted to Blend (zero mix)
  • DoubleSided will be converted to Blend (zero mix)

There is a new radiobutton control in the UI:

  • all materials + maps , converting all materials and maps in the scene
  • sel. objects materials (Debug) , for debugging purposes: It will convert the material assigned to the selected object(s). Note: If the objects material is also in a Materialeditor slot it will only modify the one on the object. Materialeditor slot will stay untouched (resulting in loosing the connection to the sel. objects)
  • current Mat.editor slot (Debug) , same here vice versa. selected MatEditor slot will be changed, objects materials stay untouched

Removed blend Material conversion and added non-destructive shellac and DoubleSided conversion

Only one thing. Plaese put brackets like this

rollout CoronaConverter “Convert Materials to Corona” width:200 height:160
(
groupBox grp1 “standard Materials” pos:[8,8] width:184 height:40
checkbox chkReflstandardMat “convert specular to reflection” pos:[16,24] width:168 height:16 checked:standardMatSpecToRefl
groupBox grp2 “Vray Materials” pos:[8,56] width:184 height:56
checkbox chkConvVrayGloss “convert glossy values (experimental)” pos:[16,72] width:168 height:32 checked:VrayConvertGlossyValues
button btnStartConverting “Convert Mats + Maps” pos:[8,120] width:184 height:32

	on chkReflstandardMat changed state do
	(
		standardMatSpecToRefl = state
	)

	on chkConvVrayGloss changed state do
	(
		VrayConvertGlossyValues = state
	)

	on btnStartConverting pressed do
	(
		mtlsToCorona()
		format "Converting unsupported maps...\n"
		ReplaceUnsupportedMaps()
		format "Done.\n"
	)
)

and not like this

rollout CoronaConverter “Convert Materials to Corona” width:200 height:160 (
groupBox grp1 “standard Materials” pos:[8,8] width:184 height:40
checkbox chkReflstandardMat “convert specular to reflection” pos:[16,24] width:168 height:16 checked:standardMatSpecToRefl
groupBox grp2 “Vray Materials” pos:[8,56] width:184 height:56
checkbox chkConvVrayGloss “convert glossy values (experimental)” pos:[16,72] width:168 height:32 checked:VrayConvertGlossyValues
button btnStartConverting “Convert Mats + Maps” pos:[8,120] width:184 height:32

	on chkReflstandardMat changed state do(
		standardMatSpecToRefl = state
	)

	on chkConvVrayGloss changed state do(
		VrayConvertGlossyValues = state
	)

	on btnStartConverting pressed do(
		mtlsToCorona()
		format "Converting unsupported maps...\n"
		ReplaceUnsupportedMaps()
		format "Done.\n"
	)
)

otherwise “toggle all folds” function does not work. Thanks.

One more question. How about Blend, Shellac, DoubleSided materials? Why you create empty corona material instead of them? Blend material works fine in corona, doesn’t it? What if convert Vray blend to simple blend with multi nesting.

The simple answer is: I didn’t test blend/shellac materials yet :wink: . Personally, i don’t use any of them, that’s why I didn’t spent time on these yet. If you need those you can simply comment their classes out (“-- Blend: CreateDefaultCoronaMtl orig_mtl”) - that will keep blend materials the way they are, submaterials should still convert properly.

updated v0.04, blend works now, shellac and doublesided are converted to blend materials.

Thanks Deadclown,

Just ran it through a scene with some cars in it. They all had Mental ray car paint shaders.
Can the script convert them too ? just to default corona mats ?

cheers