Place ColorCorrect Map in All diffuse slots...

Hello, i would appreciate some script which does a job of inserting 3ds max map "Color Correction" into all ACTIVE slots of selected objects (which have Vray materials), leaving the original maps (usually bitmaps)in the apropriate slots as a sub-maps.

The script should operate on objects selected in viewport (or all objects; it doesnt matter really probably) which have Vray materials or on MultiSubObjects materials filled with Vray materials assigned.

Is it possible please? (no additional settings of the color correction map is needed, just place it in the slots and leave the original map as submap).


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
roamn's picture

Wow thanks for sucha quick

Wow thanks for sucha quick response :-), ill try it

its useful when you need to export something to obj (or maybe even fbx) because when you use maxs crop function in bitmap parametrs (to let only a part of a bitmap to be used as a texture) then the export ignores it and exports the whole bitmap as texture...

if you put a color correct map in diffuse etc slots it renders just the region you cropeed as a new texture :-). its usefull if you export to obj (and maybe others) and use crop function in bitmap map parametrs.

thanks again :-)!

barigazy's picture


Try this one

fn AddColorCorrection m =
	if isKindOf m VRayMtl then 
		for p in getPropNames m where isKindOf (tex = getProperty m p) textureMap do
			if not isKindOf tex Color_Correction do setproperty m p (Color_Correction name:("CC" + trimleft p #texmap) map:tex)
	else if isKindOf m VRay2SidedMtl then (AddColorCorrection m.frontmtl ; AddColorCorrection m.backmtl)
	else if isKindOf m SHELLAC then (AddColorCorrection m.shellacMtl1 ; AddColorCorrection m.shellacMtl2)
	else if isKindOf m VrayMtlWrapper then (AddColorCorrection  m.baseMtl)
	else if isKindOf m VRayBlendMtl then (AddColorCorrection m.baseMtl ; for i = 1 to 9 do AddColorCorrection m.coatMtl[i])
	else if isKindOf m VrayOverrideMtl then (for i in 1 to getNumSubMtls m do AddColorCorrection (getSubMtl vr i))
	else if isKindOf m Vraycarpaintmtl then (setVrayMatSubdivs m prop:#base_glossiness glossValsArr:spinVals)
	else if (classof m) == Vrayfastsss2 then (setVrayMatSubdivs m prop:#specular_glossiness glossValsArr:spinVals)
	else if isKindOf m VrayFlakesmtl then (setVrayMatSubdivs m prop:#flake_glossiness glossValsArr:spinVals)
	else if (isKindOf m Multimaterial or isKindOf m compositematerial) then (for sm in m.materialList where isKindOf sm material do AddColorCorrection sm)
	else if isKindOf m blend then (AddColorCorrection m.MAP1 ; AddColorCorrection  m.MAP2)
	else if isKindOf m topbottom then (AddColorCorrection m.topmaterial ; AddColorCorrection m.bottomMaterial)
	else if isKindOf m shell_material then (AddColorCorrection m.originalMaterial ; AddColorCorrection m.bakedMaterial)
for o in selection where (mat = o.material) != undefined do AddColorCorrection mat


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.