Is there any way (Mel/Python...) to convert a AiStandardSurface material to a Lambert/Phong/Blinn and still mantain material color properties?
Is there any way (Mel/Python...) to convert a AiStandardSurface material to a Lambert/Phong/Blinn and still mantain material color properties?
Because i have a lot of objects with arnold materials (The project im working on was supposed to be a short) but now they also want a very simple unity project to show the models(Most of them can be flat colors without textures, they just need to see the model itself) and if i export an fbx with arnold materials, it does export the materials but when i do import them in unnity, the flat color is grey, instead of the ones the aiStandardSurface has
Just in case anyone was wondering how.
This is how a friend (Github: @PRZurro) managed to convert just the BaseColor of a aiStandardSurfaceLegacy Shader to the Color of Legacy Shader
string $newMaterialType = "blinn"; string $newMaterial = `createNode $newMaterialType`; string $oldMaterials[] = `ls -type "aiStandardSurface"`; string $oldMaterialsAttr[] = `listAttr -visible -settable -scalar $oldMaterials`; string $newMaterialAttr[] = `listAttr -visible -settable -scalar $newMaterial`; string $ca[] = stringArrayRemove($newMaterialAttr, $oldMaterialsAttr); $ca = stringArrayRemove($ca, $oldMaterialsAttr); delete $newMaterial; string $a; string $b; string $m; float $v; string $cl[]; for ($m in $oldMaterials) { $newMaterial = `createNode $newMaterialType`; $cl = `listConnections -destination true -plugs true -source false -type shadingEngine $m`; connectAttr -f ($newMaterial + ".outColor") ($cl); for ($a in $ca) { $v = `getAttr ($m + "." + $a)`; catchQuiet(`setAttr ($newMaterial + "." + $a) $v`); } float $colorR = `getAttr($m + ".baseColorR")` ; catchQuiet(`setAttr ($newMaterial + ".colorR") $colorR`); float $colorG = `getAttr($m + ".baseColorG")` ; catchQuiet(`setAttr ($newMaterial + ".colorG") $colorG`); float $colorB = `getAttr($m + ".baseColorB")` ; catchQuiet(`setAttr ($newMaterial + ".colorB") $colorB`); delete $m; }
I've used this script:
//change all phong Materials to aiStandard Material // If you need to change another Material, simple change `ls -type "phong"` { string $newMaterialType = "aiStandard"; string $nm = `createNode $newMaterialType`; string $ms[] = `ls -type "blinn"`; string $pa[] = `listAttr -visible -settable -scalar $ms`; string $nma[] = `listAttr -visible -settable -scalar $nm`; string $ca[] = stringArrayRemove($nma, $pa); $ca = stringArrayRemove($ca, $pa); delete $nm; string $a; string $m; float $v; string $cl[]; for ($m in $ms) { $nm = `createNode $newMaterialType`; $cl = `listConnections -destination true -plugs true -source false -type shadingEngine $m`; connectAttr -f ($nm + ".outColor") ($cl); for ($a in $ca) { $v = `getAttr ($m + "." + $a)`; catchQuiet(`setAttr ($nm + "." + $a) $v`); } delete $m; } }
to convert a blinn to arnold, and it does work, so i tried the other way:
//change all phong Materials to aiStandard Material // If you need to change another Material, simple change `ls -type "phong"` { string $newMaterialType = "blinn"; string $nm = `createNode $newMaterialType`; string $ms[] = `ls -type "aiStandard"`; string $pa[] = `listAttr -visible -settable -scalar $ms`; string $nma[] = `listAttr -visible -settable -scalar $nm`; string $ca[] = stringArrayRemove($nma, $pa); $ca = stringArrayRemove($ca, $pa); delete $nm; string $a; string $m; float $v; string $cl[]; for ($m in $ms) { $nm = `createNode $newMaterialType`; $cl = `listConnections -destination true -plugs true -source false -type shadingEngine $m`; connectAttr -f ($nm + ".outColor") ($cl); for ($a in $ca) { $v = `getAttr ($m + "." + $a)`; catchQuiet(`setAttr ($nm + "." + $a) $v`); } delete $m; } }
I've also tried "aiStandardSurface" instead of "aiStandard"
But this doesnt work...
i get this error:
// Error: line 18: The destination attribute '' cannot be found. //
This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.
If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.
When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.
Please include images, scene and log files whenever possible as this helps the community answer your questions.
Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.
If you are looking for Arnold Documentation and Support please visit the Arnold Support site.
To try Arnold please visit the Arnold Trial page.
Bottom No panel present for this section.8 People are following this question.