initial commit

This commit is contained in:
2026-05-29 18:21:53 +03:00
commit 66ddf0ead0
2184 changed files with 1384338 additions and 0 deletions

View File

@@ -0,0 +1,161 @@
using System;
using UnityEditor;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(BloomAndFlares))]
class BloomAndFlaresEditor : Editor
{
SerializedProperty tweakMode;
SerializedProperty screenBlendMode;
SerializedObject serObj;
SerializedProperty hdr;
SerializedProperty sepBlurSpread;
SerializedProperty useSrcAlphaAsMask;
SerializedProperty bloomIntensity;
SerializedProperty bloomthreshold;
SerializedProperty bloomBlurIterations;
SerializedProperty lensflares;
SerializedProperty hollywoodFlareBlurIterations;
SerializedProperty lensflareMode;
SerializedProperty hollyStretchWidth;
SerializedProperty lensflareIntensity;
SerializedProperty lensflarethreshold;
SerializedProperty flareColorA;
SerializedProperty flareColorB;
SerializedProperty flareColorC;
SerializedProperty flareColorD;
SerializedProperty lensFlareVignetteMask;
void 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");
bloomthreshold = serObj.FindProperty("bloomThreshold");
bloomBlurIterations = serObj.FindProperty("bloomBlurIterations");
lensflares = serObj.FindProperty("lensflares");
lensflareMode = serObj.FindProperty("lensflareMode");
hollywoodFlareBlurIterations = serObj.FindProperty("hollywoodFlareBlurIterations");
hollyStretchWidth = serObj.FindProperty("hollyStretchWidth");
lensflareIntensity = serObj.FindProperty("lensflareIntensity");
lensflarethreshold = serObj.FindProperty("lensflareThreshold");
flareColorA = serObj.FindProperty("flareColorA");
flareColorB = serObj.FindProperty("flareColorB");
flareColorC = serObj.FindProperty("flareColorC");
flareColorD = serObj.FindProperty("flareColorD");
lensFlareVignetteMask = serObj.FindProperty("lensFlareVignetteMask");
tweakMode = serObj.FindProperty("tweakMode");
}
public override void 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
Camera cam = (target as BloomAndFlares).GetComponent<Camera>();
if (cam != null) {
#if UNITY_5_6_OR_NEWER
if (screenBlendMode.enumValueIndex==0 && ((cam.allowHDR && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
#else
if (screenBlendMode.enumValueIndex==0 && ((cam.hdr && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
#endif
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"));
bloomthreshold.floatValue = EditorGUILayout.Slider ("threshold", bloomthreshold.floatValue, -0.05f, 4.0f);
bloomBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", bloomBlurIterations.intValue, 1, 4);
sepBlurSpread.floatValue = EditorGUILayout.Slider ("Blur spread", sepBlurSpread.floatValue, 0.1f, 10.0f);
if (1 == tweakMode.intValue)
useSrcAlphaAsMask.floatValue = EditorGUILayout.Slider (new GUIContent("Use alpha mask", "Make alpha channel define glowiness"), useSrcAlphaAsMask.floatValue, 0.0f, 1.0f);
else
useSrcAlphaAsMask.floatValue = 0.0f;
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"));
lensflarethreshold.floatValue = EditorGUILayout.Slider ("Local threshold", lensflarethreshold.floatValue, 0.0f, 1.0f);
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,9 @@
fileFormatVersion: 2
guid: 4deca87cb459d1642ac8f734856ca84e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,166 @@
using System;
using UnityEditor;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(Bloom))]
class BloomEditor : Editor
{
SerializedProperty tweakMode;
SerializedProperty screenBlendMode;
SerializedObject serObj;
SerializedProperty hdr;
SerializedProperty quality;
SerializedProperty sepBlurSpread;
SerializedProperty bloomIntensity;
SerializedProperty bloomThresholdColor;
SerializedProperty bloomThreshold;
SerializedProperty bloomBlurIterations;
SerializedProperty hollywoodFlareBlurIterations;
SerializedProperty lensflareMode;
SerializedProperty hollyStretchWidth;
SerializedProperty lensflareIntensity;
SerializedProperty flareRotation;
SerializedProperty lensFlareSaturation;
SerializedProperty lensflareThreshold;
SerializedProperty flareColorA;
SerializedProperty flareColorB;
SerializedProperty flareColorC;
SerializedProperty flareColorD;
SerializedProperty lensFlareVignetteMask;
void OnEnable () {
serObj = new SerializedObject (target);
screenBlendMode = serObj.FindProperty("screenBlendMode");
hdr = serObj.FindProperty("hdr");
quality = serObj.FindProperty("quality");
sepBlurSpread = serObj.FindProperty("sepBlurSpread");
bloomIntensity = serObj.FindProperty("bloomIntensity");
bloomThreshold = serObj.FindProperty("bloomThreshold");
bloomThresholdColor = serObj.FindProperty("bloomThresholdColor");
bloomBlurIterations = serObj.FindProperty("bloomBlurIterations");
lensflareMode = serObj.FindProperty("lensflareMode");
hollywoodFlareBlurIterations = serObj.FindProperty("hollywoodFlareBlurIterations");
hollyStretchWidth = serObj.FindProperty("hollyStretchWidth");
lensflareIntensity = serObj.FindProperty("lensflareIntensity");
lensflareThreshold = serObj.FindProperty("lensflareThreshold");
lensFlareSaturation = serObj.FindProperty("lensFlareSaturation");
flareRotation = serObj.FindProperty("flareRotation");
flareColorA = serObj.FindProperty("flareColorA");
flareColorB = serObj.FindProperty("flareColorB");
flareColorC = serObj.FindProperty("flareColorC");
flareColorD = serObj.FindProperty("flareColorD");
lensFlareVignetteMask = serObj.FindProperty("lensFlareVignetteMask");
tweakMode = serObj.FindProperty("tweakMode");
}
public override void OnInspectorGUI () {
serObj.Update();
EditorGUILayout.LabelField("Glow and Lens Flares for bright screen pixels", EditorStyles.miniLabel);
EditorGUILayout.PropertyField (quality, new GUIContent("Quality", "High quality preserves high frequencies with bigger blurs and uses a better blending and down-/upsampling"));
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (tweakMode, new GUIContent("Mode"));
EditorGUILayout.PropertyField (screenBlendMode, new GUIContent("Blend"));
EditorGUILayout.PropertyField (hdr, new GUIContent("HDR"));
EditorGUILayout.Separator ();
// display info text when screen blend mode cannot be used
Camera cam = (target as Bloom).GetComponent<Camera>();
if (cam != null) {
#if UNITY_5_6_OR_NEWER
if (screenBlendMode.enumValueIndex==0 && ((cam.allowHDR && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
#else
if (screenBlendMode.enumValueIndex==0 && ((cam.hdr && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
#endif
EditorGUILayout.HelpBox("Screen blend is not supported in HDR. Using 'Add' instead.", MessageType.Info);
}
}
EditorGUILayout.PropertyField (bloomIntensity, new GUIContent("Intensity"));
bloomThreshold.floatValue = EditorGUILayout.Slider ("Threshold", bloomThreshold.floatValue, -0.05f, 4.0f);
if (1 == tweakMode.intValue) {
EditorGUILayout.PropertyField(bloomThresholdColor, new GUIContent(" RGB Threshold"));
}
EditorGUILayout.Separator ();
bloomBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur Iterations", bloomBlurIterations.intValue, 1, 4);
sepBlurSpread.floatValue = EditorGUILayout.Slider (" Sample Distance", sepBlurSpread.floatValue, 0.1f, 10.0f);
EditorGUILayout.Separator ();
if (1 == tweakMode.intValue) {
// further lens flare tweakings
if (0 != tweakMode.intValue)
EditorGUILayout.PropertyField (lensflareMode, new GUIContent("Lens Flares"));
else
lensflareMode.enumValueIndex = 0;
EditorGUILayout.PropertyField (lensflareIntensity, new GUIContent(" Local Intensity", "0 disables lens flares entirely (optimization)"));
lensflareThreshold.floatValue = EditorGUILayout.Slider ("Threshold", lensflareThreshold.floatValue, 0.0f, 4.0f);
if (Mathf.Abs(lensflareIntensity.floatValue) > Mathf.Epsilon) {
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"));
EditorGUILayout.PropertyField (flareRotation, new GUIContent( " Rotation"));
hollywoodFlareBlurIterations.intValue = EditorGUILayout.IntSlider (" Blur Iterations", hollywoodFlareBlurIterations.intValue, 1, 4);
EditorGUILayout.PropertyField (lensFlareSaturation, new GUIContent(" Saturation"));
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.PropertyField (lensFlareSaturation, new GUIContent(" Saturation"));
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 ();
}
EditorGUILayout.PropertyField(lensFlareVignetteMask, new GUIContent(" Mask", "This mask is needed to prevent lens flare artifacts"));
}
}
serObj.ApplyModifiedProperties();
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 43fcc28c40e404d4eabfc88b1dbda7b5
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,105 @@
using System;
using UnityEditor;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(SunShafts))]
class SunShaftsEditor : Editor
{
SerializedObject serObj;
SerializedProperty sunTransform;
SerializedProperty radialBlurIterations;
SerializedProperty sunColor;
SerializedProperty sunThreshold;
SerializedProperty sunShaftBlurRadius;
SerializedProperty sunShaftIntensity;
SerializedProperty useDepthTexture;
SerializedProperty resolution;
SerializedProperty screenBlendMode;
SerializedProperty maxRadius;
void OnEnable () {
serObj = new SerializedObject (target);
screenBlendMode = serObj.FindProperty("screenBlendMode");
sunTransform = serObj.FindProperty("sunTransform");
sunColor = serObj.FindProperty("sunColor");
sunThreshold = serObj.FindProperty("sunThreshold");
sunShaftBlurRadius = serObj.FindProperty("sunShaftBlurRadius");
radialBlurIterations = serObj.FindProperty("radialBlurIterations");
sunShaftIntensity = serObj.FindProperty("sunShaftIntensity");
resolution = serObj.FindProperty("resolution");
maxRadius = serObj.FindProperty("maxRadius");
useDepthTexture = serObj.FindProperty("useDepthTexture");
}
public override void OnInspectorGUI () {
serObj.Update ();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField (useDepthTexture, new GUIContent ("Rely on Z Buffer?"));
if ((target as SunShafts).GetComponent<Camera>())
GUILayout.Label("Current camera mode: "+ (target as SunShafts).GetComponent<Camera>().depthTextureMode, EditorStyles.miniBoldLabel);
EditorGUILayout.EndHorizontal();
// depth buffer need
/*
bool newVal = 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).GetComponent<Camera>()) {
if (GUILayout.Button("Center on " + (target as SunShafts).GetComponent<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).GetComponent<Camera>().name+". Are you sure? ", "Please do", "Don't")) {
Ray ray = (target as SunShafts).GetComponent<Camera>().ViewportPointToRay(new Vector3(0.5f,0.5f,0));
(target as SunShafts).sunTransform.position = ray.origin + ray.direction * 500.0f;
(target as SunShafts).sunTransform.LookAt ((target as SunShafts).transform);
}
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (sunThreshold, new GUIContent ("Threshold color"));
EditorGUILayout.PropertyField (sunColor, new GUIContent ("Shafts color"));
maxRadius.floatValue = 1.0f - EditorGUILayout.Slider ("Distance falloff", 1.0f - maxRadius.floatValue, 0.1f, 1.0f);
EditorGUILayout.Separator ();
sunShaftBlurRadius.floatValue = EditorGUILayout.Slider ("Blur size", sunShaftBlurRadius.floatValue, 1.0f, 10.0f);
radialBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", radialBlurIterations.intValue, 1, 3);
EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (sunShaftIntensity, new GUIContent("Intensity"));
serObj.ApplyModifiedProperties();
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 54f6f6313f2aecc4d81035ec0031e313
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName: