daily pastebin goal
25%
SHARE
TWEET

Nate - Shader Generation

a guest Nov 2nd, 2010 1,166 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Declare values */
  2. diffMap = undefined
  3. normalMap = undefined
  4. dBump = undefined
  5. primaryColorIndex = undefined
  6. secondaryColorIndex = undefined
  7. shaderName = undefined
  8. ccMap = undefined
  9.  
  10.  
  11. rollout mainRollout "Halo Shader Creator" width:225 height:431
  12. (
  13.         button diffSelect "Select Texture" pos:[90,20] width:114 height:32
  14.         label lbl8 "Diffuse" pos:[50,27] width:39 height:19
  15.         button normalSelect "Select Texture" pos:[90,65] width:114 height:32
  16.         label lbl10 "Normal" pos:[50,72] width:40 height:16
  17.                
  18.                
  19.         button dBumpSelect "Select Texture" pos:[90,110] width:114 height:32
  20.         label lbl13 "Detail Normal" pos:[24,120] width:64 height:24
  21.         button colorSelect "Select Library" pos:[90,155] width:114 height:32
  22.         label lbl17 "Colors" pos:[54,165] width:32 height:16
  23.         button btnCreate "Create Shader" pos:[92,364] width:114 height:44
  24.         spinner slotSelect "" pos:[90,264] width:45 height:16 range:[1,24,1] type:#integer
  25.         label lbl50 "Material Slot" pos:[24,264] width:64 height:16
  26.         edittext shaderName "" pos:[87,304] width:114 height:23
  27.         label lbl56 "Shader Name" pos:[16,309] width:69 height:16
  28.  
  29.                
  30. /*              Initialize shader creation */
  31.         button ccSelect "Select Texture" pos:[90,200] width:114 height:32
  32.         label lbl7 "CC Map" pos:[48,208] width:40 height:14    
  33.        
  34.                
  35.         on diffSelect pressed do
  36.         (
  37.                 diffMap = bitmaptexture()
  38.                 selectedBitmap = selectBitmap caption:"Select diffuse texture"
  39.                 if selectedBitmap != undefined then
  40.                 (
  41.                 diffMap.bitmap = selectedBitmap
  42.                 /* Define the specular level map */
  43.                 specMap = bitmaptexture()
  44.                 specmap.bitmap = diffMap.bitmap
  45.                 )
  46.         )
  47.        
  48.         on normalSelect pressed do
  49.         (
  50.         normalMap = bitmaptexture()
  51.         selectedBitmap = selectBitmap caption:"Select normal map texture"
  52.                 if selectedBitmap != undefined then
  53.                 (
  54.                 normalMap.bitmap = selectedBitmap
  55.                 )
  56.         )
  57.                
  58.                
  59.         on dBumpSelect pressed do
  60.         (
  61.                 dBump = bitmaptexture()
  62.                 selectedBitmap = selectBitmap caption:"Select detail normal map texture"
  63.                 if selectedBitmap != undefined then
  64.                 (
  65.                         dBump = selectedBitmap
  66.                 )
  67.                
  68.         )
  69.                
  70.         on colorSelect pressed do
  71.         (
  72.                 fileOpenMatLib()
  73.                
  74.                 if selectedLibrary != undefined then
  75.                 (
  76.         libraryNames = for m in currentMaterialLibrary collect m.name
  77.         primaryColorIndex = findItem libraryNames "Primary Colours"
  78.         primaryColorIndex = currentMaterialLibrary[primaryColorIndex]
  79.         secondaryColorIndex = findItem libraryNames "Secondary Colours"
  80.         secondaryColorIndex = currentMaterialLibrary[secondaryColorIndex]
  81.                 )
  82.         )
  83.                
  84.         on btnCreate pressed do
  85.         (
  86.        
  87.         /*      Finalize shader name */
  88.          meditMaterials[slotSelect.value].name = shaderName.text
  89.                
  90.         /* Set diffuse map Primary texture */
  91.         meditMaterials[slotSelect.value].diffuseMap = CompositeTexturemap () /* Set diffuse map to Composite    */
  92.         meditMaterials[slotSelect.value].diffuseMap.mapList[1] = diffMap
  93.         meditMaterials[slotSelect.value].diffuseMap.mapList[1].alphaSource = 2 /*       Disable Alpha ouput     */
  94.        
  95.         /* Set Primary Colour Mask       */
  96.         meditMaterials[slotSelect.value].diffuseMap.mask[2] = CompositeTextureMap()
  97.         meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1] = Color_Correction()
  98.         meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireR = 0
  99.         meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireG = 10
  100.         meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireB = 10
  101.         meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].rewireA = 9
  102.         meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[1].map = ccMap
  103.         meditMaterials[slotSelect.value].diffuseMap.mask[2].mapList[2] = RGB_Tint()
  104.         meditMaterials[slotSelect.value].diffuseMap.mask[2].blendMode[2] = 23
  105.         meditMaterials[slotSelect.value].diffuseMap.layerName[2] = "Primary"
  106.         meditMaterials[slotSelect.value].diffuseMap.mapList[2] = primaryColorIndex
  107.         meditMaterials[slotSelect.value].diffuseMap.blendMode[2] = 5
  108.        
  109.         /* Set Secondary Colour Mask */
  110.         meditMaterials[slotSelect.value].diffuseMap.mask[3] = CompositeTextureMap()
  111.         meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1] = Color_Correction()
  112.         meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireR = 10
  113.         meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireG = 1
  114.         meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireB = 10
  115.         meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].rewireA = 9
  116.         meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[1].map = ccMap
  117.         meditMaterials[slotSelect.value].diffuseMap.mask[3].mapList[2] = RGB_Tint()
  118.         meditMaterials[slotSelect.value].diffuseMap.mask[3].blendMode[2] = 23
  119.         meditMaterials[slotSelect.value].diffuseMap.layerName[3] = "Secondary"
  120.         meditMaterials[slotSelect.value].diffuseMap.mapList[3] = secondaryColorIndex
  121.         meditMaterials[slotSelect.value].diffuseMap.blendMode[3] = 5
  122.                
  123.                 /* Set specular level */
  124.                  meditMaterials[slotSelect.value].specularLevelMapEnable = on
  125.                  meditMaterials[slotSelect.value].specularLevelMap = specMap
  126.                 /*      Set alpha output as RGB */
  127.                  meditMaterials[slotSelect.value].specularLevelMap.rgbOutput = 1
  128.                  meditMaterials[slotSelect.value].specularLevelMap.monoOutput = 1
  129.                  meditMaterials[slotSelect.value].specularLevelMap.name = "Specular Map"
  130.                
  131.         /*      Set normal bump */
  132.                  meditMaterials[slotSelect.value].bumpMap = Normal_Bump()
  133.                  meditMaterials[slotSelect.value].bumpMap.normal_map = normalMap
  134.                  meditMaterials[slotSelect.value].bumpMap.mult_spin = 2
  135.                  meditMaterials[slotSelect.value].bumpMap.name = "Bump Map"
  136.                  meditMaterials[slotSelect.value].bumpMap.normal_map.name = "Primary Bump"
  137.                
  138.         /* Set additional bump */
  139.                  meditMaterials[slotSelect.value].bumpMap.bump_map = dBump
  140.                  meditMaterials[slotSelect.value].bumpMap.bump_spin = 5
  141.                  meditMaterials[slotSelect.value].bumpMap.bump_map.coords.u_tiling = 5
  142.                  meditMaterials[slotSelect.value].bumpMap.bump_map.coords.v_tiling = 5
  143.                  meditMaterials[slotSelect.value].bumpMap.bump_map.name = "Secondary Bump"
  144.                
  145.         /*      Set reflection */
  146.                  meditMaterials[slotSelect.value].reflectionMapEnable = on
  147.                  meditMaterials[slotSelect.value].reflectionMap = Mask ()
  148.                  meditMaterials[slotSelect.value].reflectionMap.Mask = falloff()
  149.                  meditMaterials[slotSelect.value].reflectionMap.map = Mask ()
  150.                  meditMaterials[slotSelect.value].reflectionMap.Map.Mask = specMap
  151.                  meditMaterials[slotSelect.value].reflectionMap.Map.Mask.monoOutput = 1
  152.                  meditMaterials[slotSelect.value].reflectionMap.Map.Mask.rgbOutput = 1
  153.                  meditMaterials[slotSelect.value].reflectionMap.Map.map = Raytrace ()
  154.                  meditMaterials[slotSelect.value].reflectionMap.name ="Fresnal Mask"
  155.                  meditMaterials[slotSelect.value].reflectionMap.mask.name ="Fresnal Map"
  156.                  meditMaterials[slotSelect.value].reflectionMap.map.name ="Sub-fresnal masking"
  157.                  meditMaterials[slotSelect.value].reflectionMap.map.mask.name ="Reflection Mask"
  158.                  meditMaterials[slotSelect.value].reflectionMap.map.map.name ="Reflection Map"
  159.                
  160.                 )
  161.         on ccSelect pressed do
  162.         (
  163.         ccMap = bitmaptexture()
  164.         selectedBitmap = selectBitmap caption:"Select colour-change texture"
  165.         if selectedBitmap != undefined then
  166.                 (
  167.                 selectedBitmap = ccMap
  168.                 )
  169.         )
  170. )
  171.  
  172. /* Draw the UI */
  173. createDialog mainRollout
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top