[sectionBegin," Materials ",0,"ZScript Primer (Press to expand this section)",
	[varDef,zbPrimerTempOpenMT][varDef,zbInitDocSavedMT,0][varDef,zbInitSavedDocMT,""]
	[iPress,7442]
	[if,(zbPrimerTempOpenMT),
		[iKeyPress,'N',[iPress,document:newdocument]]
	, // else
		[if,[messageYesNo,"OK to clear all customized tools, lights and materials?","DOCUMENT MUST BE CLEARED BEFORE PROCEEDING..."],
			[if,[isEnabled,document:save],
				[if,[messageYesno,"Would you like to save this document before proceeding?","Document has not been saved."],
					[iPress,document:saveas]
					[varSet,zbInitSavedDocMT,[fileNameGetLastUsed]]
					[varSet,zbInitDocSavedMT,1]
				] // end if (user saves)
			] // end if (save enabled)
			[Note,"One moment please...",,2]
			[iKeyPress,13,[iReset]]
			[varSet,zbPrimerTempOpenMT,1]
			[iShow,material:,0]
			[iClick,material:,144,6]
			[iShow,material:,1]
		, // else (user won't reset)
			[iUnPress,0][exit]
		] // end if (wanna reset?)
	] // end if PrimerTemp
	[iShow,material:,0]
	[iClick,material:,144,6]
	[iShow,material:,1]
	[Note,"This primer describes the Material palette, which contains comprehensive modifiers for customizing all kinds of materials.",material:,-1]
	[Note,"\n\nMaterials are the properties of a surface which reflect, refract, or otherwise interact with light. They can be smooth, rough, bumpy, wispy or anything else you can imagine.",,-1]
	[Note,"\n\n\C909090(Click to continue)\Cc0c0c0",,0]
] // end sectionBegin
[pd][paintBackSliver,2,40,40,40][pd]
The [buttonFind,material:,"Material palette"] works differently from other palettes. You cannot add or subtract materials from the palette, but you can replace them. This is because every pixol in the ZBrush canvas, in addition to retaining position, color and depth information, retains the index of the item in the Material palette used when painting it.

Any changes you make to materials after painting with them are reflected immediately in the canvas.

For example, if you paint using the [buttonSet,material:itemInfo,27,"Reflected Map Material"], which occupies number 27 in the palette, then import another material into position number 27, all "Reflected Map" pixols drawn on the canvas immediately change to the new material.

For this reason, modified materials are stored with the document when it is saved, if they are applied to the canvas.

The strength of ZBrush's materials capabilities lies in the [iButton,"Material modifiers","Show the Material modifiers",
	[iShow,material:modifiers:,1]
]. // end iButton
Each material has up to four [iButton,"shaders","Show the Material Shaders",
	[iShow,material:modifiers:1stshader,1]
	[iShow,material:modifiers:2ndshader,1]
	[iShow,material:modifiers:3rdshader,1]
	[iShow,material:modifiers:4thshader,1]
], // end iButton
each shader having different modifiers. You cannot add or subtract shaders or modifiers; they are assigned to each material by default.

There are many specialty shaders, but most materials have at least one "Basic Material" shader assigned to them. Understanding the Basic Material modifiers, then, will give you a good understanding of the ZBrush material set. You can experiment with the specialty shaders to discover how they affect the materials.

Here is a description of the Basic Material modifiers. To begin, pick a [iButton,"Basic Material","Choose a Basic Material",
	[iSet,material:itemInfo,2]
]. // end iButton

Now, [iButton,"Click here","Draw a sphere on the canvas",
	[iPress,tool:sphere3d]
	[iSet,material:itemInfo,2]
	[iSet,texture:itemInfo,0]
	[iColorSet,255,200,0]
	[canvasClick,320,240,320,250]
	[transformSet,320,240,0,180,180,180,0,0,0]
] // end iButton
to draw a sphere on the canvas with this material.

Here are the Basic Material modifiers, from top to bottom:

[buttonFind,material:modifiers:ambient,Ambient] determines the overall (unshaded) lightness of the material. A value of 100 here practically removes all shading from the surface on which this material is applied. [iButton,"Click here","Briefly set Ambient to 100",
	[varSet,zbPrimerMatVar,material:modifiers:ambient]
	[iSet,material:modifiers:ambient,100]
	[delay,1.25]
	[iSet,material:modifiers:ambient,zbPrimerMatVar]
] // end iButton
to demonstrate this briefly.

[buttonFind,material:modifiers:diffuse,Diffuse] determines the strength of the shading caused by existing lights. With this slider set to 100, the portions of the object directly facing the light are brightest and the portions facing away are darkest. The Diffuse property is controlled by the [buttonFind,material:modifiers:diffuseCurve,"Diffuse Curve"], which is described below. [iButton,"Click here","Set Diffuse to 100",
	[varSet,zbPrimerMatDiff,material:modifiers:diffuse]
	[iSet,material:modifiers:diffuse,100]
] // end iButton
to set this value to 100 (maximum).

[buttonFind,material:modifiers:specular,Specular] determines the brightness of the "hot spot" caused by the reflection of the light source in the material. The higher the number, the shinier the object appears. This property is controlled by the [buttonFind,material:modifiers:specularcurve,"Specular Curve"]. [iButton,"Click here","Set Specular to 25",
	[varSet,zbPrimerMatSpec,material:modifiers:specular]
	[iSet,material:modifiers:specular,25]
] // end iButton
to set this value to 25 (moderate shininess).

[buttonFind,material:modifiers:transparency,Transparency] determines how much you can see items through the material. Note that this is not "true" transparency; items drawn in the same layer are not visible, including other parts of the same object on which this material is applied. To activate transparency, you must un-press [buttonFind,render:modifiers:flattenlayers,"Flatten Layers"] in the Render palette.

This slider works in conjunction with the [buttonFind,material:modifiers:transCurve,"Transparency Curve"]. Positive slider values cause transparency to vary according to orientation; negative values cause transparency to vary according to color intensity.

[buttonFind,material:modifiers:reflectivity,Reflectivity] determines how clearly you can see a selected texture reflected in this material. Select the reflected texture in the [buttonFind,material:modifiers:materialtexture,"Material Texture popup"]. [iButton,"Click here","Set Reflectivity to 50",
	[varSet,zbPrimerMatRefl,material:modifiers:reflectivity]
	[iSet,material:modifiers:reflectivity,50]
] // end iButton
to set this slider to 50 (half strength).

This slider works in conjunction with the [buttonFind,material:modifiers:reflectCurve,"Reflect Curve"]. Again, positive slider values cause reflectivity to vary according to orientation; negative values cause it to vary according to color intensity.

Another slider, [buttonFind,material:modifiers:env.reflection,"Environment Reflection"] (which cannot be controlled by a ZGraph), sets the strength of the reflection chosen in the [buttonFind,render:environment,"Environment"] sub-palette. This type of reflection can only be seen in [buttonFind,render:bestrenderer,"Best Render mode"]. Here you can specify whether a [buttonFind,render:environment:txtr,Texture], [buttonFind,render:environment:color,Color], or the entire canvas ([buttonFind,render:environment:scene,Scene]) is reflected in any material with Environment Reflection activated. Pressing [buttonFind,render:environment:scene,"Scene"] causes ZBrush to consider the entire canvas (reflecting surface included) as a reflection map for the material. You can achieve a similar effect with the [buttonFind,material:modifiers:reflectivity,Reflectivity] slider by grabbing the canvas with the [buttonFind,tool:mrgbzgrabber,"MRGBZ Grabber"], and choosing that texture in the [buttonFind,material:modifiers:materialtexture,"Material Texture popup"].

[buttonFind,material:modifiers:Metalicity,Metalicity] determines the color of the "hot spot" defined by the [buttonFind,material:modifiers:specular,Specular] slider. At 0, the color is the same as the color of the light. At 100, it's the color of that portion of the material. At any value inbetween, the two colors are blended by the amount specified. This value is disregarded if [buttonFind,material:modifiers:specular,Specular] is set to 0.

[buttonFind,material:modifiers:noise,Noise] determines how prominently a random pattern of darks and lights is displayed. Negative and positive values use two different types of noise. Use this slider, combined with the [buttonFind,material:modifiers:noisecurve,"Noise Curve"] and [buttonFind,material:modifiers:noiseradius,"Noise Radius slider"] to achieve a wide variety of noise effects. This slider goes from 0 (no noise) to 1 (maximum) or -1 (maximum), depending on the kind of noise you choose. [buttonSet,material:modifiers:noise,.2,"Click here"] to set this slider to .2 (moderate amount).

[buttonFind,material:modifiers:noiseradius,"Noise Radius"] determines the size of the noise pattern. Small values produce small grains, large values produce large blotches. Values are 0 (smallest) to 500 (largest); [buttonSet,material:modifiers:noiseradius,25,"click here"] to set this slider to 25.

[buttonFind,material:modifiers:colorbump,"Color Bump"] determines the intensity of the material's color bumping. Color bumping examines the variances in color of the area over which the material is applied, and creates the illusion that some colors are raised higher than others. If the value is positive, lighter colors are raised, if negative, darker colors are raised. Color bumping does not deform objects, but uses the information in the other modifiers to help create this illusion. Values are 0 (no color bump) to 20 (maximum) or -20 (maximum), depending on whether you want light areas or dark areas to appear elevated. [buttonSet,material:modifiers:colorbump,4,"Click here"] to set this slider to 4 (moderate).

[buttonFind,material:modifiers:gelshading,"Gel Shading"] offers two different types of gel effect. When set to 0, all above modifiers work normally; when 1 or 2, they are applied in different ways, for example, the effect of the [buttonFind,material:modifiers:diffusecurve,"Diffuse curve"] is inverted. You can experiment with these to see how they work.

[buttonFind,material:modifiers:colorizediffuse,"Colorize Diffuse"] enables you to assign a color other than the light source's to the object's light areas. The lighter the diffuse shading, the stronger the color, determined by this slider. Currently set at black, you can or click and drag the [buttonFind,material:modifiers:dif,"Dif"] button anywhere in the ZBrush environment to specify a different color, or click once to specify the [buttonFind,color:maincolor,"Main Color"].

As mentioned above, you can modify all the ZGraphs in these modifiers to change the effects of these sliders dramatically. For example, changing the Noise ZGraph changes the way Noise is applied to this material [iButton,"show me","Change the Noise Curve",
	[iShow,material:modifiers:noisecurve,0]
	[iClick,material:modifiers:noisecurve,25,25,-25,-25]
	[iShow,material:modifiers:noisecurve,1]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,3,126,5,-5]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,58,4,59,93]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,32,50,40,22]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,95,48,80,15]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,59,93]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,57,48,60,70]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,40,22,40,-22,40,22]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,80,15,80,-22,80,15]
]. // end iButton
[pd]

[iButton,"Click here","Restore the material to its original state",
	[iClick,MATERIAL:MODIFIERS:NoiseCurve,40,22,40,-50]
	[iClick,MATERIAL:MODIFIERS:NoiseCurve,80,15,40,-50]
	[iClick,MATERIAL:MODIFIERS:NoiseCurve,59,93,40,-50]
	[iClick,MATERIAL:MODIFIERS:NoiseCurve,0,0,0,128]
	[iSet,material:modifiers:noise,0]
	[iSet,material:modifiers:reflectivity,0]
	[iSet,material:modifiers:specular,20]
	[iSet,material:modifiers:diffuse,75]
] // end iButton
to undo the changes made above.

[iButton," Return to your original (saved) document ","Return to your original file",
	[fileNameSetNext,zbInitSavedDocMT]
	[if,[isEnabled,document:save],
		[iKeyPress,'N',[iPress,document:open]]
	, // else nothing to save
		[iPress,document:open]
	] // end if
	[varSet,zbInitSavedDocMT,""]
	[varSet,zbInitDocSavedMT,0]
	[varSet,zbPrimerTempOpenMT,0]
] // end iButton
[pd][pd][paintBackSliver,2,40,40,40][pd][sectionEnd] // end of Materials
