New Version 1.6

New 125 balls & powerups.
Improved graphics.
This commit is contained in:
SkunkStudios 2025-05-07 06:18:40 +07:00
parent b35433ae45
commit 71779ef7ac
9413 changed files with 193360 additions and 264803 deletions

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 83cf88c7da1e20c499c167cc76d12b71
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,65 @@
#pragma strict
@CustomEditor (AntialiasingAsPostEffect)
class AntialiasingAsPostEffectEditor extends Editor
{
var serObj : SerializedObject;
var mode : SerializedProperty;
var showGeneratedNormals : SerializedProperty;
var offsetScale : SerializedProperty;
var blurRadius : SerializedProperty;
var dlaaSharp : SerializedProperty;
var edgeThresholdMin : SerializedProperty;
var edgeThreshold : SerializedProperty;
var edgeSharpness : SerializedProperty;
function OnEnable () {
serObj = new SerializedObject (target);
mode = serObj.FindProperty ("mode");
showGeneratedNormals = serObj.FindProperty ("showGeneratedNormals");
offsetScale = serObj.FindProperty ("offsetScale");
blurRadius = serObj.FindProperty ("blurRadius");
dlaaSharp = serObj.FindProperty ("dlaaSharp");
edgeThresholdMin = serObj.FindProperty("edgeThresholdMin");
edgeThreshold = serObj.FindProperty("edgeThreshold");
edgeSharpness = serObj.FindProperty("edgeSharpness");
}
function OnInspectorGUI () {
serObj.Update ();
GUILayout.Label("Various luminance based fullscreen Antialiasing techniques", EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField (mode, new GUIContent ("AA Technique"));
var mat : Material = (target as AntialiasingAsPostEffect).CurrentAAMaterial ();
if(null == mat) {
EditorGUILayout.HelpBox("This AA technique is currently not supported. Choose a different technique or disable the effect and use MSAA instead.", MessageType.Warning);
}
if (mode.enumValueIndex == AAMode.NFAA) {
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (offsetScale, new GUIContent ("Edge Detect Ofs"));
EditorGUILayout.PropertyField (blurRadius, new GUIContent ("Blur Radius"));
EditorGUILayout.PropertyField (showGeneratedNormals, new GUIContent ("Show Normals"));
} else if (mode.enumValueIndex == AAMode.DLAA) {
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (dlaaSharp, new GUIContent ("Sharp"));
} else if (mode.enumValueIndex == AAMode.FXAA3Console) {
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (edgeThresholdMin, new GUIContent ("Edge Min Threshhold"));
EditorGUILayout.PropertyField (edgeThreshold, new GUIContent ("Edge Threshhold"));
EditorGUILayout.PropertyField (edgeSharpness, new GUIContent ("Edge Sharpness"));
}
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 411a271ca266b7040a7bd43bbb9db6c1
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,155 @@
#pragma strict
@CustomEditor (BloomAndLensFlares)
class BloomAndLensFlaresEditor extends Editor
{
var tweakMode : SerializedProperty;
var screenBlendMode : SerializedProperty;
var serObj : SerializedObject;
var hdr : SerializedProperty;
var sepBlurSpread : SerializedProperty;
var useSrcAlphaAsMask : SerializedProperty;
var bloomIntensity : SerializedProperty;
var bloomThreshhold : SerializedProperty;
var bloomBlurIterations : SerializedProperty;
var lensflares : SerializedProperty;
var hollywoodFlareBlurIterations : SerializedProperty;
var lensflareMode : SerializedProperty;
var hollyStretchWidth : SerializedProperty;
var lensflareIntensity : SerializedProperty;
var lensflareThreshhold : SerializedProperty;
var flareColorA : SerializedProperty;
var flareColorB : SerializedProperty;
var flareColorC : SerializedProperty;
var flareColorD : SerializedProperty;
var blurWidth : SerializedProperty;
var lensFlareVignetteMask : SerializedProperty;
function OnEnable () {
serObj = new SerializedObject (target);
screenBlendMode = serObj.FindProperty("screenBlendMode");
hdr = serObj.FindProperty("hdr");
sepBlurSpread = serObj.FindProperty("sepBlurSpread");
useSrcAlphaAsMask = serObj.FindProperty("useSrcAlphaAsMask");
bloomIntensity = serObj.FindProperty("bloomIntensity");
bloomThreshhold = serObj.FindProperty("bloomThreshhold");
bloomBlurIterations = serObj.FindProperty("bloomBlurIterations");
lensflares = serObj.FindProperty("lensflares");
lensflareMode = serObj.FindProperty("lensflareMode");
hollywoodFlareBlurIterations = serObj.FindProperty("hollywoodFlareBlurIterations");
hollyStretchWidth = serObj.FindProperty("hollyStretchWidth");
lensflareIntensity = serObj.FindProperty("lensflareIntensity");
lensflareThreshhold = serObj.FindProperty("lensflareThreshhold");
flareColorA = serObj.FindProperty("flareColorA");
flareColorB = serObj.FindProperty("flareColorB");
flareColorC = serObj.FindProperty("flareColorC");
flareColorD = serObj.FindProperty("flareColorD");
blurWidth = serObj.FindProperty("blurWidth");
lensFlareVignetteMask = serObj.FindProperty("lensFlareVignetteMask");
tweakMode = serObj.FindProperty("tweakMode");
}
function OnInspectorGUI () {
serObj.Update();
GUILayout.Label("HDR " + (hdr.enumValueIndex == 0 ? "auto detected, " : (hdr.enumValueIndex == 1 ? "forced on, " : "disabled, ")) + (useSrcAlphaAsMask.floatValue < 0.1f ? " ignoring alpha channel glow information" : " using alpha channel glow information"), EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField (tweakMode, new GUIContent("Tweak mode"));
EditorGUILayout.PropertyField (screenBlendMode, new GUIContent("Blend mode"));
EditorGUILayout.PropertyField (hdr, new GUIContent("HDR"));
// display info text when screen blend mode cannot be used
var cam : Camera = (target as BloomAndLensFlares).camera;
if(cam != null) {
if(screenBlendMode.enumValueIndex==0 && ((cam.hdr && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
EditorGUILayout.HelpBox("Screen blend is not supported in HDR. Using 'Add' instead.", MessageType.Info);
}
}
if (1 == tweakMode.intValue)
EditorGUILayout.PropertyField (lensflares, new GUIContent("Cast lens flares"));
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (bloomIntensity, new GUIContent("Intensity"));
bloomThreshhold.floatValue = EditorGUILayout.Slider ("Threshhold", bloomThreshhold.floatValue, -0.05, 4.0);
bloomBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", bloomBlurIterations.intValue, 1, 4);
sepBlurSpread.floatValue = EditorGUILayout.Slider ("Blur spread", sepBlurSpread.floatValue, 0.1, 10.0);
if (1 == tweakMode.intValue)
useSrcAlphaAsMask.floatValue = EditorGUILayout.Slider (new GUIContent("Use alpha mask", "Make alpha channel define glowiness"), useSrcAlphaAsMask.floatValue, 0.0, 1.0);
else
useSrcAlphaAsMask.floatValue = 0.0;
if (1 == tweakMode.intValue) {
EditorGUILayout.Separator ();
if (lensflares.boolValue) {
// further lens flare tweakings
if (0 != tweakMode.intValue)
EditorGUILayout.PropertyField (lensflareMode, new GUIContent("Lens flare mode"));
else
lensflareMode.enumValueIndex = 0;
EditorGUILayout.PropertyField(lensFlareVignetteMask, new GUIContent("Lens flare mask", "This mask is needed to prevent lens flare artifacts"));
EditorGUILayout.PropertyField (lensflareIntensity, new GUIContent("Local intensity"));
lensflareThreshhold.floatValue = EditorGUILayout.Slider ("Local threshhold", lensflareThreshhold.floatValue, 0.0, 1.0);
if (lensflareMode.intValue == 0) {
// ghosting
EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorA, new GUIContent("1st Color"));
EditorGUILayout.PropertyField (flareColorB, new GUIContent("2nd Color"));
EditorGUILayout.EndHorizontal ();
EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorC, new GUIContent("3rd Color"));
EditorGUILayout.PropertyField (flareColorD, new GUIContent("4th Color"));
EditorGUILayout.EndHorizontal ();
}
else if (lensflareMode.intValue == 1) {
// hollywood
EditorGUILayout.PropertyField (hollyStretchWidth, new GUIContent("Stretch width"));
hollywoodFlareBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", hollywoodFlareBlurIterations.intValue, 1, 4);
EditorGUILayout.PropertyField (flareColorA, new GUIContent("Tint Color"));
}
else if (lensflareMode.intValue == 2) {
// both
EditorGUILayout.PropertyField (hollyStretchWidth, new GUIContent("Stretch width"));
hollywoodFlareBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", hollywoodFlareBlurIterations.intValue, 1, 4);
EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorA, new GUIContent("1st Color"));
EditorGUILayout.PropertyField (flareColorB, new GUIContent("2nd Color"));
EditorGUILayout.EndHorizontal ();
EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorC, new GUIContent("3rd Color"));
EditorGUILayout.PropertyField (flareColorD, new GUIContent("4th Color"));
EditorGUILayout.EndHorizontal ();
}
}
} else
lensflares.boolValue = false; // disable lens flares in simple tweak mode
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4c118a16d5ddd85498a323cf26feca74
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,134 @@
#pragma strict
@CustomEditor (ColorCorrectionCurves)
class ColorCorrectionCurvesEditor extends Editor {
var serObj : SerializedObject;
var mode : SerializedProperty;
var redChannel : SerializedProperty;
var greenChannel : SerializedProperty;
var blueChannel : SerializedProperty;
var useDepthCorrection : SerializedProperty;
var depthRedChannel : SerializedProperty;
var depthGreenChannel : SerializedProperty;
var depthBlueChannel : SerializedProperty;
var zCurveChannel : SerializedProperty;
var selectiveCc : SerializedProperty;
var selectiveFromColor : SerializedProperty;
var selectiveToColor : SerializedProperty;
private var applyCurveChanges : boolean = false;
function OnEnable () {
serObj = new SerializedObject (target);
mode = serObj.FindProperty ("mode");
redChannel = serObj.FindProperty ("redChannel");
greenChannel = serObj.FindProperty ("greenChannel");
blueChannel = serObj.FindProperty ("blueChannel");
useDepthCorrection = serObj.FindProperty ("useDepthCorrection");
zCurveChannel = serObj.FindProperty ("zCurve");
depthRedChannel = serObj.FindProperty ("depthRedChannel");
depthGreenChannel = serObj.FindProperty ("depthGreenChannel");
depthBlueChannel = serObj.FindProperty ("depthBlueChannel");
if (!redChannel.animationCurveValue.length)
redChannel.animationCurveValue = new AnimationCurve(Keyframe(0, 0.0, 1.0, 1.0), Keyframe(1, 1.0, 1.0, 1.0));
if (!greenChannel.animationCurveValue.length)
greenChannel.animationCurveValue = new AnimationCurve(Keyframe(0, 0.0, 1.0, 1.0), Keyframe(1, 1.0, 1.0, 1.0));
if (!blueChannel.animationCurveValue.length)
blueChannel.animationCurveValue = new AnimationCurve(Keyframe(0, 0.0, 1.0, 1.0), Keyframe(1, 1.0, 1.0, 1.0));
if (!depthRedChannel.animationCurveValue.length)
depthRedChannel.animationCurveValue = new AnimationCurve(Keyframe(0, 0.0, 1.0, 1.0), Keyframe(1, 1.0, 1.0, 1.0));
if (!depthGreenChannel.animationCurveValue.length)
depthGreenChannel.animationCurveValue = new AnimationCurve(Keyframe(0, 0.0, 1.0, 1.0), Keyframe(1, 1.0, 1.0, 1.0));
if (!depthBlueChannel.animationCurveValue.length)
depthBlueChannel.animationCurveValue = new AnimationCurve(Keyframe(0, 0.0, 1.0, 1.0), Keyframe(1, 1.0, 1.0, 1.0));
if (!zCurveChannel.animationCurveValue.length)
zCurveChannel.animationCurveValue = new AnimationCurve(Keyframe(0, 0.0, 1.0, 1.0), Keyframe(1, 1.0, 1.0, 1.0));
serObj.ApplyModifiedProperties ();
selectiveCc = serObj.FindProperty ("selectiveCc");
selectiveFromColor = serObj.FindProperty ("selectiveFromColor");
selectiveToColor = serObj.FindProperty ("selectiveToColor");
}
function CurveGui (name : String, animationCurve : SerializedProperty, color : Color) {
// @NOTE: EditorGUILayout.CurveField is buggy and flickers, using PropertyField for now
//animationCurve.animationCurveValue = EditorGUILayout.CurveField (GUIContent (name), animationCurve.animationCurveValue, color, Rect (0.0,0.0,1.0,1.0));
EditorGUILayout.PropertyField (animationCurve, GUIContent (name));
if (GUI.changed)
applyCurveChanges = true;
}
function BeginCurves () {
applyCurveChanges = false;
}
function ApplyCurves () {
if (applyCurveChanges) {
serObj.ApplyModifiedProperties ();
(serObj.targetObject as ColorCorrectionCurves).gameObject.SendMessage ("UpdateTextures");
}
}
function OnInspectorGUI () {
serObj.Update ();
GUILayout.Label ("Curves to tweak colors. Advanced separates fore- and background.", EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField (mode, GUIContent ("Mode"));
GUILayout.Label ("Curves", EditorStyles.boldLabel);
BeginCurves ();
CurveGui ("Red", redChannel, Color.red);
CurveGui ("Blue", blueChannel, Color.blue);
CurveGui ("Green", greenChannel, Color.green);
EditorGUILayout.Separator ();
if (mode.intValue > 0)
useDepthCorrection.boolValue = true;
else
useDepthCorrection.boolValue = false;
if (useDepthCorrection.boolValue) {
CurveGui ("Red (depth)", depthRedChannel, Color.red);
CurveGui ("Blue (depth)", depthBlueChannel, Color.blue);
CurveGui ("Green (depth)", depthGreenChannel, Color.green);
EditorGUILayout.Separator ();
CurveGui ("Blend Curve", zCurveChannel, Color.grey);
}
if (mode.intValue > 0) {
EditorGUILayout.Separator ();
GUILayout.Label("Selective Color Correction", EditorStyles.boldLabel);
EditorGUILayout.PropertyField (selectiveCc, GUIContent ("Enable"));
if (selectiveCc.boolValue) {
EditorGUILayout.PropertyField (selectiveFromColor, GUIContent ("Key"));
EditorGUILayout.PropertyField (selectiveToColor, GUIContent ("Target"));
}
}
ApplyCurves ();
if (!applyCurveChanges)
serObj.ApplyModifiedProperties ();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b5fa2369f63efe84f929964a21302b6b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,144 @@
#pragma strict
@CustomEditor (DepthOfField34)
class DepthOfField34Editor extends Editor
{
var serObj : SerializedObject;
var simpleTweakMode : SerializedProperty;
var focalPoint : SerializedProperty;
var smoothness : SerializedProperty;
var focalSize : SerializedProperty;
var focalZDistance : SerializedProperty;
var focalStartCurve : SerializedProperty;
var focalEndCurve : SerializedProperty;
var visualizeCoc : SerializedProperty;
var resolution : SerializedProperty;
var quality : SerializedProperty;
var objectFocus : SerializedProperty;
var bokeh : SerializedProperty;
var bokehScale : SerializedProperty;
var bokehIntensity : SerializedProperty;
var bokehThreshholdLuminance : SerializedProperty;
var bokehThreshholdContrast : SerializedProperty;
var bokehDownsample : SerializedProperty;
var bokehTexture : SerializedProperty;
var bokehDestination : SerializedProperty;
var bluriness : SerializedProperty;
var maxBlurSpread : SerializedProperty;
var foregroundBlurExtrude : SerializedProperty;
function OnEnable () {
serObj = new SerializedObject (target);
simpleTweakMode = serObj.FindProperty ("simpleTweakMode");
// simple tweak mode
focalPoint = serObj.FindProperty ("focalPoint");
smoothness = serObj.FindProperty ("smoothness");
// complex tweak mode
focalZDistance = serObj.FindProperty ("focalZDistance");
focalStartCurve = serObj.FindProperty ("focalZStartCurve");
focalEndCurve = serObj.FindProperty ("focalZEndCurve");
focalSize = serObj.FindProperty ("focalSize");
visualizeCoc = serObj.FindProperty ("visualize");
objectFocus = serObj.FindProperty ("objectFocus");
resolution = serObj.FindProperty ("resolution");
quality = serObj.FindProperty ("quality");
bokehThreshholdContrast = serObj.FindProperty ("bokehThreshholdContrast");
bokehThreshholdLuminance = serObj.FindProperty ("bokehThreshholdLuminance");
bokeh = serObj.FindProperty ("bokeh");
bokehScale = serObj.FindProperty ("bokehScale");
bokehIntensity = serObj.FindProperty ("bokehIntensity");
bokehDownsample = serObj.FindProperty ("bokehDownsample");
bokehTexture = serObj.FindProperty ("bokehTexture");
bokehDestination = serObj.FindProperty ("bokehDestination");
bluriness = serObj.FindProperty ("bluriness");
maxBlurSpread = serObj.FindProperty ("maxBlurSpread");
foregroundBlurExtrude = serObj.FindProperty ("foregroundBlurExtrude");
}
function OnInspectorGUI () {
serObj.Update ();
var go : GameObject = (target as DepthOfField34).gameObject;
if (!go)
return;
if (!go.camera)
return;
if (simpleTweakMode.boolValue)
GUILayout.Label ("Current: "+go.camera.name+", near "+go.camera.nearClipPlane+", far: "+go.camera.farClipPlane+", focal: "+focalPoint.floatValue, EditorStyles.miniBoldLabel);
else
GUILayout.Label ("Current: "+go.camera.name+", near "+go.camera.nearClipPlane+", far: "+go.camera.farClipPlane+", focal: "+focalZDistance.floatValue, EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField (resolution, new GUIContent("Resolution"));
EditorGUILayout.PropertyField (quality, new GUIContent("Quality"));
EditorGUILayout.PropertyField (simpleTweakMode, new GUIContent("Simple tweak"));
EditorGUILayout.PropertyField (visualizeCoc, new GUIContent("Visualize focus"));
EditorGUILayout.PropertyField (bokeh, new GUIContent("Enable bokeh"));
EditorGUILayout.Separator ();
GUILayout.Label ("Focal Settings", EditorStyles.boldLabel);
if (simpleTweakMode.boolValue) {
focalPoint.floatValue = EditorGUILayout.Slider ("Focal distance", focalPoint.floatValue, go.camera.nearClipPlane, go.camera.farClipPlane);
EditorGUILayout.PropertyField (objectFocus, new GUIContent("Transform"));
EditorGUILayout.PropertyField (smoothness, new GUIContent("Smoothness"));
focalSize.floatValue = EditorGUILayout.Slider ("Focal size", focalSize.floatValue, 0.0f, (go.camera.farClipPlane - go.camera.nearClipPlane));
}
else {
focalZDistance.floatValue = EditorGUILayout.Slider ("Distance", focalZDistance.floatValue, go.camera.nearClipPlane, go.camera.farClipPlane);
EditorGUILayout.PropertyField (objectFocus, new GUIContent("Transform"));
focalSize.floatValue = EditorGUILayout.Slider ("Size", focalSize.floatValue, 0.0f, (go.camera.farClipPlane - go.camera.nearClipPlane));
focalStartCurve.floatValue = EditorGUILayout.Slider ("Start curve", focalStartCurve.floatValue, 0.05f, 20.0f);
focalEndCurve.floatValue = EditorGUILayout.Slider ("End curve", focalEndCurve.floatValue, 0.05f, 20.0f);
}
EditorGUILayout.Separator ();
GUILayout.Label ("Blur (Fore- and Background)", EditorStyles.boldLabel);
EditorGUILayout.PropertyField (bluriness, new GUIContent("Blurriness"));
EditorGUILayout.PropertyField (maxBlurSpread, new GUIContent("Blur spread"));
if (quality.enumValueIndex > 0) {
EditorGUILayout.PropertyField (foregroundBlurExtrude, new GUIContent("Foreground size"));
}
EditorGUILayout.Separator ();
if (bokeh.boolValue) {
EditorGUILayout.Separator ();
GUILayout.Label ("Bokeh Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField (bokehDestination, new GUIContent("Destination"));
bokehIntensity.floatValue = EditorGUILayout.Slider ("Intensity", bokehIntensity.floatValue, 0.0f, 1.0f);
bokehThreshholdLuminance.floatValue = EditorGUILayout.Slider ("Min luminance", bokehThreshholdLuminance.floatValue, 0.0f, 0.99f);
bokehThreshholdContrast.floatValue = EditorGUILayout.Slider ("Min contrast", bokehThreshholdContrast.floatValue, 0.0f, 0.25f);
bokehDownsample.intValue = EditorGUILayout.IntSlider ("Downsample", bokehDownsample.intValue, 1, 3);
bokehScale.floatValue = EditorGUILayout.Slider ("Size scale", bokehScale.floatValue, 0.0f, 20.0f);
EditorGUILayout.PropertyField (bokehTexture , new GUIContent("Texture mask"));
}
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6356946fd5c1b6845ad5b840adcd5e28
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,48 @@
@script ExecuteInEditMode()
@CustomEditor (EdgeDetectEffectNormals)
class EdgeDetectEffectNormalsEditor extends Editor
{
var serObj : SerializedObject;
var mode : SerializedProperty;
var sensitivityDepth : SerializedProperty;
var sensitivityNormals : SerializedProperty;
var edgesOnly : SerializedProperty;
var edgesOnlyBgColor : SerializedProperty;
function OnEnable () {
serObj = new SerializedObject (target);
mode = serObj.FindProperty("mode");
sensitivityDepth = serObj.FindProperty("sensitivityDepth");
sensitivityNormals = serObj.FindProperty("sensitivityNormals");
edgesOnly = serObj.FindProperty("edgesOnly");
edgesOnlyBgColor = serObj.FindProperty("edgesOnlyBgColor");
}
function OnInspectorGUI ()
{
serObj.Update ();
EditorGUILayout.PropertyField (mode, new GUIContent("Mode"));
GUILayout.Label ("Edge sensitivity");
EditorGUILayout.PropertyField (sensitivityDepth, new GUIContent("Depth"));
EditorGUILayout.PropertyField (sensitivityNormals, new GUIContent("Normals"));
EditorGUILayout.Separator ();
GUILayout.Label ("Background options");
edgesOnly.floatValue = EditorGUILayout.Slider ("Edges only", edgesOnly.floatValue, 0.0, 1.0);
EditorGUILayout.PropertyField (edgesOnlyBgColor, new GUIContent ("Background"));
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5ab9f2196ee48d947aa812d0b41ec478
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,102 @@
#pragma strict
@CustomEditor (SunShafts)
class SunShaftsEditor extends Editor
{
var serObj : SerializedObject;
var sunTransform : SerializedProperty;
var radialBlurIterations : SerializedProperty;
var sunColor : SerializedProperty;
var sunShaftBlurRadius : SerializedProperty;
var sunShaftIntensity : SerializedProperty;
var useSkyBoxAlpha : SerializedProperty;
var useDepthTexture : SerializedProperty;
var resolution : SerializedProperty;
var screenBlendMode : SerializedProperty;
var maxRadius : SerializedProperty;
function OnEnable () {
serObj = new SerializedObject (target);
screenBlendMode = serObj.FindProperty("screenBlendMode");
sunTransform = serObj.FindProperty("sunTransform");
sunColor = serObj.FindProperty("sunColor");
sunShaftBlurRadius = serObj.FindProperty("sunShaftBlurRadius");
radialBlurIterations = serObj.FindProperty("radialBlurIterations");
sunShaftIntensity = serObj.FindProperty("sunShaftIntensity");
useSkyBoxAlpha = serObj.FindProperty("useSkyBoxAlpha");
resolution = serObj.FindProperty("resolution");
maxRadius = serObj.FindProperty("maxRadius");
useDepthTexture = serObj.FindProperty("useDepthTexture");
}
function OnInspectorGUI () {
serObj.Update ();
EditorGUILayout.BeginHorizontal();
var oldVal : boolean = useDepthTexture.boolValue;
EditorGUILayout.PropertyField (useDepthTexture, new GUIContent ("Rely on Z Buffer?"));
if((target as SunShafts).camera)
GUILayout.Label("Current camera mode: "+ (target as SunShafts).camera.depthTextureMode, EditorStyles.miniBoldLabel);
EditorGUILayout.EndHorizontal();
// depth buffer need
/*
var newVal : boolean = useDepthTexture.boolValue;
if (newVal != oldVal) {
if(newVal)
(target as SunShafts).camera.depthTextureMode |= DepthTextureMode.Depth;
else
(target as SunShafts).camera.depthTextureMode &= ~DepthTextureMode.Depth;
}
*/
EditorGUILayout.PropertyField (resolution, new GUIContent("Resolution"));
EditorGUILayout.PropertyField (screenBlendMode, new GUIContent("Blend mode"));
EditorGUILayout.Separator ();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField (sunTransform, new GUIContent("Shafts caster", "Chose a transform that acts as a root point for the produced sun shafts"));
if((target as SunShafts).sunTransform && (target as SunShafts).camera) {
if (GUILayout.Button("Center on " + (target as SunShafts).camera.name)) {
if (EditorUtility.DisplayDialog ("Move sun shafts source?", "The SunShafts caster named "+ (target as SunShafts).sunTransform.name +"\n will be centered along "+(target as SunShafts).camera.name+". Are you sure? ", "Please do", "Don't")) {
var ray : Ray = (target as SunShafts).camera.ViewportPointToRay(Vector3(0.5,0.5,0));
(target as SunShafts).sunTransform.position = ray.origin + ray.direction * 500.0;
(target as SunShafts).sunTransform.LookAt ((target as SunShafts).transform);
}
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (sunColor, new GUIContent ("Shafts color"));
maxRadius.floatValue = 1.0f - EditorGUILayout.Slider ("Distance falloff", 1.0f - maxRadius.floatValue, 0.1, 1.0);
EditorGUILayout.Separator ();
sunShaftBlurRadius.floatValue = EditorGUILayout.Slider ("Blur size", sunShaftBlurRadius.floatValue, 1.0, 10.0);
radialBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", radialBlurIterations.intValue, 1, 3);
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (sunShaftIntensity, new GUIContent("Intensity"));
useSkyBoxAlpha.floatValue = EditorGUILayout.Slider ("Use alpha mask", useSkyBoxAlpha.floatValue, 0.0, 1.0);
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3504778455f1c8442885a8651f2ed3dd
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,72 @@
#pragma strict
@CustomEditor (TiltShift)
class TiltShiftEditor extends Editor
{
var serObj : SerializedObject;
var focalPoint : SerializedProperty;
var smoothness : SerializedProperty;
var visualizeCoc : SerializedProperty;
var renderTextureDivider : SerializedProperty;
var blurIterations : SerializedProperty;
var foregroundBlurIterations : SerializedProperty;
var maxBlurSpread : SerializedProperty;
var enableForegroundBlur : SerializedProperty;
function OnEnable () {
serObj = new SerializedObject (target);
focalPoint = serObj.FindProperty ("focalPoint");
smoothness = serObj.FindProperty ("smoothness");
visualizeCoc = serObj.FindProperty ("visualizeCoc");
renderTextureDivider = serObj.FindProperty ("renderTextureDivider");
blurIterations = serObj.FindProperty ("blurIterations");
foregroundBlurIterations = serObj.FindProperty ("foregroundBlurIterations");
maxBlurSpread = serObj.FindProperty ("maxBlurSpread");
enableForegroundBlur = serObj.FindProperty ("enableForegroundBlur");
}
function OnInspectorGUI () {
serObj.Update ();
var go : GameObject = (target as TiltShift).gameObject;
if (!go)
return;
if (!go.camera)
return;
GUILayout.Label ("Current: "+go.camera.name+", near "+go.camera.nearClipPlane+", far: "+go.camera.farClipPlane+", focal: "+focalPoint.floatValue, EditorStyles.miniBoldLabel);
GUILayout.Label ("Focal Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField (visualizeCoc, new GUIContent("Visualize"));
focalPoint.floatValue = EditorGUILayout.Slider ("Distance", focalPoint.floatValue, go.camera.nearClipPlane, go.camera.farClipPlane);
EditorGUILayout.PropertyField (smoothness, new GUIContent("Smoothness"));
EditorGUILayout.Separator ();
GUILayout.Label ("Background Blur", EditorStyles.boldLabel);
renderTextureDivider.intValue = EditorGUILayout.Slider ("Downsample", renderTextureDivider.intValue, 1, 3);
blurIterations.intValue = EditorGUILayout.Slider ("Iterations", blurIterations.intValue, 1, 4);
EditorGUILayout.PropertyField (maxBlurSpread, new GUIContent("Max blur spread"));
EditorGUILayout.Separator ();
GUILayout.Label ("Foreground Blur", EditorStyles.boldLabel);
EditorGUILayout.PropertyField (enableForegroundBlur, new GUIContent("Enable"));
if (enableForegroundBlur.boolValue)
foregroundBlurIterations.intValue = EditorGUILayout.Slider ("Iterations", foregroundBlurIterations.intValue, 1, 4);
//GUILayout.Label ("Background options");
//edgesOnly.floatValue = EditorGUILayout.Slider ("Edges only", edgesOnly.floatValue, 0.0, 1.0);
//EditorGUILayout.PropertyField (edgesOnlyBgColor, new GUIContent ("Background"));
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 56bd85ad52a0bfb4d8c0e745c8dc1123
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,77 @@
#pragma strict
@CustomEditor (Tonemapping)
class TonemappingEditor extends Editor
{
var serObj : SerializedObject;
var type : SerializedProperty;;
// CURVE specific parameter
var remapCurve : SerializedProperty;
var exposureAdjustment : SerializedProperty;
// REINHARD specific parameter
var middleGrey : SerializedProperty;
var white : SerializedProperty;
var adaptionSpeed : SerializedProperty;
var adaptiveTextureSize : SerializedProperty;
function OnEnable () {
serObj = new SerializedObject (target);
type = serObj.FindProperty ("type");
remapCurve = serObj.FindProperty ("remapCurve");
exposureAdjustment = serObj.FindProperty ("exposureAdjustment");
middleGrey = serObj.FindProperty ("middleGrey");
white = serObj.FindProperty ("white");
adaptionSpeed = serObj.FindProperty ("adaptionSpeed");
adaptiveTextureSize = serObj.FindProperty("adaptiveTextureSize");
}
function OnInspectorGUI () {
serObj.Update ();
GUILayout.Label("Mapping HDR to LDR ranges since 1982", EditorStyles.miniBoldLabel);
var cam : Camera = (target as Tonemapping).camera;
if(cam != null) {
if(!cam.hdr) {
EditorGUILayout.HelpBox("The camera is not HDR enabled. This will likely break the Tonemapper.", MessageType.Warning);
}
else if(!(target as Tonemapping).validRenderTextureFormat) {
EditorGUILayout.HelpBox("The input to Tonemapper is not in HDR. Make sure that all effects prior to this are executed in HDR.", MessageType.Warning);
}
}
EditorGUILayout.PropertyField (type, new GUIContent ("Technique"));
if (type.enumValueIndex == Tonemapping.TonemapperType.UserCurve) {
EditorGUILayout.PropertyField (remapCurve, new GUIContent ("Remap curve", "Specify the mapping of luminances yourself"));
} else if (type.enumValueIndex == Tonemapping.TonemapperType.SimpleReinhard) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == Tonemapping.TonemapperType.Hable) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == Tonemapping.TonemapperType.Photographic) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == Tonemapping.TonemapperType.OptimizedHejiDawson) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == Tonemapping.TonemapperType.AdaptiveReinhard) {
EditorGUILayout.PropertyField (middleGrey, new GUIContent ("Middle grey", "Middle grey defines the average luminance thus brightening or darkening the entire image."));
EditorGUILayout.PropertyField (white, new GUIContent ("White", "Smallest luminance value that will be mapped to white"));
EditorGUILayout.PropertyField (adaptionSpeed, new GUIContent ("Adaption Speed", "Speed modifier for the automatic adaption"));
EditorGUILayout.PropertyField (adaptiveTextureSize, new GUIContent ("Texture size", "Defines the amount of downsamples needed."));
} else if (type.enumValueIndex == Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite) {
EditorGUILayout.PropertyField (middleGrey, new GUIContent ("Middle grey", "Middle grey defines the average luminance thus brightening or darkening the entire image."));
EditorGUILayout.PropertyField (adaptionSpeed, new GUIContent ("Adaption Speed", "Speed modifier for the automatic adaption"));
EditorGUILayout.PropertyField (adaptiveTextureSize, new GUIContent ("Texture size", "Defines the amount of downsamples needed."));
}
GUILayout.Label("All following effects will use LDR color buffers", EditorStyles.miniBoldLabel);
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 94f9b3016954e9d448b5a14dedb80664
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7c5bab292f7531646acba95629bda558
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 250c00c11af541949b9ea59bfda7c098
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,103 @@
using UnityEngine;
using System;
using UnityEditor;
[CustomEditor(typeof(GerstnerDisplace))]
public class GerstnerDisplaceEditor : Editor
{
private SerializedObject serObj;
public void OnEnable ()
{
serObj = new SerializedObject (target);
}
public override void OnInspectorGUI ()
{
serObj.Update();
GameObject go = ((GerstnerDisplace)serObj.targetObject).gameObject;
WaterBase wb = (WaterBase)go.GetComponent(typeof(WaterBase));
Material sharedWaterMaterial = wb.sharedMaterial;
GUILayout.Label ("Animates vertices using up 4 generated waves", EditorStyles.miniBoldLabel);
if(sharedWaterMaterial)
{
Vector4 amplitude = WaterEditorUtility.GetMaterialVector("_GAmplitude", sharedWaterMaterial);
Vector4 frequency = WaterEditorUtility.GetMaterialVector("_GFrequency", sharedWaterMaterial);
Vector4 steepness = WaterEditorUtility.GetMaterialVector("_GSteepness", sharedWaterMaterial);
Vector4 speed = WaterEditorUtility.GetMaterialVector("_GSpeed", sharedWaterMaterial);
Vector4 directionAB = WaterEditorUtility.GetMaterialVector("_GDirectionAB", sharedWaterMaterial);
Vector4 directionCD = WaterEditorUtility.GetMaterialVector("_GDirectionCD", sharedWaterMaterial);
amplitude = EditorGUILayout.Vector4Field("Amplitude (Height offset)", amplitude);
frequency = EditorGUILayout.Vector4Field("Frequency (Tiling)", frequency);
steepness = EditorGUILayout.Vector4Field("Steepness", steepness);
speed = EditorGUILayout.Vector4Field("Speed", speed);
directionAB = EditorGUILayout.Vector4Field("Direction scale (Wave 1 (X,Y) and 2 (Z,W))", directionAB);
directionCD = EditorGUILayout.Vector4Field("Direction scale (Wave 3 (X,Y) and 4 (Z,W))", directionCD);
if (GUI.changed) {
WaterEditorUtility.SetMaterialVector("_GAmplitude", amplitude, sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector("_GFrequency", frequency, sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector("_GSteepness", steepness, sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector("_GSpeed", speed, sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector("_GDirectionAB", directionAB, sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector("_GDirectionCD", directionCD, sharedWaterMaterial);
}
/*
Vector4 animationTiling = WaterEditorUtility.GetMaterialVector("_AnimationTiling", sharedWaterMaterial);
Vector4 animationDirection = WaterEditorUtility.GetMaterialVector("_AnimationDirection", sharedWaterMaterial);
float firstTilingU = animationTiling.x*100.0F;
float firstTilingV = animationTiling.y*100.0F;
float firstDirectionU = animationDirection.x;
float firstDirectionV = animationDirection.y;
float secondTilingU = animationTiling.z*100.0F;
float secondTilingV = animationTiling.w*100.0F;
float secondDirectionU = animationDirection.z;
float secondDirectionV = animationDirection.w;
EditorGUILayout.BeginHorizontal ();
firstTilingU = EditorGUILayout.FloatField("First Tiling U", firstTilingU);
firstTilingV = EditorGUILayout.FloatField("First Tiling V", firstTilingV);
EditorGUILayout.EndHorizontal ();
EditorGUILayout.BeginHorizontal ();
secondTilingU = EditorGUILayout.FloatField("Second Tiling U", secondTilingU);
secondTilingV = EditorGUILayout.FloatField("Second Tiling V", secondTilingV);
EditorGUILayout.EndHorizontal ();
EditorGUILayout.BeginHorizontal ();
firstDirectionU = EditorGUILayout.FloatField("1st Animation U", firstDirectionU);
firstDirectionV = EditorGUILayout.FloatField("1st Animation V", firstDirectionV);
EditorGUILayout.EndHorizontal ();
EditorGUILayout.BeginHorizontal ();
secondDirectionU = EditorGUILayout.FloatField("2nd Animation U", secondDirectionU);
secondDirectionV = EditorGUILayout.FloatField("2nd Animation V", secondDirectionV);
EditorGUILayout.EndHorizontal ();
animationDirection = new Vector4(firstDirectionU,firstDirectionV, secondDirectionU,secondDirectionV);
animationTiling = new Vector4(firstTilingU/100.0F,firstTilingV/100.0F, secondTilingU/100.0F,secondTilingV/100.0F);
WaterEditorUtility.SetMaterialVector("_AnimationTiling", animationTiling, sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector("_AnimationDirection", animationDirection, sharedWaterMaterial);
EditorGUILayout.Separator ();
GUILayout.Label ("Displacement Strength", EditorStyles.boldLabel);
float heightDisplacement = WaterEditorUtility.GetMaterialFloat("_HeightDisplacement", sharedWaterMaterial);
heightDisplacement = EditorGUILayout.Slider("Height", heightDisplacement, 0.0F, 5.0F);
WaterEditorUtility.SetMaterialFloat("_HeightDisplacement", heightDisplacement, sharedWaterMaterial);
*/
}
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 50be9983f0c75cf4fa62c990a9d4b242
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,60 @@
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(PlanarReflection))]
public class PlanarReflectionEditor : Editor
{
private SerializedObject serObj;
//private SerializedProperty wavesFrequency;
// reflection
private SerializedProperty reflectionMask;
private SerializedProperty reflectSkybox;
private SerializedProperty clearColor;
bool showKidsWithReflectionHint = false;
public void OnEnable () {
serObj = new SerializedObject (target);
reflectionMask = serObj.FindProperty("reflectionMask");
reflectSkybox = serObj.FindProperty("reflectSkybox");
clearColor = serObj.FindProperty("clearColor");
}
public override void OnInspectorGUI ()
{
GUILayout.Label ("Render planar reflections and use GrabPass for refractions", EditorStyles.miniBoldLabel);
if(!SystemInfo.supportsRenderTextures)
EditorGUILayout.HelpBox("Realtime reflections not supported", MessageType.Warning);
serObj.Update();
EditorGUILayout.PropertyField(reflectionMask, new GUIContent("Reflection layers"));
EditorGUILayout.PropertyField(reflectSkybox, new GUIContent("Use skybox"));
EditorGUILayout.PropertyField(clearColor, new GUIContent("Clear color"));
showKidsWithReflectionHint = EditorGUILayout.BeginToggleGroup("Show all tiles", showKidsWithReflectionHint);
if (showKidsWithReflectionHint) {
int i = 0;
foreach(Transform t in ((PlanarReflection)target).transform) {
if (t.GetComponent<WaterTile>()) {
if(i%2==0)
EditorGUILayout.BeginHorizontal();
EditorGUILayout.ObjectField(t, typeof(Transform), true);
if(i%2==1)
EditorGUILayout.EndHorizontal();
i = (i+1)%2;
}
}
if(i>0)
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndToggleGroup();
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4cc71abf24371b247af3a4b9a5efb7d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,47 @@
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(SpecularLighting))]
public class SpecularLightingEditor : Editor
{
private SerializedObject serObj;
private SerializedProperty specularLight;
public void OnEnable () {
serObj = new SerializedObject (target);
specularLight = serObj.FindProperty("specularLight");
}
public override void OnInspectorGUI ()
{
serObj.Update();
GameObject go = ((SpecularLighting)serObj.targetObject).gameObject;
WaterBase wb = (WaterBase)go.GetComponent(typeof(WaterBase));
if(!wb.sharedMaterial)
return;
if(wb.sharedMaterial.HasProperty("_WorldLightDir")) {
GUILayout.Label ("Transform casting specular highlights", EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField(specularLight, new GUIContent("Specular light"));
if(wb.sharedMaterial.HasProperty("_SpecularColor"))
WaterEditorUtility.SetMaterialColor(
"_SpecularColor",
EditorGUILayout.ColorField("Specular",
WaterEditorUtility.GetMaterialColor("_SpecularColor", wb.sharedMaterial)),
wb.sharedMaterial);
if(wb.sharedMaterial.HasProperty("_Shininess"))
WaterEditorUtility.SetMaterialFloat("_Shininess", EditorGUILayout.Slider(
"Specular power",
WaterEditorUtility.GetMaterialFloat("_Shininess", wb.sharedMaterial),
0.0F, 500.0F), wb.sharedMaterial);
}
else
GUILayout.Label ("The shader doesn't have the needed _WorldLightDir property.", EditorStyles.miniBoldLabel);
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f4bc38f8ed704e42912e22f0b895429
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,188 @@
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(WaterBase))]
public class WaterBaseEditor : Editor
{
public GameObject oceanBase;
private WaterBase waterBase;
private Material oceanMaterial = null;
private SerializedObject serObj;
private SerializedProperty sharedMaterial;
public SerializedProperty waterQuality;
public SerializedProperty edgeBlend;
public void OnEnable ()
{
serObj = new SerializedObject (target);
sharedMaterial = serObj.FindProperty("sharedMaterial");
waterQuality = serObj.FindProperty("waterQuality");
edgeBlend = serObj.FindProperty("edgeBlend");
}
public override void OnInspectorGUI ()
{
serObj.Update();
waterBase = (WaterBase)serObj.targetObject;
oceanBase = ((WaterBase)serObj.targetObject).gameObject;
if(!oceanBase)
return;
GUILayout.Label ("This script helps adjusting water material properties", EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField(sharedMaterial, new GUIContent("Material"));
oceanMaterial = (Material)sharedMaterial.objectReferenceValue;
if (!oceanMaterial) {
sharedMaterial.objectReferenceValue = (Object)WaterEditorUtility.LocateValidWaterMaterial(oceanBase.transform);
serObj.ApplyModifiedProperties();
oceanMaterial = (Material)sharedMaterial.objectReferenceValue;
if (!oceanMaterial)
return;
}
EditorGUILayout.Separator ();
GUILayout.Label ("Overall Quality", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(waterQuality, new GUIContent("Quality"));
EditorGUILayout.PropertyField(edgeBlend, new GUIContent("Edge blend?"));
if(waterQuality.intValue > (int)WaterQuality.Low && !SystemInfo.supportsRenderTextures)
EditorGUILayout.HelpBox("Water features not supported", MessageType.Warning);
if(edgeBlend.boolValue && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
EditorGUILayout.HelpBox("Edge blend not supported", MessageType.Warning);
EditorGUILayout.Separator ();
bool hasShore = oceanMaterial.HasProperty("_ShoreTex");
GUILayout.Label ("Main Colors", EditorStyles.boldLabel);
GUILayout.Label ("Alpha values define blending with realtime textures", EditorStyles.miniBoldLabel);
WaterEditorUtility.SetMaterialColor("_BaseColor", EditorGUILayout.ColorField("Refraction", WaterEditorUtility.GetMaterialColor("_BaseColor", oceanMaterial)), oceanMaterial);
WaterEditorUtility.SetMaterialColor("_ReflectionColor", EditorGUILayout.ColorField("Reflection", WaterEditorUtility.GetMaterialColor("_ReflectionColor", oceanMaterial)), oceanMaterial);
EditorGUILayout.Separator ();
GUILayout.Label ("Main Textures", EditorStyles.boldLabel);
GUILayout.Label ("Used for small waves (bumps), foam and white caps", EditorStyles.miniBoldLabel);
WaterEditorUtility.SetMaterialTexture("_BumpMap",(Texture)EditorGUILayout.ObjectField("Normals", WaterEditorUtility.GetMaterialTexture("_BumpMap", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial);
if (hasShore)
WaterEditorUtility.SetMaterialTexture("_ShoreTex", (Texture)EditorGUILayout.ObjectField("Shore & Foam", WaterEditorUtility.GetMaterialTexture("_ShoreTex", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial);
Vector4 animationTiling;
Vector4 animationDirection;
Vector2 firstTiling;
Vector2 secondTiling;
Vector2 firstDirection;
Vector2 secondDirection;
animationTiling = WaterEditorUtility.GetMaterialVector("_BumpTiling", oceanMaterial);
animationDirection = WaterEditorUtility.GetMaterialVector("_BumpDirection", oceanMaterial);
firstTiling = new Vector2(animationTiling.x*100.0F,animationTiling.y*100.0F);
secondTiling = new Vector2(animationTiling.z*100.0F,animationTiling.w*100.0F);
firstTiling = EditorGUILayout.Vector2Field("Tiling 1", firstTiling);
secondTiling = EditorGUILayout.Vector2Field("Tiling 2", secondTiling);
//firstTiling.x = EditorGUILayout.FloatField("1st Tiling U", firstTiling.x);
//firstTiling.y = EditorGUILayout.FloatField("1st Tiling V", firstTiling.y);
//secondTiling.x = EditorGUILayout.FloatField("2nd Tiling U", secondTiling.x);
//secondTiling.y = EditorGUILayout.FloatField("2nd Tiling V", secondTiling.y);
firstDirection = new Vector2(animationDirection.x,animationDirection.y);
secondDirection = new Vector2(animationDirection.z,animationDirection.w);
//firstDirection.x = EditorGUILayout.FloatField("1st Animation U", firstDirection.x);
//firstDirection.y = EditorGUILayout.FloatField("1st Animation V", firstDirection.y);
//secondDirection.x = EditorGUILayout.FloatField("2nd Animation U", secondDirection.x);
//secondDirection.y = EditorGUILayout.FloatField("2nd Animation V", secondDirection.y);
firstDirection = EditorGUILayout.Vector2Field("Direction 1", firstDirection);
secondDirection = EditorGUILayout.Vector2Field("Direction 2", secondDirection);
animationTiling = new Vector4(firstTiling.x/100.0F,firstTiling.y/100.0F, secondTiling.x/100.0F,secondTiling.y/100.0F);
animationDirection = new Vector4(firstDirection.x,firstDirection.y, secondDirection.x,secondDirection.y);
WaterEditorUtility.SetMaterialVector("_BumpTiling", animationTiling, oceanMaterial);
WaterEditorUtility.SetMaterialVector("_BumpDirection", animationDirection, oceanMaterial);
Vector4 displacementParameter = WaterEditorUtility.GetMaterialVector("_DistortParams", oceanMaterial);
Vector4 fade = WaterEditorUtility.GetMaterialVector("_InvFadeParemeter", oceanMaterial);
EditorGUILayout.Separator ();
GUILayout.Label ("Normals", EditorStyles.boldLabel);
GUILayout.Label ("Displacement for fresnel, specular and reflection/refraction", EditorStyles.miniBoldLabel);
float gerstnerNormalIntensity = WaterEditorUtility.GetMaterialFloat("_GerstnerIntensity", oceanMaterial);
gerstnerNormalIntensity = EditorGUILayout.Slider("Per Vertex", gerstnerNormalIntensity, -2.5F, 2.5F);
WaterEditorUtility.SetMaterialFloat("_GerstnerIntensity", gerstnerNormalIntensity, oceanMaterial);
displacementParameter.x = EditorGUILayout.Slider("Per Pixel", displacementParameter.x, -4.0F, 4.0F);
displacementParameter.y = EditorGUILayout.Slider("Distortion", displacementParameter.y, -0.5F, 0.5F);
// fade.z = EditorGUILayout.Slider("Distance fade", fade.z, 0.0f, 0.5f);
EditorGUILayout.Separator ();
GUILayout.Label ("Fresnel", EditorStyles.boldLabel);
GUILayout.Label ("Defines reflection to refraction relation", EditorStyles.miniBoldLabel);
if(!oceanMaterial.HasProperty("_Fresnel")) {
if(oceanMaterial.HasProperty("_FresnelScale")) {
float fresnelScale = EditorGUILayout.Slider("Intensity", WaterEditorUtility.GetMaterialFloat("_FresnelScale", oceanMaterial), 0.1F, 4.0F);
WaterEditorUtility.SetMaterialFloat("_FresnelScale", fresnelScale, oceanMaterial);
}
displacementParameter.z = EditorGUILayout.Slider("Power", displacementParameter.z, 0.1F, 10.0F);
displacementParameter.w = EditorGUILayout.Slider("Bias", displacementParameter.w, -3.0F, 3.0F);
}
else
{
Texture fresnelTex = (Texture)EditorGUILayout.ObjectField(
"Ramp",
(Texture)WaterEditorUtility.GetMaterialTexture("_Fresnel",
oceanMaterial),
typeof(Texture),
false);
WaterEditorUtility.SetMaterialTexture("_Fresnel", fresnelTex, oceanMaterial);
}
EditorGUILayout.Separator ();
WaterEditorUtility.SetMaterialVector("_DistortParams", displacementParameter, oceanMaterial);
if (edgeBlend.boolValue)
{
GUILayout.Label ("Fading", EditorStyles.boldLabel);
fade.x = EditorGUILayout.Slider("Edge fade", fade.x, 0.001f, 3.0f);
if(hasShore)
fade.y = EditorGUILayout.Slider("Shore fade", fade.y, 0.001f, 3.0f);
fade.w = EditorGUILayout.Slider("Extinction fade", fade.w, 0.0f, 2.5f);
WaterEditorUtility.SetMaterialVector("_InvFadeParemeter", fade, oceanMaterial);
}
EditorGUILayout.Separator ();
if(oceanMaterial.HasProperty("_Foam")) {
GUILayout.Label ("Foam", EditorStyles.boldLabel);
Vector4 foam = WaterEditorUtility.GetMaterialVector("_Foam", oceanMaterial);
foam.x = EditorGUILayout.Slider("Intensity", foam.x, 0.0F, 1.0F);
foam.y = EditorGUILayout.Slider("Cutoff", foam.y, 0.0F, 1.0F);
WaterEditorUtility.SetMaterialVector("_Foam", foam, oceanMaterial);
}
serObj.ApplyModifiedProperties();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: de1ac391993a86b4b8eb3d9e90340154
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,75 @@
using UnityEngine;
using UnityEditor;
class WaterEditorUtility
{
// helper functions to retrieve & set material values
public static float GetMaterialFloat(System.String name, Material mat) {
return mat.GetFloat(name);
}
public static void SetMaterialFloat(System.String name, float f, Material mat) {
mat.SetFloat(name, f);
}
public static Color GetMaterialColor(System.String name, Material mat) {
return mat.GetColor(name);
}
public static void SetMaterialColor(System.String name, Color color, Material mat) {
mat.SetColor(name, color);
}
public static Vector4 GetMaterialVector(System.String name, Material mat) {
return mat.GetVector(name);
}
public static void SetMaterialVector(System.String name, Vector4 vector, Material mat) {
mat.SetVector(name, vector);
}
public static Texture GetMaterialTexture(System.String theName, Material mat) {
return mat.GetTexture(theName);
}
public static void SetMaterialTexture(System.String theName, Texture parameter, Material mat) {
mat.SetTexture(theName, parameter);
}
public static Material LocateValidWaterMaterial(Transform parent)
{
if(parent.GetComponent<Renderer>() && parent.GetComponent<Renderer>().sharedMaterial)
return parent.GetComponent<Renderer>().sharedMaterial;
foreach( Transform t in parent)
{
if(t.GetComponent<Renderer>() && t.GetComponent<Renderer>().sharedMaterial)
return t.GetComponent<Renderer>().sharedMaterial;
}
return null;
}
public static void CurveGui (System.String name, SerializedObject serObj, Color color)
{
AnimationCurve curve = new AnimationCurve(new Keyframe(0, 0.0f, 1.0f, 1.0f), new Keyframe(1, 1.0f, 1.0f, 1.0f));
curve = EditorGUILayout.CurveField(new GUIContent (name), curve, color, new Rect (0.0f,0.0f,1.0f,1.0f));
//if (GUI.changed) {
// AnimationCurveChanged(((WaterBase)serObj.targetObject).sharedMaterial, curve);
//((WaterBase)serObj.targetObject).gameObject.SendMessage ("AnimationCurveChanged", SendMessageOptions.DontRequireReceiver);
//}
}
/*
public static void AnimationCurveChanged(Material sharedMaterial, AnimationCurve fresnelCurve)
{
Debug.Log("AnimationCurveChanged");
Texture2D fresnel = (Texture2D)sharedMaterial.GetTexture("_Fresnel");
if(!fresnel)
fresnel = new Texture2D(256,1);
for (int i = 0; i < 256; i++)
{
float val = Mathf.Clamp01(fresnelCurve.Evaluate((float)i)/255.0f);
Debug.Log(""+(((float)i)/255.0f) +": "+val);
fresnel.SetPixel(i, 0, new Color(val,val,val,val));
}
fresnel.Apply();
sharedMaterial.SetTexture("_Fresnel", fresnel);
} */
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 06f74e3cfe2c3ea46a62d707c9b7a8cc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: