-------------------------------------------------------------------------------------- -- Brazil Material Utilities -- Place in UI\Macroscripts -- Look under Rob's Scripts in Category -- -- Brazil Util this - places selected medit slot material insdide a Brazil Util mat renames util mat -- Brazil Matte this - creates a Matte material inside a Brazil util in current slot -- Brazil Shadow this - creates a Shadow mat inside a Brazil util in current slot -- Brazil Balck this - creates a black standard mat no spec or gloss in side a Brazil util in current slot -- Brazil White this - same but with 100% sell illum white mat -- Brazil Z-Depth -- Utility mat with standard material using a falloff set to distance. You'll need to set the distance -- in the fallof map to an appropriate value for your scene. For a quick way to find the Far Distance, create a sphere -- centered on your camera and drag it out to the furthest extents of your scene. Use the radius for the Far value -- Brazil Normal -- Utility mat with standard material using a 'normal' map thanks to Richard for this. -- -- Version History -- 1.0 first release: -- Max R7; Brazil R 1.2.x -- If you find any bugs then please send them to support@robandrews.co.uk and I'll see what I can do. -- Copyright Robert Andrews 2005. -- comments to support@robandrews.co.uk -- Copyright Robert Andrews 2005. -------------------------------------------------------------------------------------- macroscript brazilUtilThis category: "Rob's Scripts" buttonText: "Util This..." tooltip: "Place selected material in Brazil Util material" ( cur_mat=medit.GetCurMtl() util_mat=Brazil_Utility sub_material:cur_mat util_mat.name= "Util_" + cur_mat.name slt = medit.GetActiveMtlSlot() medit.PutMtlToMtlEditor util_mat slt ) macroscript brazilZDepthThis category: "Rob's Scripts" buttonText: "Z-Depth this.." tooltip: "Creates Z-Depth material inside Brazil Util in selected slot" ( debug=1 global zDepthFirstRun=true Try ( --check to see if there are any other Matte_ materials and calculate mat number if zDepthFirstRun do ( global zDepthIndex=0 for m in meditMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_zDepth_*") do ( s = substring m.name 13 2 number = s as integer if number >= zDepthIndex do zDepthIndex=number ) ) ) for m in sceneMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_zDepth_*") do ( s = substring m.name 13 2 number = s as integer if number >= zDepthIndex do zDepthIndex=number ) ) ) --zDepthFirstRun=false ) zDepthIndex +=1 -- if debug >=1 do print (zDepthIndex as string)+" b" zDepth_tex = falloff() zDepth_tex.type = 4 zDepth_tex.name = "zDepth_Falloff" + (zDepthIndex as string) util_mat = Brazil_Utility () util_mat.name = "Util_zDepth_" + (zDepthIndex as string) util_mat.color_map = zDepth_tex util_mat.gi_receive_on = false util_mat.gi_generate_on = false slt = medit.GetActiveMtlSlot() medit.PutMtlToMtlEditor util_mat slt ) catch ( messagBox "Error: brazilZDepthThis" ) ) macroscript brazilNormalThis category: "Rob's Scripts" buttonText: "Normal This.." tooltip: "Creates Normal material inside Brazil Util in selected slot" ( global normalFirstRun=true Try ( --check to see if there are any other normal materials and calculate mat number if normalFirstRun do ( global normalIndex=0 for m in meditMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_Normal_*") do ( s = substring m.name 13 2 number = s as integer if number >= normalIndex do normalIndex=number --print normalIndex ) ) ) for m in sceneMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_Normal_*") do ( s = substring m.name 13 2 number = s as integer if number >= normalIndex do normalIndex=number ) ) ) -- normalFirstRun=true ) normalIndex +=1 normalFalloffRed_tex = falloff () normalFalloffRed_tex.name = "Normal_Falloff_Red_" + (normalIndex as string) normalFalloffRed_tex.color1 = color 255 0 0 normalFalloffRed_tex.color2 = color 0 0 0 normalFalloffRed_tex.type = 0 normalFalloffRed_tex.direction = 7 normalFalloffGreen_tex = falloff () normalFalloffGreen_tex.name = "Normal_Falloff_Green_" + (normalIndex as string) normalFalloffGreen_tex.color1 = color 0 255 0 normalFalloffGreen_tex.color2 = color 0 0 0 normalFalloffGreen_tex.type = 0 normalFalloffGreen_tex.direction = 9 normalFalloffBlue_tex = falloff () normalFalloffBlue_tex.name = "Normal_Falloff_Blue_" + (normalIndex as string) normalFalloffBlue_tex.color2 = color 0 0 255 normalFalloffBlue_tex.type = 0 normalFalloffBlue_tex.direction = 8 print "Here" normalMix2_tex = Mix () normalMix2_tex.name = "Normal_Mix2_" + (normalIndex as string) normalMix2_tex.map1 = normalFalloffRed_tex normalMix2_tex.map2 = normalFalloffGreen_tex normalMix2_tex.mixAmount = 50.0 normalMix2_tex.output.RGB_level = 2.0 print "Here1" normalMix1_tex = Mix () normalMix1_tex.name = "Normal_Mix1_" + (normalIndex as string) normalMix1_tex.map1 = normalMix2_tex normalMix1_tex.map2 = normalFalloffBlue_tex normalMix1_tex.mixAmount = 50.0 normalMix1_tex.output.RGB_level = 2.0 print "Here2" util_mat = Brazil_Utility () util_mat.name = "Util_Normal_" + (normalIndex as string) util_mat.color_map = normalMix1_tex util_mat.gi_generate_on = false util_mat.gi_receive_on = false slt = medit.GetActiveMtlSlot() medit.PutMtlToMtlEditor util_mat slt ) catch ( messagBox "Error: brazilNormalThis" ) ) macroscript brazilMatteThis category: "Rob's Scripts" buttonText: "Matte This..." tooltip: "Creates Matte material inside Brazil Util in selected slot" ( debug=1 global matteFirstRun=true Try ( --check to see if there are any other Matte_ materials and calculate mat number if matteFirstRun do ( global matteIndex=0 for m in meditMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_Matte_*") do ( s = substring m.name 12 2 number = s as integer if number >= matteIndex do matteIndex=number ) ) ) for m in sceneMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_Matte_*") do ( s = substring m.name 12 2 number = s as integer if number >= matteIndex do matteIndex=number ) ) ) --matteFirstRun=false ) matteIndex +=1 -- if debug >=1 do print (matteIndex as string)+" b" matte_mat = MatteShadow () matte_mat.receiveshadows = false matte_mat.affectalpha = false matte_mat.name="Matte_" + (matteIndex as string) util_mat = Brazil_Utility sub_Material:matte_mat util_mat.name = "Util_" + matte_mat.name util_mat.gi_receive_on = false slt = medit.GetActiveMtlSlot() medit.PutMtlToMtlEditor util_mat slt ) catch ( messagBox "Error: brazilMatteThis" ) ) macroscript brazilShadowThis category: "Rob's Scripts" buttonText: "Shadow This..." tooltip: "Creates Matte material inside Brazil Util in selected slot" ( global shadowFirstRun=true Try ( --check to see if there are any other Shadow_ materials and calculate mat number if shadowFirstRun do ( global shadowIndex=0 for m in meditMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_Shadow_*") do ( s = substring m.name 13 2 number = s as integer if number >= shadowIndex do shadowIndex=number ) ) ) for m in sceneMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_Shadow_*") do ( s = substring m.name 13 2 number = s as integer if number >= shadowIndex do shadowIndex=number ) ) ) -- shadowFirstRun=true ) shadow_mat = MatteShadow () shadowIndex +=1 shadow_mat.name="Shadow_" + (shadowIndex as string) util_mat = Brazil_Utility sub_Material:shadow_mat util_mat.name = "Util_" + shadow_mat.name util_mat.gi_generate_on = false slt = medit.GetActiveMtlSlot() medit.PutMtlToMtlEditor util_mat slt ) catch ( messagBox "Error: brazilShadowThis" ) ) macroscript brazilWhiteMaskThis category: "Rob's Scripts" buttonText: "White Mask This..." tooltip: "Creates a White Mask material inside Brazil Util in selected slot" ( global whiteMaskFirstRun=true Try ( --check to see if there are any other Shadow_ materials and calculate mat number if whiteMaskFirstRun do ( global whiteMaskIndex=0 for m in meditMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_WhiteMask_*") do ( s = substring m.name 16 2 number = s as integer if number >= whiteMaskIndex do whiteMaskIndex=number ) ) ) for m in sceneMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_WhiteMask_*") do ( s = substring m.name 16 2 number = s as integer if number >= whiteMaskIndex do whiteMaskIndex=number ) ) ) -- whiteMaskFirstRun=true ) whiteMask_mat = Standardmaterial () whiteMask_mat.diffuse = color 255 255 255 whiteMask_mat.selfIllumAmount = 100 whiteMask_mat.specularLevel = 0 whiteMask_mat.glossiness = 0 whiteMaskIndex +=1 whiteMask_mat.name="WhiteMask_" + (whiteMaskIndex as string) util_mat = Brazil_Utility sub_Material:whiteMask_mat util_mat.name = "Util_" + whiteMask_mat.name util_mat.gi_generate_on = false util_mat.gi_receive_on = false slt = medit.GetActiveMtlSlot() medit.PutMtlToMtlEditor util_mat slt ) catch ( messagBox "Error: brazilWhiteMaskThis" ) ) macroscript brazilBlackMaskThis category: "Rob's Scripts" buttonText: "Black Mask This..." tooltip: "Creates a Black Mask material inside Brazil Util in selected slot" ( global blackMaskFirstRun=true Try ( --check to see if there are any other Shadow_ materials and calculate mat number if blackMaskFirstRun do ( global blackMaskIndex=0 for m in meditMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_BlackMask_*") do ( s = substring m.name 16 2 number = s as integer if number >= blackMaskIndex do blackMaskIndex=number ) ) ) for m in sceneMaterials do ( if classof m == Brazil_Utility do ( if (matchPattern m.name pattern:"Util_BlackMask_*") do ( s = substring m.name 16 2 number = s as integer if number >= blackMaskIndex do blackMaskIndex=number ) ) ) -- blackMaskFirstRun=true ) print "here" blackMask_mat = Standardmaterial () blackMask_mat.diffuse = color 0 0 0 blackMask_mat.selfIllumAmount = 100 blackMask_mat.specularLevel = 0 blackMask_mat.glossiness = 0 blackMaskIndex +=1 blackMask_mat.name="BlackMask_" + (blackMaskIndex as string) util_mat = Brazil_Utility sub_Material:blackMask_mat util_mat.name = "Util_" + blackMask_mat.name print "here 2" util_mat.gi_generate_on = false util_mat.gi_receive_on = false slt = medit.GetActiveMtlSlot() medit.PutMtlToMtlEditor util_mat slt ) catch ( messagBox "Error: brazilBlackMaskThis" ) )