Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have a particularly specific problem where I need to convert several Multi/Sub-object materials that contain only Physical Materials to versions that use Standard (Legacy) materials. I've found a few scripts that can do this when the Physical Materials are directly assigned to an object, but they don't work with Multi/Subs. I only need the diffuse channel to be mapped between Physical and Standard. I've attached a screenshot and a demo scene of what I'm trying to accomplish.
Here's the original script I found:
-- Credit to dmitriy.shpilevoy on Autodesk Fourms for this!
-- https://forums.autodesk.com/t5/3ds-max-programming-forum/simple-physical-to-standard-legacy-material-converter/td-p/10173340#M5535
for physMat in scenematerials where (classOf physMat == PhysicalMaterial) do (
stnMat = standardMaterial name:(physMat.name)
stnMat.diffuse = physMat.base_color
stnMat.adLock = false
stnMat.ambient = (color 0 0 0)
for obj in objects where obj.mat == physMat do (
obj.material = stnMat
)
)
And what I managed to do in MaxScript:
-- Credit to dmitriy.shpilevoy Autodesk Fourms for this! -- https://forums.autodesk.com/t5/3ds-max-programming-forum/simple-physical-to-standard-legacy-material-converter/td-p/10173340#M5535 for mPhysMat in scenematerials where (classOf mPhysMat == MultiMaterial) do ( format "\nPHYSICAL: \nName: %,\nNumsubs: %,\nSubMatCount: %,\nMatID-List: %,\nMatList: %\n" mPhysMat.name mPhysMat.numsubs mPhysMat.materialList.count mPhysMat.materialIdList mPhysMat.materialList --Create new multimaterial with same array size as original. Assign IDs. Set submaterials to legacy mStdMat = MultiMaterial name:(mPhysMat.name+"_standard") numsubs:mPhysMat.materialList.count mStdMat.materialIDList = mPhysMat.materialIdList --mStdMat.material for i = 1 to mStdMat.materialList.count do ( stdName = mStdMat.materialList[i].name mStdMat.material[i] = standardMaterial name:(stdName) mStdMat.material[i].diffuse = (color 32 0 0) ) format "\nLEGACY:\nName: %,\nNumsubs: %,\nSubMatCount: %,\nMatID-List: %,\nMatList: %\n" mStdMat.name mStdMat.numsubs mStdMat.materialList.count mStdMat.materialIdList mStdMat.materialList )
Thanks!
Solved! Go to Solution.