[sectionBegin," ZGraphs ",0,"ZScript Primer (Press to expand this section)",
	[varDef,zbPrimerTempOpenZG][varDef,zbInitDocSavedZG,0][varDef,zbInitSavedDocZG,""]
	[iPress,7442]
	[if,(zbPrimerTempOpenZG),
		[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,zbInitSavedDocZG,[fileNameGetLastUsed]]
					[varSet,zbInitDocSavedZG,1]
				] // end if (user saves)
			] // end if (save enabled)
			[Note,"One moment please...",,2]
			[iKeyPress,13,[iReset]]
			[varSet,zbPrimerTempOpenZG,1]
		, // else (user won't reset)
			[iUnPress,0][exit]
		] // end if (wanna reset?)
	] // end if PrimerTemp
	[iSet,material:itemInfo,3][iPress,material:modifiers:diffusecurve]
	[Note,"This primer describes ZGraphs: interface items which can be controlled graphically to create unusual effects (this is only one example).",material:modifiers:diffusecurve,-1]
	[Note,"\n\n\C909090(Click to continue)\Cc0c0c0",,0]
] // end sectionBegin
[pd][paintBackSliver,2,40,40,40][pd]
ZGraphs are unique interface items located in many ZBrush palettes, which enable you to provide comprehensive control over certain features. You can modify ZGraphs in subtle ways to gain finer control, or you can modify them in unusual ways for bizarre effects.

Each ZGraph has a different meaning, depending on the feature it's controlling, but all of them can be modified using the same techniques. In this example you'll modify the [iButton,"Noise Curve","Find the Noise Curve",
	[iSet,material:itemInfo,2]
	[iShow,material:modifiers:noisecurve,0]
	[iClick,material:modifiers:noisecurve,22,22,-22,-22]
	[iShow,material:modifiers:noisecurve,1]
]. // end iButton
[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,150,150,150,0,0,0]
] // end iButton
to select a basic material and draw a sphere on the canvas with this material.

[iButton,"Click here","Add noise to this material",
	[iSet,material:modifiers:noise,.5]
	[iSet,material:modifiers:noiseradius,7]
	[iShow,material:modifiers:noisecurve,0]
	[iClick,material:modifiers:noisecurve,25,25,-25,-25]
	[iShow,material:modifiers:noisecurve,1]
] // end iButton
to add [buttonFind,material:modifiers:noise,Noise] to this material and display the ZGraph which controls it. 

Within ZGraphs, you can move existing points to change the curve by simply dragging them. [iButton,"Click here","Move points in the curve",
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,3,126,5,-5]
] // end iButton
to move the point in the lower left corner all the way up to the upper left corner of the ZGraph.

You can add points, and the curve changes shape smoothly where the point is added [iButton,"show me","Add points to the curve",
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,58,4,59,93]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,32,50,40,22]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,95,48,80,15]
]. // end iButton

You can change the sharpness of curve around a point by clicking it and dragging the circle which appears around it [iButton,"show me","Adjust the sharpness at a point",
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,59,93]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,57,48,60,70]
]. // end iButton

To change curve points into corners, drag them off the curve and back again. [iButton,"Click here","Change points from curve to corner",
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,40,22,40,-22,40,22]
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,80,15,80,-22,80,15]
]; // end iButton
to change two of the points from curves to corner points. Drag off, then on again to change a corner point back to a curve point.

To make more detailed adjustments, click once on a point, and the ZGraph changes to a zoomed-in view of that point and the two points next to it [iButton,"show me","Click on a point to zoom in on it",
	[IClick,MATERIAL:MODIFIERS:NoiseCurve,80,15]
	[delay,1]
]. // end iButton
[pd][pd]
These are the basics of working with ZGraphs. Any time you encounter one and would like to gain precise control over its corresponding effect, you can modify it using these techniques.

[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]
] // end iButton
to reset this material to its original state.

Some of the other ZGraphs are:

[iButton,"Diffuse Curve","Show the Diffuse Curve",
	[iShow,material:modifiers:diffusecurve,0]
	[iClick,material:modifiers:diffusecurve,25,25,-25,-25]
	[iShow,material:modifiers:diffusecurve,1]
]: // end iButton
strength of the diffuse effect (higher = stronger); left side = surfaces facing away from light, right side = surfaces facing toward light.
[penMove,0,6]
[iButton,"Specular Curve","Show the Specular Curve",
	[iShow,material:modifiers:Specularcurve,0]
	[iClick,material:modifiers:Specularcurve,25,25,-25,-25]
	[iShow,material:modifiers:Specularcurve,1]
]: // end iButton
strength of the specular effect (higher = stronger); left side = surfaces facing away from highlight, right side = surfaces facing toward highlight.
[penMove,0,6]
[iButton,"Transparency Curve","Show the Transparency Curve",
	[iShow,material:modifiers:Transcurve,0]
	[iClick,material:modifiers:Transcurve,25,25,-25,-25]
	[iShow,material:modifiers:Transcurve,1]
]: // end iButton
transparency (higher = more transparent); left side = surfaces perpendicular to you the viewer, right side = surfaces facing toward you the viewer.
[penMove,0,6]
[iButton,"Reflectivity Curve","Show the Reflectivity Curve",
	[iShow,material:modifiers:Reflectcurve,0]
	[iClick,material:modifiers:Reflectcurve,25,25,-25,-25]
	[iShow,material:modifiers:Reflectcurve,1]
]: // end iButton
reflectivity (higher = more reflective); left side = surfaces perpendicular to you the viewer, right side = surfaces facing toward you the viewer.
[penMove,0,6]
[iButton,"Light Intensity Curve","Show the Light Intensity Curve",
	[iShow,light:intensitycurve,0]
	[iClick,light:intensitycurve,25,25,-25,-25]
	[iShow,light:intensitycurve,1]
]: // end iButton
falloff of selected light (higher = brighter); left side = surfaces perpendicular to the selected light, right side = surfaces directly facing the light.
[penMove,0,6]
[iButton,"Brightness Curve","Show the Brightness Curve",
	[iPress,render:adjustments:adjust]
	[iShow,render:adjustments:rgblevel,0]
	[iClick,render:adjustments:rgblevel,25,25,-25,-25]
	[iShow,render:adjustments:rgblevel,1]
]: // end iButton
adjusted brightness (higher = brighter); left side = dark areas if unadjusted, right side = bright areas if unadjusted.


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