[Closed] Maxscript V-Ray material creation?
I’m trying to find an easy way to make V-Ray materials done in Maya into Max ones via Maxscript by parsing Maya material presets. Has anyone scripted V-Ray material creation before? I really don’t know where to start since I don’t know much about Max or getting the scriptable attributes for nodes in Max. I’m not worried about the actual parsing from the Maya material – that I’ll do with some Unix filters once I know what it needs to look like in the end. But if someone can give me a good link to get started on V-Ray materials and Maxscript, or how I should get these attributes, it would be appreciated. I really wish Max’s presets were human-readable, it would save a lot of trouble.
Here’s what the Maya attribute preset looks like for a simple metal:
// requires maya "8.0";
startAttrPreset( "VRayMtl" );
blendAttr "diffuseColorR" 0.5529412031;
blendAttr "diffuseColorG" 0.3372549117;
blendAttr "diffuseColorB" 0;
blendAttr "reflectionColorR" 0.5529412031;
blendAttr "reflectionColorG" 0.3372549117;
blendAttr "reflectionColorB" 0;
blendAttr "hilightGlossiness" 0.8999999762;
blendAttr "reflectionGlossiness" 0.8999999762;
blendAttr "reflectionSubdivs" 20;
blendAttr "useFresnel" 0;
blendAttr "fresnelIOR" 1.299999952;
blendAttr "reflectOnBackSide" 1;
blendAttr "anisotropy" 0;
blendAttr "anisotropyRotation" 0;
blendAttr "refractionColorR" 0;
blendAttr "refractionColorG" 0;
blendAttr "refractionColorB" 0;
blendAttr "refractionGlossiness" 0.8999999762;
blendAttr "refractionSubdivs" 20;
blendAttr "refractionIOR" 1.299999952;
blendAttr "fogColorR" 1;
blendAttr "fogColorG" 1;
blendAttr "fogColorB" 1;
blendAttr "fogMult" 1;
blendAttr "affectShadows" 1;
blendAttr "affectAlpha" 0;
blendAttr "traceReflections" 1;
blendAttr "traceRefractions" 1;
blendAttr "cutoffThreshold" 0.009999999776;
blendAttr "brdfType" 1;
blendAttr "bumpMapR" 0;
blendAttr "bumpMapG" 0;
blendAttr "bumpMapB" 0;
blendAttr "bumpMult" 1;
blendAttr "opacityMapR" 1;
blendAttr "opacityMapG" 1;
blendAttr "opacityMapB" 1;
endAttrPreset();
I have very basic maxscript knowledge, but I’ve dome some vraymtl automated stuff with maxscript, you can always turn on the macrorecorder in the maxscript listener (F11) to find the scriptable attributes for nodes.
But I guess this topic in the area will help you a lot:
http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/converting-an-objects-display-color-to-a-vray-material/page-last/
so on to the Maxscript newb questions. Now that I have the creation and attachment of V-Ray materials working, how do I modify the settings he mentions in that thread? In Maya, you use “setAttr yadda.yadda” so how would you go about changing the colour value for this created material?
Edit – nevermind – I just realized it’s right in front of my face.
is there a way to get a line number for script errors? It just gives me a large number that isn’t very helpful.
The large number should be the character number. You can input it to Destination Offset in Go to… dialog (CTRL + G in new maxscript editor, in legacy maxscript editor it’s called Character number and the shortcut for Go to… dialog is CTRL + J)
thanks. I’ve got a converter working now – I right click a Maya mat and it kicks out a Maxscript to create a V-Ray Max material with those values. I’d share it but I don’t think man of you are running Max in a virtual machine in OS X It’s a Unix shell script.
this is what I ended up making. thanks for the help:
Nice job, I’ve read @chaosgroup forum that Vlado is working on a cross platform material description that both vray for maya and max could save and read. But until this format is not available its nice to have a script that does it, even though its for mac only by now. I think you could just output a txt file with the vraymtl properties from maya and make max read it with maxscript, then it could work for every platform.
BTW, I think its not good to hate a software so much like you always post, lets have a beer and forget this hating software crap.