/* Declare values */ diffMap = undefined normalMap = undefined dBump = undefined primaryColorIndex = undefined secondaryColorIndex = undefined shaderName = undefined ccMap = undefined rollout mainRollout "Halo Shader Creator" width:225 height:431 ( button diffSelect "Select Texture" pos:[90,20] width:114 height:32 label lbl8 "Diffuse" pos:[50,27] width:39 height:19 button normalSelect "Select Texture" pos:[90,65] width:114 height:32 label lbl10 "Normal" pos:[50,72] width:40 height:16 button dBumpSelect "Select Texture" pos:[90,110] width:114 height:32 label lbl13 "Detail Normal" pos:[24,120] width:64 height:24 button colorSelect "Select Library" pos:[90,155] width:114 height:32 label lbl17 "Colors" pos:[54,165] width:32 height:16 button btnCreate "Create Shader" pos:[92,364] width:114 height:44 spinner slotSelect "" pos:[90,264] width:45 height:16 range:[1,24,1] type:#integer label lbl50 "Material Slot" pos:[24,264] width:64 height:16 edittext shaderName "" pos:[87,304] width:114 height:23 label lbl56 "Shader Name" pos:[16,309] width:69 height:16 /* Initialize shader creation */ button ccSelect "Select Texture" pos:[90,200] width:114 height:32 label lbl7 "CC Map" pos:[48,208] width:40 height:14 on diffSelect pressed do ( diffMap = bitmaptexture() selectedBitmap = selectBitmap caption:"Select diffuse texture" if selectedBitmap != undefined then ( diffMap.bitmap = selectedBitmap /* Define the specular level map */ specMap = bitmaptexture() specmap.bitmap = diffMap.bitmap ) ) on normalSelect pressed do ( normalMap = bitmaptexture() selectedBitmap = selectBitmap caption:"Select normal map texture" if selectedBitmap != undefined then ( normalMap.bitmap = selectedBitmap ) ) on dBumpSelect pressed do ( dBump = bitmaptexture() selectedBitmap = selectBitmap caption:"Select detail normal map texture" if selectedBitmap != undefined then ( dBump = selectedBitmap ) ) on colorSelect pressed do ( fileOpenMatLib() if selectedLibrary != undefined then ( libraryNames = for m in currentMaterialLibrary collect m.name primaryColorIndex = findItem libraryNames "Primary Colours" primaryColorIndex = currentMaterialLibrary[primaryColorIndex] secondaryColorIndex = findItem libraryNames "Secondary Colours" secondaryColorIndex = currentMaterialLibrary[secondaryColorIndex] ) ) on btnCreate pressed do ( /* Finalize shader name */ meditMaterials[slotSelect.value].name = shaderName.text /* Set diffuse map Primary texture */ meditMaterials[slotSelect.value].diffuseMap = CompositeTexturemap () /* Set diffuse map to Composite */ meditMaterials[slotSelect.value].diffuseMap.mapList[1] = diffMap meditMaterials[slotSelect.value].diffuseMap.mapList[1].alphaSource = 2 /* Disable Alpha ouput */ /* Set Primary Colour Mask */ meditMaterials[slotSelect.value].diffuseMap.mask[2] = CompositeTextureMap() meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1] = Color_Correction() meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireR = 0 meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireG = 10 meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireB = 10 meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireA = 9 meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].map = ccMap meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[2] = RGB_Tint() meditMaterials[slotSelect.value].diffuseMap.mask[2].blendMode[2] = 23 meditMaterials[slotSelect.value].diffuseMap.layerName[2] = "Primary" meditMaterials[slotSelect.value].diffuseMap.mapList[2] = primaryColorIndex meditMaterials[slotSelect.value].diffuseMap.blendMode[2] = 5 /* Set Secondary Colour Mask */ meditMaterials[slotSelect.value].diffuseMap.mask[3] = CompositeTextureMap() meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1] = Color_Correction() meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireR = 10 meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireG = 1 meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireB = 10 meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireA = 9 meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].map = ccMap meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[2] = RGB_Tint() meditMaterials[slotSelect.value].diffuseMap.mask[3].blendMode[2] = 23 meditMaterials[slotSelect.value].diffuseMap.layerName[3] = "Secondary" meditMaterials[slotSelect.value].diffuseMap.mapList[3] = secondaryColorIndex meditMaterials[slotSelect.value].diffuseMap.blendMode[3] = 5 /* Set specular level */ meditMaterials[slotSelect.value].specularLevelMapEnable = on meditMaterials[slotSelect.value].specularLevelMap = specMap /* Set alpha output as RGB */ meditMaterials[slotSelect.value].specularLevelMap.rgbOutput = 1 meditMaterials[slotSelect.value].specularLevelMap.monoOutput = 1 meditMaterials[slotSelect.value].specularLevelMap.name = "Specular Map" /* Set normal bump */ meditMaterials[slotSelect.value].bumpMap = Normal_Bump() meditMaterials[slotSelect.value].bumpMap.normal_map = normalMap meditMaterials[slotSelect.value].bumpMap.mult_spin = 2 meditMaterials[slotSelect.value].bumpMap.name = "Bump Map" meditMaterials[slotSelect.value].bumpMap.normal_map.name = "Primary Bump" /* Set additional bump */ meditMaterials[slotSelect.value].bumpMap.bump_map = dBump meditMaterials[slotSelect.value].bumpMap.bump_spin = 5 meditMaterials[slotSelect.value].bumpMap.bump_map.coords.u_tiling = 5 meditMaterials[slotSelect.value].bumpMap.bump_map.coords.v_tiling = 5 meditMaterials[slotSelect.value].bumpMap.bump_map.name = "Secondary Bump" /* Set reflection */ meditMaterials[slotSelect.value].reflectionMapEnable = on meditMaterials[slotSelect.value].reflectionMap = Mask () meditMaterials[slotSelect.value].reflectionMap.Mask = falloff() meditMaterials[slotSelect.value].reflectionMap.map = Mask () meditMaterials[slotSelect.value].reflectionMap.Map.Mask = specMap meditMaterials[slotSelect.value].reflectionMap.Map.Mask.monoOutput = 1 meditMaterials[slotSelect.value].reflectionMap.Map.Mask.rgbOutput = 1 meditMaterials[slotSelect.value].reflectionMap.Map.map = Raytrace () meditMaterials[slotSelect.value].reflectionMap.name ="Fresnal Mask" meditMaterials[slotSelect.value].reflectionMap.mask.name ="Fresnal Map" meditMaterials[slotSelect.value].reflectionMap.map.name ="Sub-fresnal masking" meditMaterials[slotSelect.value].reflectionMap.map.mask.name ="Reflection Mask" meditMaterials[slotSelect.value].reflectionMap.map.map.name ="Reflection Map" ) on ccSelect pressed do ( ccMap = bitmaptexture() selectedBitmap = selectBitmap caption:"Select colour-change texture" if selectedBitmap != undefined then ( selectedBitmap = ccMap ) ) ) /* Draw the UI */ createDialog mainRollout