This commit is contained in:
2025-07-18 01:09:30 +02:00
parent 12e3b85770
commit 3c13cc3034
162 changed files with 12533 additions and 1629 deletions

View File

@@ -1,2 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Crebootkit/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 70fd40674751a8042a8b9b2e8d9f915f
guid: 5db7164e964ae4c6b82d2283320ad13d
folderAsset: yes
timeCreated: 1522559128
timeCreated: 1557315954
licenseType: Store
DefaultImporter:
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d282b23f7738ee44d87c880b3a0a7bac
guid: d6b6ed63a44dd4e0b9e9de96d34d9930
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://kronnect.com/guides/highlight-plus-introduction/

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4a6eaddfb3bfecf479d8d3a3f1f30d57
guid: 05f4a9095f69c4ec6bc8fb97dcdbacfb
DefaultImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://www.dropbox.com/s/4nx9pv977wvvrv8/Documentation.pdf?dl=0

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0bf5a4388559b034fa0348f5330303ef
guid: 6e3af944b32d74aaa9bd0bb1850bed61
DefaultImporter:
externalObjects: {}
userData:

Binary file not shown.

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c6fdf170c41094947ab93e9608045ab8
guid: 782ce379ea1624a349b1c53de1f90c95
DefaultImporter:
externalObjects: {}
userData:

View File

@@ -1,10 +1,9 @@
fileFormatVersion: 2
guid: 80ac8e52d3c31a94babd161e86bc6b97
guid: c1cfaabf0583f44b4871807a898aaf31
folderAsset: yes
timeCreated: 1522559139
timeCreated: 1542886534
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,881 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightEffect))]
[CanEditMultipleObjects]
public class HighlightEffectEditor : UnityEditor.Editor {
#pragma warning disable 0618
SerializedProperty profile, profileSync, camerasLayerMask, ignoreObjectVisibility, reflectionProbes, GPUInstancing, optimizeSkinnedMesh, sortingPriority;
SerializedProperty ignore, effectGroup, effectGroupLayer, effectNameFilter, effectNameUseRegEx, combineMeshes, alphaCutOff, cullBackFaces, padding, normalsOption;
SerializedProperty highlighted, fadeInDuration, fadeOutDuration, flipY, constantWidth, subMeshMask, minimumWidth, extraCoveragePixels;
SerializedProperty overlay, overlayMode, overlayColor, overlayAnimationSpeed, overlayMinIntensity, overlayBlending, overlayTexture, overlayTextureUVSpace, overlayTextureScale, overlayTextureScrolling, overlayVisibility;
SerializedProperty outline, outlineColor, outlineColorStyle, outlineGradient, outlineGradientInLocalSpace, outlineBlurPasses, outlineWidth, outlineQuality, outlineEdgeMode, outlineEdgeThreshold, outlineSharpness;
SerializedProperty outlineDownsampling, outlineVisibility, outlineBlitDebug, outlineIndependent, outlineContourStyle, outlineMaskMode;
SerializedProperty glow, glowWidth, glowQuality, glowBlurMethod, glowDownsampling, glowHQColor, glowDithering, glowDitheringStyle, glowMagicNumber1, glowMagicNumber2, glowAnimationSpeed;
SerializedProperty glowBlendPasses, glowPasses, glowVisibility, glowBlendMode, glowBlitDebug, glowMaskMode;
SerializedProperty innerGlow, innerGlowWidth, innerGlowColor, innerGlowBlendMode, innerGlowVisibility;
SerializedProperty iconFX, iconFXCenter, iconFXMesh, iconFXLightColor, iconFXDarkColor, iconFXRotationSpeed, iconFXAnimationOption, iconFXAnimationAmount, iconFXAnimationSpeed, iconFXScale, iconFXScaleToRenderBounds, iconFXOffset, iconFXTransitionDuration, iconFXStayDuration;
SerializedProperty seeThrough, seeThroughOccluderMask, seeThroughOccluderMaskAccurate, seeThroughOccluderThreshold, seeThroughOccluderCheckInterval, seeThroughOccluderCheckIndividualObjects, seeThroughDepthOffset, seeThroughMaxDepth;
SerializedProperty seeThroughIntensity, seeThroughTintAlpha, seeThroughTintColor, seeThroughNoise, seeThroughBorder, seeThroughBorderWidth, seeThroughBorderColor, seeThroughOrdered, seeThroughBorderOnly, seeThroughTexture, seeThroughTextureUVSpace, seeThroughTextureScale, seeThroughChildrenSortingMode;
SerializedProperty targetFX, targetFXTexture, targetFXColor, targetFXCenter, targetFXRotationSpeed, targetFXInitialScale, targetFXEndScale, targetFXScaleToRenderBounds, targetFXUseEnclosingBounds, targetFXOffset;
SerializedProperty targetFXAlignToGround, targetFXFadePower, targetFXGroundMaxDistance, targetFXGroundLayerMask, targetFXTransitionDuration, targetFXStayDuration, targetFXVisibility;
SerializedProperty hitFxInitialIntensity, hitFxMode, hitFxFadeOutDuration, hitFxColor, hitFxRadius;
SerializedProperty cameraDistanceFade, cameraDistanceFadeNear, cameraDistanceFadeFar;
HighlightEffect thisEffect;
bool profileChanged, forceRefresh, enableProfileApply;
UniversalRenderPipelineAsset pipe;
bool expandGeneralSettings, expandHighlightOptions;
bool showCurrentOccluders;
const string HP_GENERAL_SETTINGS = "HPGeneralSettings";
const string HP_HIGHLIGHT_OPTIONS = "HPHighlightOptions";
GUIStyle foldoutBold;
readonly List<Transform> occluders = new List<Transform>();
void OnEnable () {
expandGeneralSettings = EditorPrefs.GetBool("HPGeneralSettings", true);
expandHighlightOptions = EditorPrefs.GetBool("HPHighlightOptions", true);
profile = serializedObject.FindProperty("profile");
profileSync = serializedObject.FindProperty("profileSync");
camerasLayerMask = serializedObject.FindProperty("camerasLayerMask");
ignoreObjectVisibility = serializedObject.FindProperty("ignoreObjectVisibility");
reflectionProbes = serializedObject.FindProperty("reflectionProbes");
optimizeSkinnedMesh = serializedObject.FindProperty("optimizeSkinnedMesh");
sortingPriority = serializedObject.FindProperty("sortingPriority");
normalsOption = serializedObject.FindProperty("normalsOption");
GPUInstancing = serializedObject.FindProperty("GPUInstancing");
ignore = serializedObject.FindProperty("ignore");
effectGroup = serializedObject.FindProperty("effectGroup");
effectGroupLayer = serializedObject.FindProperty("effectGroupLayer");
effectNameFilter = serializedObject.FindProperty("effectNameFilter");
effectNameUseRegEx = serializedObject.FindProperty("effectNameUseRegEx");
combineMeshes = serializedObject.FindProperty("combineMeshes");
alphaCutOff = serializedObject.FindProperty("alphaCutOff");
cullBackFaces = serializedObject.FindProperty("cullBackFaces");
padding = serializedObject.FindProperty("padding");
highlighted = serializedObject.FindProperty("_highlighted");
fadeInDuration = serializedObject.FindProperty("fadeInDuration");
fadeOutDuration = serializedObject.FindProperty("fadeOutDuration");
flipY = serializedObject.FindProperty("flipY");
constantWidth = serializedObject.FindProperty("constantWidth");
extraCoveragePixels = serializedObject.FindProperty("extraCoveragePixels");
minimumWidth = serializedObject.FindProperty("minimumWidth");
subMeshMask = serializedObject.FindProperty("subMeshMask");
overlay = serializedObject.FindProperty("overlay");
overlayMode = serializedObject.FindProperty("overlayMode");
overlayColor = serializedObject.FindProperty("overlayColor");
overlayAnimationSpeed = serializedObject.FindProperty("overlayAnimationSpeed");
overlayMinIntensity = serializedObject.FindProperty("overlayMinIntensity");
overlayBlending = serializedObject.FindProperty("overlayBlending");
overlayTexture = serializedObject.FindProperty("overlayTexture");
overlayTextureUVSpace = serializedObject.FindProperty("overlayTextureUVSpace");
overlayTextureScale = serializedObject.FindProperty("overlayTextureScale");
overlayTextureScrolling = serializedObject.FindProperty("overlayTextureScrolling");
overlayVisibility = serializedObject.FindProperty("overlayVisibility");
outline = serializedObject.FindProperty("outline");
outlineColor = serializedObject.FindProperty("outlineColor");
outlineColorStyle = serializedObject.FindProperty("outlineColorStyle");
outlineGradient = serializedObject.FindProperty("outlineGradient");
outlineGradientInLocalSpace = serializedObject.FindProperty("outlineGradientInLocalSpace");
outlineWidth = serializedObject.FindProperty("outlineWidth");
outlineBlurPasses = serializedObject.FindProperty("outlineBlurPasses");
outlineQuality = serializedObject.FindProperty("outlineQuality");
outlineEdgeMode = serializedObject.FindProperty("outlineEdgeMode");
outlineEdgeThreshold = serializedObject.FindProperty("outlineEdgeThreshold");
outlineSharpness = serializedObject.FindProperty("outlineSharpness");
outlineDownsampling = serializedObject.FindProperty("outlineDownsampling");
outlineVisibility = serializedObject.FindProperty("outlineVisibility");
outlineBlitDebug = serializedObject.FindProperty("outlineBlitDebug");
outlineIndependent = serializedObject.FindProperty("outlineIndependent");
outlineContourStyle = serializedObject.FindProperty("outlineContourStyle");
outlineMaskMode = serializedObject.FindProperty("outlineMaskMode");
glow = serializedObject.FindProperty("glow");
glowWidth = serializedObject.FindProperty("glowWidth");
glowQuality = serializedObject.FindProperty("glowQuality");
glowBlurMethod = serializedObject.FindProperty("glowBlurMethod");
glowHQColor = serializedObject.FindProperty("glowHQColor");
glowAnimationSpeed = serializedObject.FindProperty("glowAnimationSpeed");
glowBlendPasses = serializedObject.FindProperty("glowBlendPasses");
glowDithering = serializedObject.FindProperty("glowDithering");
glowDitheringStyle = serializedObject.FindProperty("glowDitheringStyle");
glowMagicNumber1 = serializedObject.FindProperty("glowMagicNumber1");
glowMagicNumber2 = serializedObject.FindProperty("glowMagicNumber2");
glowAnimationSpeed = serializedObject.FindProperty("glowAnimationSpeed");
glowPasses = serializedObject.FindProperty("glowPasses");
glowVisibility = serializedObject.FindProperty("glowVisibility");
glowBlendMode = serializedObject.FindProperty("glowBlendMode");
glowBlitDebug = serializedObject.FindProperty("glowBlitDebug");
glowMaskMode = serializedObject.FindProperty("glowMaskMode");
glowDownsampling = serializedObject.FindProperty("glowDownsampling");
innerGlow = serializedObject.FindProperty("innerGlow");
innerGlowColor = serializedObject.FindProperty("innerGlowColor");
innerGlowWidth = serializedObject.FindProperty("innerGlowWidth");
innerGlowBlendMode = serializedObject.FindProperty("innerGlowBlendMode");
innerGlowVisibility = serializedObject.FindProperty("innerGlowVisibility");
seeThrough = serializedObject.FindProperty("seeThrough");
seeThroughOccluderMask = serializedObject.FindProperty("seeThroughOccluderMask");
seeThroughOccluderMaskAccurate = serializedObject.FindProperty("seeThroughOccluderMaskAccurate");
seeThroughOccluderThreshold = serializedObject.FindProperty("seeThroughOccluderThreshold");
seeThroughOccluderCheckInterval = serializedObject.FindProperty("seeThroughOccluderCheckInterval");
seeThroughOccluderCheckIndividualObjects = serializedObject.FindProperty("seeThroughOccluderCheckIndividualObjects");
seeThroughDepthOffset = serializedObject.FindProperty("seeThroughDepthOffset");
seeThroughMaxDepth = serializedObject.FindProperty("seeThroughMaxDepth");
seeThroughIntensity = serializedObject.FindProperty("seeThroughIntensity");
seeThroughTintAlpha = serializedObject.FindProperty("seeThroughTintAlpha");
seeThroughTintColor = serializedObject.FindProperty("seeThroughTintColor");
seeThroughNoise = serializedObject.FindProperty("seeThroughNoise");
seeThroughBorder = serializedObject.FindProperty("seeThroughBorder");
seeThroughBorderWidth = serializedObject.FindProperty("seeThroughBorderWidth");
seeThroughBorderColor = serializedObject.FindProperty("seeThroughBorderColor");
seeThroughOrdered = serializedObject.FindProperty("seeThroughOrdered");
seeThroughBorderOnly = serializedObject.FindProperty("seeThroughBorderOnly");
seeThroughTexture = serializedObject.FindProperty("seeThroughTexture");
seeThroughTextureScale = serializedObject.FindProperty("seeThroughTextureScale");
seeThroughTextureUVSpace = serializedObject.FindProperty("seeThroughTextureUVSpace");
seeThroughChildrenSortingMode = serializedObject.FindProperty("seeThroughChildrenSortingMode");
targetFX = serializedObject.FindProperty("targetFX");
targetFXTexture = serializedObject.FindProperty("targetFXTexture");
targetFXRotationSpeed = serializedObject.FindProperty("targetFXRotationSpeed");
targetFXInitialScale = serializedObject.FindProperty("targetFXInitialScale");
targetFXEndScale = serializedObject.FindProperty("targetFXEndScale");
targetFXScaleToRenderBounds = serializedObject.FindProperty("targetFXScaleToRenderBounds");
targetFXUseEnclosingBounds = serializedObject.FindProperty("targetFXUseEnclosingBounds");
targetFXOffset = serializedObject.FindProperty("targetFXOffset");
targetFXAlignToGround = serializedObject.FindProperty("targetFXAlignToGround");
targetFXFadePower = serializedObject.FindProperty("targetFXFadePower");
targetFXGroundMaxDistance = serializedObject.FindProperty("targetFXGroundMaxDistance");
targetFXGroundLayerMask = serializedObject.FindProperty("targetFXGroundLayerMask");
targetFXColor = serializedObject.FindProperty("targetFXColor");
targetFXCenter = serializedObject.FindProperty("targetFXCenter");
targetFXTransitionDuration = serializedObject.FindProperty("targetFXTransitionDuration");
targetFXStayDuration = serializedObject.FindProperty("targetFXStayDuration");
targetFXVisibility = serializedObject.FindProperty("targetFXVisibility");
iconFX = serializedObject.FindProperty("iconFX");
iconFXCenter = serializedObject.FindProperty("iconFXCenter");
iconFXMesh = serializedObject.FindProperty("iconFXMesh");
iconFXLightColor = serializedObject.FindProperty("iconFXLightColor");
iconFXDarkColor = serializedObject.FindProperty("iconFXDarkColor");
iconFXRotationSpeed = serializedObject.FindProperty("iconFXRotationSpeed");
iconFXAnimationOption = serializedObject.FindProperty("iconFXAnimationOption");
iconFXAnimationAmount = serializedObject.FindProperty("iconFXAnimationAmount");
iconFXAnimationSpeed = serializedObject.FindProperty("iconFXAnimationSpeed");
iconFXScale = serializedObject.FindProperty("iconFXScale");
iconFXScaleToRenderBounds = serializedObject.FindProperty("iconFXScaleToRenderBounds");
iconFXOffset = serializedObject.FindProperty("iconFXOffset");
iconFXTransitionDuration = serializedObject.FindProperty("iconFXTransitionDuration");
iconFXStayDuration = serializedObject.FindProperty("iconFXStayDuration");
hitFxInitialIntensity = serializedObject.FindProperty("hitFxInitialIntensity");
hitFxMode = serializedObject.FindProperty("hitFxMode");
hitFxFadeOutDuration = serializedObject.FindProperty("hitFxFadeOutDuration");
hitFxColor = serializedObject.FindProperty("hitFxColor");
hitFxRadius = serializedObject.FindProperty("hitFxRadius");
cameraDistanceFade = serializedObject.FindProperty("cameraDistanceFade");
cameraDistanceFadeNear = serializedObject.FindProperty("cameraDistanceFadeNear");
cameraDistanceFadeFar = serializedObject.FindProperty("cameraDistanceFadeFar");
thisEffect = (HighlightEffect)target;
thisEffect.Refresh();
}
private void OnDisable () {
EditorPrefs.SetBool(HP_GENERAL_SETTINGS, expandGeneralSettings);
EditorPrefs.SetBool(HP_HIGHLIGHT_OPTIONS, expandHighlightOptions);
}
public override void OnInspectorGUI () {
forceRefresh = false;
EditorGUILayout.Separator();
// URP setup helpers
pipe = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
if (pipe == null) {
EditorGUILayout.HelpBox("You must assign the Universal Rendering Pipeline asset in Project Settings / Graphics. Then, add the Highlight Plus Scriptable Render Feature to the list of Renderer Features of the Forward Renderer.", MessageType.Error);
if (GUILayout.Button("Watch Setup Video Tutorial")) {
Application.OpenURL("https://youtu.be/wXNS3gaBxHE");
}
return;
}
if (!HighlightPlusRenderPassFeature.installed) {
EditorGUILayout.HelpBox("Highlight Plus Render Feature must be added to the list of features of the Forward Renderer in the Universal Rendering Pipeline asset.", MessageType.Warning);
if (GUILayout.Button("Watch Setup Video Tutorial")) {
Application.OpenURL("https://youtu.be/wXNS3gaBxHE");
}
if (GUILayout.Button("Go to Universal Rendering Pipeline Asset")) {
Selection.activeObject = pipe;
}
EditorGUILayout.Separator();
}
bool isManager = IsDefaultEffectUsedByManager();
serializedObject.Update();
bool isMeshObject = !thisEffect.spriteMode;
if (foldoutBold == null) {
foldoutBold = new GUIStyle(EditorStyles.foldout);
foldoutBold.fontStyle = FontStyle.Bold;
}
EditorGUILayout.BeginHorizontal();
HighlightProfile prevProfile = (HighlightProfile)profile.objectReferenceValue;
EditorGUILayout.PropertyField(profile, new GUIContent("Profile", "Create or load stored presets."));
if (profile.objectReferenceValue != null) {
if (prevProfile != profile.objectReferenceValue) {
profileChanged = true;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
GUILayout.Label("", GUILayout.Width(EditorGUIUtility.labelWidth));
if (GUILayout.Button(new GUIContent("Create", "Creates a new profile which is a copy of the current settings."), GUILayout.Width(60))) {
CreateProfile();
profileChanged = false;
enableProfileApply = false;
GUIUtility.ExitGUI();
return;
}
if (GUILayout.Button(new GUIContent("Load", "Updates settings with the profile configuration."), GUILayout.Width(60))) {
profileChanged = true;
}
GUI.enabled = enableProfileApply;
if (GUILayout.Button(new GUIContent("Save", "Updates profile configuration with changes in this inspector."), GUILayout.Width(60))) {
enableProfileApply = false;
profileChanged = false;
thisEffect.profile.Save(thisEffect);
EditorUtility.SetDirty(thisEffect.profile);
GUIUtility.ExitGUI();
return;
}
GUI.enabled = true;
if (GUILayout.Button(new GUIContent("Locate", "Finds the profile in the project"), GUILayout.Width(60))) {
if (thisEffect.profile != null) {
Selection.activeObject = thisEffect.profile;
EditorGUIUtility.PingObject(thisEffect.profile);
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(profileSync, new GUIContent("Sync With Profile", "If disabled, profile settings will only be loaded when clicking 'Load' which allows you to customize settings after loading a profile and keep those changes."));
EditorGUILayout.BeginHorizontal();
}
else {
if (GUILayout.Button(new GUIContent("Create", "Creates a new profile which is a copy of the current settings."), GUILayout.Width(60))) {
CreateProfile();
GUIUtility.ExitGUI();
return;
}
}
EditorGUILayout.EndHorizontal();
if (isManager) {
EditorGUILayout.HelpBox("These are default settings for highlighted objects. If the highlighted object already has a Highlight Effect component, those properties will be used.", MessageType.Info);
}
expandGeneralSettings = EditorGUILayout.Foldout(expandGeneralSettings, "General Settings", true, foldoutBold);
if (expandGeneralSettings) {
DrawLayerMaskField(camerasLayerMask);
EditorGUILayout.PropertyField(ignoreObjectVisibility);
if (thisEffect.staticChildren) {
EditorGUILayout.HelpBox("This GameObject or one of its children is marked as static. If highlight is not visible, add a MeshCollider to them (the MeshCollider can be disabled).", MessageType.Warning);
}
EditorGUILayout.PropertyField(reflectionProbes);
if (isMeshObject) {
EditorGUILayout.PropertyField(normalsOption);
}
EditorGUILayout.PropertyField(optimizeSkinnedMesh);
if (isMeshObject || optimizeSkinnedMesh.boolValue) {
EditorGUILayout.PropertyField(GPUInstancing);
}
EditorGUILayout.PropertyField(sortingPriority);
EditorGUILayout.Separator();
}
if (!isManager) {
EditorGUILayout.LabelField("State", EditorStyles.boldLabel);
if (isManager) {
EditorGUILayout.LabelField(new GUIContent("Highlighted", "Highlight state (controlled by Highlight Manager)."), new GUIContent(thisEffect.highlighted.ToString()));
}
else {
EditorGUILayout.PropertyField(highlighted);
}
EditorGUILayout.LabelField(new GUIContent("Selected", "Selection state (used by Highlight Trigger or Manager) when using multi-selection option."), new GUIContent(thisEffect.isSelected.ToString()));
EditorGUILayout.Separator();
}
EditorGUILayout.BeginHorizontal();
expandHighlightOptions = EditorGUILayout.Foldout(expandHighlightOptions, "Highlight Options", true, foldoutBold);
if (!isMeshObject) {
GUILayout.Label(new GUIContent("SPRITE MODE", "Highlight Effect over sprites. Some effects are not available in sprite mode"), EditorStyles.centeredGreyMiniLabel);
}
if (GUILayout.Button("Help", GUILayout.Width(50))) {
EditorUtility.DisplayDialog("Quick Help", "Move the mouse over a setting for a short description.\n\nVisit kronnect.com's forum for support, questions and more cool assets.\n\nIf you like Highlight Plus please rate it or leave a review on the Asset Store! Thanks.", "Ok");
}
EditorGUILayout.EndHorizontal();
if (expandHighlightOptions) {
EditorGUI.BeginChangeCheck();
if (!isManager) {
EditorGUILayout.PropertyField(ignore, new GUIContent("Ignore", "This object won't be highlighted."));
}
if (!ignore.boolValue) {
EditorGUILayout.PropertyField(effectGroup, new GUIContent("Include", "Additional objects to highlight. Pro tip: when highlighting multiple objects at the same time include them in the same layer or under the same parent."));
if (effectGroup.intValue == (int)TargetOptions.LayerInScene || effectGroup.intValue == (int)TargetOptions.LayerInChildren) {
EditorGUI.indentLevel++;
DrawLayerMaskField(effectGroupLayer, "Layer");
EditorGUI.indentLevel--;
}
if (effectGroup.intValue != (int)TargetOptions.OnlyThisObject && effectGroup.intValue != (int)TargetOptions.Scripting) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(effectNameFilter, new GUIContent("Object Name Filter"));
if (effectNameUseRegEx.boolValue && !string.IsNullOrEmpty(thisEffect.lastRegExError)) {
EditorGUILayout.HelpBox(thisEffect.lastRegExError, MessageType.Error);
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(effectNameUseRegEx, new GUIContent("Use Regular Expressions", "If enabled, the Object Name Filter is a regular expression."));
if (effectNameUseRegEx.boolValue) {
if (GUILayout.Button("Help", GUILayout.Width(50))) {
if (EditorUtility.DisplayDialog("Regular Expressions", "Check the online Microsoft documentation for regular expressions syntax. You can also use ChatGPT to obtain regular expressions patterns. Some examples:\n^[^A].* will match any name not starting with an A\n.*[^\\d]$ matches any name not ending in a number.", "Online Reference", "Close")) {
Application.OpenURL("https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference");
}
}
}
EditorGUILayout.EndHorizontal();
if (isMeshObject) {
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(combineMeshes);
if (combineMeshes.boolValue) {
if (GUILayout.Button("Refresh", GUILayout.Width(70))) {
thisEffect.Refresh(true);
}
}
EditorGUILayout.EndHorizontal();
if (combineMeshes.boolValue) {
string warning = thisEffect.ValidateCombineMeshes();
if (!string.IsNullOrEmpty(warning)) {
EditorGUILayout.HelpBox(warning, MessageType.Warning);
}
}
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(alphaCutOff, new GUIContent("Alpha Cut Off", "Only for semi-transparent objects. Leave this to zero for normal opaque objects."));
if (isMeshObject) {
EditorGUILayout.PropertyField(cullBackFaces);
}
EditorGUILayout.PropertyField(padding);
EditorGUILayout.PropertyField(fadeInDuration);
EditorGUILayout.PropertyField(fadeOutDuration);
EditorGUILayout.PropertyField(cameraDistanceFade);
if (cameraDistanceFade.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(cameraDistanceFadeNear, new GUIContent("Near Distance"));
EditorGUILayout.PropertyField(cameraDistanceFadeFar, new GUIContent("Far Distance"));
EditorGUI.indentLevel--;
}
if ((outlineQuality.intValue == (int)QualityLevel.Highest && outline.floatValue > 0) || (glowQuality.intValue == (int)QualityLevel.Highest && glow.floatValue > 0)) {
GUI.enabled = true;
}
else {
GUI.enabled = false;
}
EditorGUILayout.PropertyField(flipY, new GUIContent("Flip Y Fix", "Flips outline/glow effect to fix bug introduced in Unity 2019.1.0 when VR is enabled."));
GUI.enabled = true;
if (glowQuality.intValue != (int)QualityLevel.Highest || outlineQuality.intValue != (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(constantWidth, new GUIContent("Constant Width", "Compensates outline/glow width with depth increase."));
if (!constantWidth.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(minimumWidth);
EditorGUI.indentLevel--;
}
}
if (isMeshObject) {
EditorGUILayout.PropertyField(subMeshMask);
EditorGUILayout.PropertyField(outlineIndependent, new GUIContent("Independent", "Do not combine outline or glow with other highlighted objects."));
}
}
}
if (!ignore.boolValue) {
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Effects", EditorStyles.boldLabel);
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(outline, "Outline", outline.floatValue > 0);
if (outline.floatValue > 0) {
EditorGUI.indentLevel++;
if (isMeshObject) {
EditorGUILayout.BeginHorizontal();
QualityPropertyField(outlineQuality);
if (outlineQuality.intValue == (int)QualityLevel.Highest) {
GUILayout.Label("(Screen-Space Effect)");
}
else {
GUILayout.Label("(Mesh-based Effect)");
}
EditorGUILayout.EndHorizontal();
}
CheckVRSupport(outlineQuality.intValue);
if (outlineQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(outlineEdgeMode, new GUIContent("Edges"));
if (outlineEdgeMode.intValue == (int)OutlineEdgeMode.Any) {
EditorGUILayout.PropertyField(outlineEdgeThreshold, new GUIContent("Edge Detection Threshold"));
}
EditorGUILayout.PropertyField(outlineContourStyle, new GUIContent("Contour Style"));
EditorGUILayout.PropertyField(outlineWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(outlineColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(outlineBlurPasses, new GUIContent("Blur Passes"));
EditorGUILayout.PropertyField(outlineSharpness, new GUIContent("Sharpness"));
}
else {
EditorGUILayout.PropertyField(outlineWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(outlineColorStyle, new GUIContent("Color Style"));
switch ((ColorStyle)outlineColorStyle.intValue) {
case ColorStyle.SingleColor:
EditorGUILayout.PropertyField(outlineColor, new GUIContent("Color"));
break;
case ColorStyle.Gradient:
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(outlineGradient, new GUIContent("Gradient"));
EditorGUILayout.PropertyField(outlineGradientInLocalSpace, new GUIContent("In Local Space"));
EditorGUI.indentLevel--;
break;
}
}
if (outlineQuality.intValue == (int)QualityLevel.Highest && outlineEdgeMode.intValue != (int)OutlineEdgeMode.Any) {
CheckDepthTextureSupport("Highest Quality");
EditorGUILayout.PropertyField(outlineDownsampling, new GUIContent("Downsampling"));
}
if (outlineQuality.intValue == (int)QualityLevel.Highest && (glow.floatValue > 0 && glowQuality.intValue == (int)QualityLevel.Highest)) {
outlineVisibility.intValue = glowVisibility.intValue;
}
EditorGUILayout.PropertyField(outlineVisibility, new GUIContent("Visibility"));
if (outlineQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(outlineBlitDebug, new GUIContent("Debug View", "Shows the blitting rectangle on the screen."));
if (!Application.isPlaying && outlineBlitDebug.boolValue && (!HighlightPlusRenderPassFeature.showingInEditMode || !highlighted.boolValue)) {
EditorGUILayout.HelpBox("Enable \"Preview In Editor\" in the Highlight Render Feature and \"Highlighted\" to display the outline Debug View.", MessageType.Warning);
}
EditorGUILayout.PropertyField(extraCoveragePixels);
}
EditorGUILayout.PropertyField(outlineMaskMode, new GUIContent("Mask Mode"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(glow, "Outer Glow", glow.floatValue > 0);
if (glow.floatValue > 0) {
EditorGUI.indentLevel++;
if (isMeshObject) {
EditorGUILayout.BeginHorizontal();
QualityPropertyField(glowQuality);
if (glowQuality.intValue == (int)QualityLevel.Highest) {
GUILayout.Label("(Screen-Space Effect)");
}
else {
GUILayout.Label("(Mesh-based Effect)");
}
EditorGUILayout.EndHorizontal();
}
CheckVRSupport(glowQuality.intValue);
if (glowQuality.intValue == (int)QualityLevel.Highest) {
CheckDepthTextureSupport("Highest Quality");
EditorGUILayout.PropertyField(outlineContourStyle, new GUIContent("Contour Style"));
EditorGUILayout.PropertyField(glowWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(glowHQColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(glowBlurMethod, new GUIContent("Blur Method", "Gaussian: better quality. Kawase: faster."));
EditorGUILayout.PropertyField(glowDownsampling, new GUIContent("Downsampling"));
}
else {
EditorGUILayout.PropertyField(glowWidth, new GUIContent("Width"));
}
EditorGUILayout.PropertyField(glowMaskMode, new GUIContent("Mask Mode"));
if (glowQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
EditorGUILayout.PropertyField(glowBlendMode, new GUIContent("Blend Mode"));
}
else {
EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
EditorGUILayout.PropertyField(glowDithering, new GUIContent("Dithering"));
if (glowDithering.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(glowDitheringStyle, new GUIContent("Style"));
if (glowDitheringStyle.intValue == (int)GlowDitheringStyle.Pattern) {
EditorGUILayout.PropertyField(glowMagicNumber1, new GUIContent("Magic Number 1"));
EditorGUILayout.PropertyField(glowMagicNumber2, new GUIContent("Magic Number 2"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(glowBlendPasses, new GUIContent("Blend Passes"));
if (!glowBlendPasses.boolValue) {
if (thisEffect.glowPasses != null) {
for (int k = 0; k < thisEffect.glowPasses.Length - 1; k++) {
if (thisEffect.glowPasses[k].offset > thisEffect.glowPasses[k + 1].offset) {
EditorGUILayout.HelpBox("Glow pass " + k + " has a greater offset than the next one. Reduce it to ensure the next glow pass is visible.", MessageType.Warning);
}
}
}
}
EditorGUILayout.PropertyField(glowPasses, true);
}
EditorGUILayout.PropertyField(glowAnimationSpeed, new GUIContent("Animation Speed"));
if (glowQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(glowBlitDebug, new GUIContent("Debug View", "Shows the blitting rectangle on the screen."));
if (!Application.isPlaying && glowBlitDebug.boolValue && (!HighlightPlusRenderPassFeature.showingInEditMode || !highlighted.boolValue)) {
EditorGUILayout.HelpBox("Enable \"Preview In Editor\" in the Highlight Render Feature and \"Highlighted\" to display the glow Debug View.", MessageType.Warning);
}
}
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
if (isMeshObject) {
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(innerGlow, "Inner Glow", innerGlow.floatValue > 0);
if (innerGlow.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(innerGlowColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(innerGlowWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(innerGlowBlendMode, new GUIContent("Blend Mode"));
EditorGUILayout.PropertyField(innerGlowVisibility, new GUIContent("Visibility"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(overlay, "Overlay", overlay.floatValue > 0);
if (overlay.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(overlayMode, new GUIContent("Mode"));
EditorGUILayout.PropertyField(overlayColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(overlayTexture, new GUIContent("Texture"));
if (overlayTexture.objectReferenceValue != null) {
EditorGUILayout.PropertyField(overlayTextureUVSpace, new GUIContent("UV Space"));
EditorGUILayout.PropertyField(overlayTextureScale, new GUIContent("Texture Scale"));
if ((TextureUVSpace)overlayTextureUVSpace.intValue != TextureUVSpace.Triplanar) {
EditorGUILayout.PropertyField(overlayTextureScrolling, new GUIContent("Texture Scrolling"));
}
}
EditorGUILayout.PropertyField(overlayBlending, new GUIContent("Blending"));
EditorGUILayout.PropertyField(overlayMinIntensity, new GUIContent("Min Intensity"));
EditorGUILayout.PropertyField(overlayAnimationSpeed, new GUIContent("Animation Speed"));
EditorGUILayout.PropertyField(overlayVisibility, new GUIContent("Visibility"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(targetFX, "Target", targetFX.boolValue);
if (targetFX.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(targetFXTexture, new GUIContent("Texture", "The texture that contains the shape to be drawn over the highlighted object."));
EditorGUILayout.PropertyField(targetFXColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(targetFXUseEnclosingBounds, new GUIContent("Use Enclosing Bounds"));
if (!targetFXUseEnclosingBounds.boolValue) {
EditorGUILayout.PropertyField(targetFXCenter, new GUIContent("Center", "Optionally assign a transform. Target will follow transform. If the object is skinned, you can also assign a bone to reflect currenct animation position."));
}
EditorGUILayout.PropertyField(targetFXOffset, new GUIContent("Offset"));
EditorGUILayout.PropertyField(targetFXRotationSpeed, new GUIContent("Rotation Speed"));
EditorGUILayout.PropertyField(targetFXInitialScale, new GUIContent("Initial Scale"));
EditorGUILayout.PropertyField(targetFXEndScale, new GUIContent("End Scale"));
EditorGUILayout.PropertyField(targetFXScaleToRenderBounds, new GUIContent("Scale To Object Bounds"));
EditorGUILayout.PropertyField(targetFXAlignToGround, new GUIContent("Align To Ground"));
if (targetFXAlignToGround.boolValue) {
CheckDepthTextureSupport("Align To Ground option");
EditorGUI.indentLevel++;
if (thisEffect.includedObjectsCount > 1 && targetFXCenter.objectReferenceValue == null && effectGroup.intValue != (int)TargetOptions.OnlyThisObject) {
EditorGUILayout.HelpBox("It's recommended to specify in the 'Center' property above, the specific object used to position the target fx image (will be rendered under that object on the ground).", MessageType.Info);
}
EditorGUILayout.PropertyField(targetFXGroundMaxDistance, new GUIContent("Ground Max Distance"));
DrawLayerMaskField(targetFXGroundLayerMask, "Ground Layer Mask");
if ((targetFXGroundLayerMask.intValue & (1 << thisEffect.gameObject.layer)) != 0) {
EditorGUILayout.HelpBox("Ground Layer Mask should not include this object layer.", MessageType.Warning);
}
else {
if (thisEffect.alignToGroundTried && !thisEffect.alignToGroundHitGood) {
EditorGUILayout.HelpBox("The Target Fx image is not being aligned because the ground was not found. Make sure it has a collider and verify the ground layer mask.", MessageType.Warning);
}
}
EditorGUILayout.PropertyField(targetFXFadePower, new GUIContent("Fade Power"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(targetFXTransitionDuration, new GUIContent("Transition Duration"));
EditorGUILayout.PropertyField(targetFXStayDuration, new GUIContent("Stay Duration"));
EditorGUILayout.PropertyField(targetFXVisibility, new GUIContent("Visibility"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(iconFX, "Icon", iconFX.boolValue);
if (iconFX.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(iconFXMesh, new GUIContent("Mesh"));
EditorGUILayout.PropertyField(iconFXLightColor, new GUIContent("Light Color"));
EditorGUILayout.PropertyField(iconFXDarkColor, new GUIContent("Dark Color"));
EditorGUILayout.PropertyField(iconFXCenter, new GUIContent("Center", "Optionally assign a transform. Icon will follow transform. If the object is skinned, you can also assign a bone to reflect currenct animation position."));
EditorGUILayout.PropertyField(iconFXOffset, new GUIContent("Offset"));
EditorGUILayout.PropertyField(iconFXRotationSpeed, new GUIContent("Rotation Speed"));
EditorGUILayout.PropertyField(iconFXAnimationOption, new GUIContent("Animation"));
if (iconFXAnimationOption.intValue != 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(iconFXAnimationAmount, new GUIContent("Amount"));
EditorGUILayout.PropertyField(iconFXAnimationSpeed, new GUIContent("Speed"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(iconFXScale, new GUIContent("Scale"));
EditorGUILayout.PropertyField(iconFXScaleToRenderBounds, new GUIContent("Scale To Object Bounds"));
EditorGUILayout.PropertyField(iconFXTransitionDuration, new GUIContent("Transition Duration"));
EditorGUILayout.PropertyField(iconFXStayDuration, new GUIContent("Stay Duration"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
if (isMeshObject) {
EditorGUILayout.BeginVertical(GUI.skin.box);
EditorGUILayout.PropertyField(seeThrough);
if (seeThrough.intValue != (int)SeeThroughMode.Never) {
if (isManager && seeThrough.intValue == (int)SeeThroughMode.AlwaysWhenOccluded) {
EditorGUILayout.HelpBox("This option is not valid in Manager.\nTo make an object always visible add a Highlight Effect component to the gameobject and enable this option on the component.", MessageType.Error);
}
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(seeThroughOccluderMask, new GUIContent("Occluder Layer"));
if (seeThroughOccluderMask.intValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(seeThroughOccluderMaskAccurate, new GUIContent("Accurate"));
EditorGUILayout.PropertyField(seeThroughOccluderThreshold, new GUIContent("Radius Threshold", "Multiplier to the object bounds. Making the bounds smaller prevents false occlusion tests."));
EditorGUILayout.PropertyField(seeThroughOccluderCheckInterval, new GUIContent("Check Interval", "Interval in seconds between occlusion tests."));
EditorGUILayout.PropertyField(seeThroughOccluderCheckIndividualObjects, new GUIContent("Check Individual Objects"));
if (!showCurrentOccluders && Camera.main != null) {
GUI.enabled = Application.isPlaying;
EditorGUILayout.BeginHorizontal();
GUILayout.Label("", GUILayout.Width(30));
if (GUILayout.Button(" Show Current Occluders (only during Play Mode) ")) {
showCurrentOccluders = true;
}
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
GUI.enabled = true;
}
if (showCurrentOccluders) {
thisEffect.GetOccluders(Camera.main, occluders);
int count = occluders != null ? occluders.Count : 0;
if (count == 0) {
EditorGUILayout.LabelField("No occluders found (using main camera)");
}
else {
EditorGUILayout.LabelField("Occluders found (using main camera):");
for (int k = 0; k < count; k++) {
if (occluders[k] == null) continue;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(occluders[k].name);
if (GUILayout.Button("Select")) {
Selection.activeGameObject = occluders[k].gameObject;
GUIUtility.ExitGUI();
}
EditorGUILayout.EndHorizontal();
}
}
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(seeThroughDepthOffset, new GUIContent("Depth Offset" + ((seeThroughDepthOffset.floatValue > 0) ? " •" : "")));
EditorGUILayout.PropertyField(seeThroughMaxDepth, new GUIContent("Max Depth" + ((seeThroughMaxDepth.floatValue > 0) ? " •" : "")));
if (seeThroughDepthOffset.floatValue > 0 || seeThroughMaxDepth.floatValue > 0) {
CheckDepthTextureSupport("See-Through Depth Options");
}
EditorGUILayout.PropertyField(seeThroughIntensity, new GUIContent("Intensity"));
EditorGUILayout.PropertyField(seeThroughTintColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(seeThroughTintAlpha, new GUIContent("Color Blend"));
EditorGUILayout.PropertyField(seeThroughNoise, new GUIContent("Noise"));
EditorGUILayout.PropertyField(seeThroughTexture, new GUIContent("Texture"));
if (seeThroughTexture.objectReferenceValue != null) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(seeThroughTextureUVSpace, new GUIContent("UV Space"));
EditorGUILayout.PropertyField(seeThroughTextureScale, new GUIContent("Texture Scale"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(seeThroughBorder, new GUIContent("Border When Hidden" + ((seeThroughBorder.floatValue > 0) ? " •" : "")));
if (seeThroughBorder.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(seeThroughBorderWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(seeThroughBorderColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(seeThroughBorderOnly, new GUIContent("Border Only"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(seeThroughChildrenSortingMode, new GUIContent("Children Sorting Mode"));
EditorGUILayout.PropertyField(seeThroughOrdered, new GUIContent("Ordered"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(hitFxInitialIntensity, "Hit FX", hitFxInitialIntensity.floatValue > 0);
if (hitFxInitialIntensity.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(hitFxMode, new GUIContent("Mode"));
EditorGUILayout.PropertyField(hitFxFadeOutDuration, new GUIContent("Fade Out Duration"));
EditorGUILayout.PropertyField(hitFxColor, new GUIContent("Color"));
if ((HitFxMode)hitFxMode.intValue == HitFxMode.LocalHit) {
EditorGUILayout.PropertyField(hitFxRadius, new GUIContent("Radius"));
}
if (!Application.isPlaying) {
EditorGUILayout.HelpBox("Enter Play Mode to test this feature. In your code, call effect.HitFX() method to execute this hit effect.", MessageType.Info);
}
else {
EditorGUI.indentLevel++;
if (GUILayout.Button("Execute Hit")) {
thisEffect.HitFX();
}
EditorGUI.indentLevel--;
}
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
if (serializedObject.ApplyModifiedProperties() || forceRefresh || profileChanged || "UndoRedoPerformed".Equals(Event.current.commandName)) {
if (thisEffect.profile != null) {
if (profileChanged) {
thisEffect.profile.Load(thisEffect);
EditorUtility.SetDirty(target);
profileChanged = false;
enableProfileApply = false;
}
else {
enableProfileApply = true;
}
}
foreach (HighlightEffect effect in targets) {
effect.Refresh();
effect.ResetHighlightStartTime();
}
}
}
void DrawLayerMaskField (SerializedProperty layerMaskProperty, string label = null) {
GUIContent propertyLabel = new GUIContent(layerMaskProperty.displayName, layerMaskProperty.tooltip);
if (!string.IsNullOrEmpty(label)) {
propertyLabel.text = label;
}
EditorGUI.BeginChangeCheck();
// Convierte el valor del LayerMask en un entero
int oldLayerMaskValue = layerMaskProperty.intValue;
// Obtén los nombres de las capas y transforma el valor del LayerMask
string[] layerNames = GetLayerNames();
int newLayerMaskValue = EditorGUILayout.MaskField(propertyLabel, UnityEditorInternal.InternalEditorUtility.LayerMaskToConcatenatedLayersMask(oldLayerMaskValue), layerNames);
if (EditorGUI.EndChangeCheck()) {
// Aplica el nuevo valor de LayerMask tras la conversión adecuada
layerMaskProperty.intValue = UnityEditorInternal.InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(newLayerMaskValue);
forceRefresh = true;
}
}
string[] GetLayerNames () {
List<string> layerNames = new List<string>();
for (int i = 0; i < 32; i++) {
string layerName = LayerMask.LayerToName(i);
if (!string.IsNullOrEmpty(layerName)) {
layerNames.Add(layerName);
}
}
return layerNames.ToArray();
}
void DrawSectionField (SerializedProperty property, string label, bool active) {
EditorGUILayout.PropertyField(property, new GUIContent(active ? label + " •" : label));
}
void CheckVRSupport (int qualityLevel) {
if (qualityLevel == (int)QualityLevel.Highest && PlayerSettings.virtualRealitySupported) {
if (PlayerSettings.stereoRenderingPath != StereoRenderingPath.MultiPass) {
EditorGUILayout.HelpBox("Highest Quality only supports VR Multi-Pass as CommandBuffers do not support this VR mode yet. Either switch to 'High Quality' or change VR Stereo mode to Multi-Pass.", MessageType.Error);
}
}
}
void CheckDepthTextureSupport (string feature) {
#if !UNITY_2021_2_OR_NEWER
if (pipe == null) return;
if (!pipe.supportsCameraDepthTexture && !thisEffect.spriteMode) {
EditorGUILayout.HelpBox(feature + " requires Depth Texture support and currently it's not enabled in the Rendering Pipeline asset.", MessageType.Error);
if (pipe != null && GUILayout.Button("Go to Universal Rendering Pipeline Asset")) {
Selection.activeObject = pipe;
}
EditorGUILayout.Separator();
}
#endif
}
static readonly int[] qualityValues = { 0, 3, 1, 2 };
static readonly GUIContent[] qualityTexts = { new GUIContent("Fastest"), new GUIContent("Medium"), new GUIContent("High"), new GUIContent("Highest") };
public static void QualityPropertyField (SerializedProperty prop) {
prop.intValue = EditorGUILayout.IntPopup(new GUIContent("Quality", "Default and High use a mesh displacement technique. Highest quality can provide best look and also performance depending on the complexity of mesh."), prop.intValue, qualityTexts, qualityValues);
}
bool IsDefaultEffectUsedByManager () {
MonoBehaviour[] components = thisEffect.GetComponents<MonoBehaviour>();
if (components != null) {
for (int k = 0; k < components.Length; k++) {
if (components[k] == null || !components[k].enabled)
continue;
string name = components[k].GetType().Name;
if ("HighlightManager".Equals(name)) return true;
}
}
return false;
}
#region Profile handling
void CreateProfile () {
HighlightProfile newProfile = CreateInstance<HighlightProfile>();
newProfile.Save(thisEffect);
AssetDatabase.CreateAsset(newProfile, "Assets/Highlight Plus Profile.asset");
AssetDatabase.SaveAssets();
EditorUtility.FocusProjectWindow();
Selection.activeObject = newProfile;
thisEffect.profile = newProfile;
}
#endregion
#pragma warning restore 0618
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: be287539f47634552a716f0705710448
timeCreated: 1542886545
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,71 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightManager))]
public class HighlightManagerEditor : UnityEditor.Editor {
SerializedProperty highlightOnHover, layerMask, raycastCamera, raycastSource, minDistance, maxDistance, respectUI;
SerializedProperty selectOnClick, selectedProfile, selectedAndHighlightedProfile, singleSelection, toggleOnClick, keepSelection;
void OnEnable() {
highlightOnHover = serializedObject.FindProperty("_highlightOnHover");
layerMask = serializedObject.FindProperty("layerMask");
raycastCamera = serializedObject.FindProperty("raycastCamera");
raycastSource = serializedObject.FindProperty("raycastSource");
minDistance = serializedObject.FindProperty("minDistance");
maxDistance = serializedObject.FindProperty("maxDistance");
respectUI = serializedObject.FindProperty("respectUI");
selectOnClick = serializedObject.FindProperty("selectOnClick");
selectedProfile = serializedObject.FindProperty("selectedProfile");
selectedAndHighlightedProfile = serializedObject.FindProperty("selectedAndHighlightedProfile");
singleSelection = serializedObject.FindProperty("singleSelection");
toggleOnClick = serializedObject.FindProperty("toggle");
keepSelection = serializedObject.FindProperty("keepSelection");
}
public override void OnInspectorGUI() {
EditorGUILayout.Separator();
EditorGUILayout.HelpBox("Only objects with a collider can be highlighted automatically.", MessageType.Info);
serializedObject.Update();
EditorGUILayout.PropertyField(layerMask);
EditorGUILayout.PropertyField(raycastCamera);
EditorGUILayout.PropertyField(raycastSource);
EditorGUILayout.PropertyField(minDistance);
EditorGUILayout.PropertyField(maxDistance);
EditorGUILayout.PropertyField(respectUI);
EditorGUILayout.PropertyField(highlightOnHover);
EditorGUILayout.PropertyField(selectOnClick);
if (selectOnClick.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(selectedProfile);
EditorGUILayout.PropertyField(selectedAndHighlightedProfile);
EditorGUILayout.PropertyField(singleSelection);
EditorGUILayout.PropertyField(toggleOnClick);
EditorGUILayout.PropertyField(keepSelection);
EditorGUI.indentLevel--;
}
serializedObject.ApplyModifiedProperties();
}
[MenuItem("GameObject/Effects/Highlight Plus/Create Highlight Manager", false, 10)]
static void CreateManager (MenuCommand menuCommand) {
HighlightManager manager = Misc.FindObjectOfType<HighlightManager> ();
if (manager == null) {
GameObject managerGO = new GameObject ("HighlightPlusManager");
manager = managerGO.AddComponent<HighlightManager> ();
// Register root object for undo.
Undo.RegisterCreatedObjectUndo (manager, "Create Highlight Plus Manager");
}
Selection.activeObject = manager;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ace58d1d278d649c98e5a2b5a066b3cd
timeCreated: 1548711355
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,448 @@
using UnityEditor;
using UnityEngine;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightProfile))]
[CanEditMultipleObjects]
public class HighlightProfileEditor : UnityEditor.Editor {
SerializedProperty effectGroup, effectGroupLayer, effectNameFilter, effectNameUseRegEx, combineMeshes, alphaCutOff, cullBackFaces, padding;
SerializedProperty overlay, overlayMode, overlayColor, overlayAnimationSpeed, overlayMinIntensity, overlayTexture, overlayTextureScale, overlayTextureScrolling, overlayTextureUVSpace, overlayBlending, overlayVisibility;
SerializedProperty fadeInDuration, fadeOutDuration, constantWidth, normalsOption, minimumWidth, extraCoveragePixels;
SerializedProperty outline, outlineColor, outlineColorStyle, outlineGradient, outlineGradientInLocalSpace, outlineWidth, outlineBlurPasses, outlineQuality, outlineEdgeMode, outlineEdgeThreshold, outlineSharpness;
SerializedProperty outlineDownsampling, outlineVisibility, outlineIndependent, outlineContourStyle, outlineMaskMode;
SerializedProperty glow, glowWidth, glowQuality, glowBlurMethod, glowDownsampling, glowHQColor, glowDithering, glowDitheringStyle, glowMagicNumber1, glowMagicNumber2, glowAnimationSpeed;
SerializedProperty glowBlendPasses, glowVisibility, glowBlendMode, glowPasses, glowMaskMode;
SerializedProperty innerGlow, innerGlowWidth, innerGlowColor, innerGlowBlendMode, innerGlowVisibility;
SerializedProperty targetFX, targetFXTexture, targetFXColor, targetFXRotationSpeed, targetFXInitialScale, targetFXEndScale, targetFXScaleToRenderBounds, targetFXUseEnclosingBounds, targetFXOffset;
SerializedProperty targetFXAlignToGround, targetFXFadePower, targetFXGroundMaxDistance, targetFXGroundLayerMask, targetFXTransitionDuration, targetFXStayDuration, targetFXVisibility;
SerializedProperty iconFX, iconFXMesh, iconFXLightColor, iconFXDarkColor, iconFXRotationSpeed, iconFXAnimationOption, iconFXAnimationAmount, iconFXAnimationSpeed, iconFXScale, iconFXScaleToRenderBounds, iconFXOffset, iconFXTransitionDuration, iconFXStayDuration;
SerializedProperty seeThrough, seeThroughOccluderMask, seeThroughOccluderMaskAccurate, seeThroughOccluderThreshold, seeThroughOccluderCheckInterval, seeThroughOccluderCheckIndividualObjects, seeThroughDepthOffset, seeThroughMaxDepth;
SerializedProperty seeThroughIntensity, seeThroughTintAlpha, seeThroughTintColor, seeThroughNoise, seeThroughBorder, seeThroughBorderWidth, seeThroughBorderColor, seeThroughOrdered, seeThroughBorderOnly, seeThroughTexture, seeThroughTextureUVSpace, seeThroughTextureScale, seeThroughChildrenSortingMode;
SerializedProperty hitFxInitialIntensity, hitFxMode, hitFxFadeOutDuration, hitFxColor, hitFxRadius;
SerializedProperty cameraDistanceFade, cameraDistanceFadeNear, cameraDistanceFadeFar;
void OnEnable () {
effectGroup = serializedObject.FindProperty("effectGroup");
effectGroupLayer = serializedObject.FindProperty("effectGroupLayer");
effectNameFilter = serializedObject.FindProperty("effectNameFilter");
effectNameUseRegEx = serializedObject.FindProperty("effectNameUseRegEx");
combineMeshes = serializedObject.FindProperty("combineMeshes");
alphaCutOff = serializedObject.FindProperty("alphaCutOff");
cullBackFaces = serializedObject.FindProperty("cullBackFaces");
padding = serializedObject.FindProperty("padding");
normalsOption = serializedObject.FindProperty("normalsOption");
fadeInDuration = serializedObject.FindProperty("fadeInDuration");
fadeOutDuration = serializedObject.FindProperty("fadeOutDuration");
constantWidth = serializedObject.FindProperty("constantWidth");
extraCoveragePixels = serializedObject.FindProperty("extraCoveragePixels");
minimumWidth = serializedObject.FindProperty("minimumWidth");
overlay = serializedObject.FindProperty("overlay");
overlayMode = serializedObject.FindProperty("overlayMode");
overlayColor = serializedObject.FindProperty("overlayColor");
overlayAnimationSpeed = serializedObject.FindProperty("overlayAnimationSpeed");
overlayMinIntensity = serializedObject.FindProperty("overlayMinIntensity");
overlayBlending = serializedObject.FindProperty("overlayBlending");
overlayVisibility = serializedObject.FindProperty("overlayVisibility");
overlayTexture = serializedObject.FindProperty("overlayTexture");
overlayTextureUVSpace = serializedObject.FindProperty("overlayTextureUVSpace");
overlayTextureScale = serializedObject.FindProperty("overlayTextureScale");
overlayTextureScrolling = serializedObject.FindProperty("overlayTextureScrolling");
outline = serializedObject.FindProperty("outline");
outlineColor = serializedObject.FindProperty("outlineColor");
outlineColorStyle = serializedObject.FindProperty("outlineColorStyle");
outlineGradient = serializedObject.FindProperty("outlineGradient");
outlineGradientInLocalSpace = serializedObject.FindProperty("outlineGradientInLocalSpace");
outlineWidth = serializedObject.FindProperty("outlineWidth");
outlineBlurPasses = serializedObject.FindProperty("outlineBlurPasses");
outlineQuality = serializedObject.FindProperty("outlineQuality");
outlineEdgeMode = serializedObject.FindProperty("outlineEdgeMode");
outlineEdgeThreshold = serializedObject.FindProperty("outlineEdgeThreshold");
outlineSharpness = serializedObject.FindProperty("outlineSharpness");
outlineDownsampling = serializedObject.FindProperty("outlineDownsampling");
outlineVisibility = serializedObject.FindProperty("outlineVisibility");
outlineIndependent = serializedObject.FindProperty("outlineIndependent");
outlineContourStyle = serializedObject.FindProperty("outlineContourStyle");
outlineMaskMode = serializedObject.FindProperty("outlineMaskMode");
glow = serializedObject.FindProperty("glow");
glowWidth = serializedObject.FindProperty("glowWidth");
glowQuality = serializedObject.FindProperty("glowQuality");
glowBlurMethod = serializedObject.FindProperty("glowBlurMethod");
glowDownsampling = serializedObject.FindProperty("glowDownsampling");
glowHQColor = serializedObject.FindProperty("glowHQColor");
glowAnimationSpeed = serializedObject.FindProperty("glowAnimationSpeed");
glowDithering = serializedObject.FindProperty("glowDithering");
glowDitheringStyle = serializedObject.FindProperty("glowDitheringStyle");
glowMagicNumber1 = serializedObject.FindProperty("glowMagicNumber1");
glowMagicNumber2 = serializedObject.FindProperty("glowMagicNumber2");
glowAnimationSpeed = serializedObject.FindProperty("glowAnimationSpeed");
glowBlendPasses = serializedObject.FindProperty("glowBlendPasses");
glowVisibility = serializedObject.FindProperty("glowVisibility");
glowBlendMode = serializedObject.FindProperty("glowBlendMode");
glowPasses = serializedObject.FindProperty("glowPasses");
glowMaskMode = serializedObject.FindProperty("glowMaskMode");
innerGlow = serializedObject.FindProperty("innerGlow");
innerGlowColor = serializedObject.FindProperty("innerGlowColor");
innerGlowWidth = serializedObject.FindProperty("innerGlowWidth");
innerGlowBlendMode = serializedObject.FindProperty("innerGlowBlendMode");
innerGlowVisibility = serializedObject.FindProperty("innerGlowVisibility");
targetFX = serializedObject.FindProperty("targetFX");
targetFXTexture = serializedObject.FindProperty("targetFXTexture");
targetFXRotationSpeed = serializedObject.FindProperty("targetFXRotationSpeed");
targetFXInitialScale = serializedObject.FindProperty("targetFXInitialScale");
targetFXEndScale = serializedObject.FindProperty("targetFXEndScale");
targetFXScaleToRenderBounds = serializedObject.FindProperty("targetFXScaleToRenderBounds");
targetFXUseEnclosingBounds = serializedObject.FindProperty("targetFXUseEnclosingBounds");
targetFXOffset = serializedObject.FindProperty("targetFXOffset");
targetFXAlignToGround = serializedObject.FindProperty("targetFXAlignToGround");
targetFXGroundMaxDistance = serializedObject.FindProperty("targetFXGroundMaxDistance");
targetFXGroundLayerMask = serializedObject.FindProperty("targetFXGroundLayerMask");
targetFXFadePower = serializedObject.FindProperty("targetFXFadePower");
targetFXColor = serializedObject.FindProperty("targetFXColor");
targetFXTransitionDuration = serializedObject.FindProperty("targetFXTransitionDuration");
targetFXStayDuration = serializedObject.FindProperty("targetFXStayDuration");
targetFXVisibility = serializedObject.FindProperty("targetFXVisibility");
iconFX = serializedObject.FindProperty("iconFX");
iconFXMesh = serializedObject.FindProperty("iconFXMesh");
iconFXLightColor = serializedObject.FindProperty("iconFXLightColor");
iconFXDarkColor = serializedObject.FindProperty("iconFXDarkColor");
iconFXRotationSpeed = serializedObject.FindProperty("iconFXRotationSpeed");
iconFXAnimationOption = serializedObject.FindProperty("iconFXAnimationOption");
iconFXAnimationAmount = serializedObject.FindProperty("iconFXAnimationAmount");
iconFXAnimationSpeed = serializedObject.FindProperty("iconFXAnimationSpeed");
iconFXScale = serializedObject.FindProperty("iconFXScale");
iconFXScaleToRenderBounds = serializedObject.FindProperty("iconFXScaleToRenderBounds");
iconFXOffset = serializedObject.FindProperty("iconFXOffset");
iconFXTransitionDuration = serializedObject.FindProperty("iconFXTransitionDuration");
iconFXStayDuration = serializedObject.FindProperty("iconFXStayDuration");
seeThrough = serializedObject.FindProperty("seeThrough");
seeThroughOccluderMask = serializedObject.FindProperty("seeThroughOccluderMask");
seeThroughOccluderMaskAccurate = serializedObject.FindProperty("seeThroughOccluderMaskAccurate");
seeThroughOccluderThreshold = serializedObject.FindProperty("seeThroughOccluderThreshold");
seeThroughOccluderCheckInterval = serializedObject.FindProperty("seeThroughOccluderCheckInterval");
seeThroughOccluderCheckIndividualObjects = serializedObject.FindProperty("seeThroughOccluderCheckIndividualObjects");
seeThroughDepthOffset = serializedObject.FindProperty("seeThroughDepthOffset");
seeThroughMaxDepth = serializedObject.FindProperty("seeThroughMaxDepth");
seeThroughIntensity = serializedObject.FindProperty("seeThroughIntensity");
seeThroughTintAlpha = serializedObject.FindProperty("seeThroughTintAlpha");
seeThroughTintColor = serializedObject.FindProperty("seeThroughTintColor");
seeThroughNoise = serializedObject.FindProperty("seeThroughNoise");
seeThroughBorder = serializedObject.FindProperty("seeThroughBorder");
seeThroughBorderWidth = serializedObject.FindProperty("seeThroughBorderWidth");
seeThroughBorderColor = serializedObject.FindProperty("seeThroughBorderColor");
seeThroughBorderOnly = serializedObject.FindProperty("seeThroughBorderOnly");
seeThroughOrdered = serializedObject.FindProperty("seeThroughOrdered");
seeThroughTexture = serializedObject.FindProperty("seeThroughTexture");
seeThroughTextureScale = serializedObject.FindProperty("seeThroughTextureScale");
seeThroughTextureUVSpace = serializedObject.FindProperty("seeThroughTextureUVSpace");
seeThroughChildrenSortingMode = serializedObject.FindProperty("seeThroughChildrenSortingMode");
hitFxInitialIntensity = serializedObject.FindProperty("hitFxInitialIntensity");
hitFxMode = serializedObject.FindProperty("hitFxMode");
hitFxFadeOutDuration = serializedObject.FindProperty("hitFxFadeOutDuration");
hitFxColor = serializedObject.FindProperty("hitFxColor");
hitFxRadius = serializedObject.FindProperty("hitFxRadius");
cameraDistanceFade = serializedObject.FindProperty("cameraDistanceFade");
cameraDistanceFadeNear = serializedObject.FindProperty("cameraDistanceFadeNear");
cameraDistanceFadeFar = serializedObject.FindProperty("cameraDistanceFadeFar");
}
public override void OnInspectorGUI () {
serializedObject.Update();
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Highlight Options", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(effectGroup, new GUIContent("Include"));
if (effectGroup.intValue == (int)TargetOptions.LayerInScene || effectGroup.intValue == (int)TargetOptions.LayerInChildren) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(effectGroupLayer, new GUIContent("Layer"));
EditorGUI.indentLevel--;
}
if (effectGroup.intValue != (int)TargetOptions.OnlyThisObject && effectGroup.intValue != (int)TargetOptions.Scripting) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(effectNameFilter, new GUIContent("Object Name Filter"));
EditorGUILayout.PropertyField(effectNameUseRegEx, new GUIContent("Use Regular Expressions"));
EditorGUILayout.PropertyField(combineMeshes);
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(alphaCutOff);
EditorGUILayout.PropertyField(cullBackFaces);
EditorGUILayout.PropertyField(padding);
EditorGUILayout.PropertyField(normalsOption);
EditorGUILayout.PropertyField(fadeInDuration);
EditorGUILayout.PropertyField(fadeOutDuration);
EditorGUILayout.PropertyField(cameraDistanceFade);
if (cameraDistanceFade.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(cameraDistanceFadeNear, new GUIContent("Near Distance"));
EditorGUILayout.PropertyField(cameraDistanceFadeFar, new GUIContent("Far Distance"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(constantWidth);
if (!constantWidth.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(minimumWidth);
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(outlineIndependent, new GUIContent("Independent", "Do not combine outline with other highlighted objects."));
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Effects", EditorStyles.boldLabel);
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(outline, "Outline", outline.floatValue > 0);
if (outline.floatValue > 0) {
EditorGUI.indentLevel++;
HighlightEffectEditor.QualityPropertyField(outlineQuality);
if (outlineQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(outlineEdgeMode, new GUIContent("Edges"));
if (outlineEdgeMode.intValue == (int)OutlineEdgeMode.Any) {
EditorGUILayout.PropertyField(outlineEdgeThreshold, new GUIContent("Edge Detection Threshold"));
}
EditorGUILayout.PropertyField(outlineContourStyle, new GUIContent("Contour Style"));
EditorGUILayout.PropertyField(outlineWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(outlineColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(outlineBlurPasses, new GUIContent("Blur Passes"));
EditorGUILayout.PropertyField(outlineSharpness, new GUIContent("Sharpness"));
}
else {
EditorGUILayout.PropertyField(outlineWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(outlineColorStyle, new GUIContent("Color Style"));
switch ((ColorStyle)outlineColorStyle.intValue) {
case ColorStyle.SingleColor:
EditorGUILayout.PropertyField(outlineColor, new GUIContent("Color"));
break;
case ColorStyle.Gradient:
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(outlineGradient, new GUIContent("Gradient"));
EditorGUILayout.PropertyField(outlineGradientInLocalSpace, new GUIContent("In Local Space"));
EditorGUI.indentLevel--;
break;
}
}
if (outlineQuality.intValue == (int)QualityLevel.Highest && outlineEdgeMode.intValue != (int)OutlineEdgeMode.Any) {
EditorGUILayout.PropertyField(outlineDownsampling, new GUIContent("Downsampling"));
}
if (outlineQuality.intValue == (int)QualityLevel.Highest && glowQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
}
else {
EditorGUILayout.PropertyField(outlineVisibility, new GUIContent("Visibility"));
}
EditorGUILayout.PropertyField(outlineMaskMode, new GUIContent("Mask Mode"));
if (outlineQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(extraCoveragePixels);
}
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(glow, "Outer Glow", glow.floatValue > 0);
if (glow.floatValue > 0) {
EditorGUI.indentLevel++;
HighlightEffectEditor.QualityPropertyField(glowQuality);
if (glowQuality.intValue == (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(outlineContourStyle, new GUIContent("Contour Style"));
EditorGUILayout.PropertyField(glowWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(glowHQColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(glowBlurMethod, new GUIContent("Blur Method", "Gaussian: better quality. Kawase: faster."));
EditorGUILayout.PropertyField(glowDownsampling, new GUIContent("Downsampling"));
}
else {
EditorGUILayout.PropertyField(glowWidth, new GUIContent("Width"));
}
EditorGUILayout.PropertyField(glowAnimationSpeed, new GUIContent("Animation Speed"));
EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
EditorGUILayout.PropertyField(glowMaskMode, new GUIContent("Mask Mode"));
EditorGUILayout.PropertyField(glowBlendMode, new GUIContent("Blend Mode"));
if (glowQuality.intValue != (int)QualityLevel.Highest) {
EditorGUILayout.PropertyField(glowDithering, new GUIContent("Dithering"));
if (glowDithering.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(glowDitheringStyle, new GUIContent("Style"));
if (glowDitheringStyle.intValue == (int)GlowDitheringStyle.Pattern) {
EditorGUILayout.PropertyField(glowMagicNumber1, new GUIContent("Magic Number 1"));
EditorGUILayout.PropertyField(glowMagicNumber2, new GUIContent("Magic Number 2"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(glowBlendPasses, new GUIContent("Blend Passes"));
EditorGUILayout.PropertyField(glowPasses, true);
} else {
EditorGUILayout.PropertyField(extraCoveragePixels);
}
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(innerGlow, "Inner Glow", innerGlow.floatValue > 0);
if (innerGlow.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(innerGlowColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(innerGlowWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(innerGlowBlendMode, new GUIContent("Blend Mode"));
EditorGUILayout.PropertyField(innerGlowVisibility, new GUIContent("Visibility"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(overlay, "Overlay", overlay.floatValue > 0);
if (overlay.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(overlayMode, new GUIContent("Mode"));
EditorGUILayout.PropertyField(overlayColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(overlayTexture, new GUIContent("Texture"));
if (overlayTexture.objectReferenceValue != null) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(overlayTextureUVSpace, new GUIContent("UV Space"));
EditorGUILayout.PropertyField(overlayTextureScale, new GUIContent("Texture Scale"));
if ((TextureUVSpace)overlayTextureUVSpace.intValue != TextureUVSpace.Triplanar) {
EditorGUILayout.PropertyField(overlayTextureScrolling, new GUIContent("Texture Scrolling"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(overlayBlending, new GUIContent("Blending"));
EditorGUILayout.PropertyField(overlayMinIntensity, new GUIContent("Min Intensity"));
EditorGUILayout.PropertyField(overlayAnimationSpeed, new GUIContent("Animation Speed"));
EditorGUILayout.PropertyField(overlayVisibility, new GUIContent("Visibility"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(targetFX, "Target", targetFX.boolValue);
if (targetFX.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(targetFXTexture, new GUIContent("Texture"));
EditorGUILayout.PropertyField(targetFXColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(targetFXUseEnclosingBounds, new GUIContent("Use Enclosing Bounds"));
EditorGUILayout.PropertyField(targetFXOffset, new GUIContent("Offset"));
EditorGUILayout.PropertyField(targetFXRotationSpeed, new GUIContent("Rotation Speed"));
EditorGUILayout.PropertyField(targetFXInitialScale, new GUIContent("Initial Scale"));
EditorGUILayout.PropertyField(targetFXEndScale, new GUIContent("End Scale"));
EditorGUILayout.PropertyField(targetFXScaleToRenderBounds, new GUIContent("Scale To Object Bounds"));
EditorGUILayout.PropertyField(targetFXAlignToGround, new GUIContent("Align To Ground"));
if (targetFXAlignToGround.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(targetFXGroundMaxDistance, new GUIContent("Ground Max Distance"));
EditorGUILayout.PropertyField(targetFXGroundLayerMask, new GUIContent("Ground Layer Mask"));
EditorGUILayout.PropertyField(targetFXFadePower, new GUIContent("Fade Power"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(targetFXTransitionDuration, new GUIContent("Transition Duration"));
EditorGUILayout.PropertyField(targetFXStayDuration, new GUIContent("Stay Duration"));
EditorGUILayout.PropertyField(targetFXVisibility, new GUIContent("Visibility"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(iconFX, "Icon", iconFX.boolValue);
if (iconFX.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(iconFXMesh, new GUIContent("Mesh"));
EditorGUILayout.PropertyField(iconFXLightColor, new GUIContent("Light Color"));
EditorGUILayout.PropertyField(iconFXDarkColor, new GUIContent("Dark Color"));
EditorGUILayout.PropertyField(iconFXOffset, new GUIContent("Offset"));
EditorGUILayout.PropertyField(iconFXRotationSpeed, new GUIContent("Rotation Speed"));
EditorGUILayout.PropertyField(iconFXAnimationOption, new GUIContent("Animation"));
if (iconFXAnimationOption.intValue != 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(iconFXAnimationAmount, new GUIContent("Amount"));
EditorGUILayout.PropertyField(iconFXAnimationSpeed, new GUIContent("Speed"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(iconFXScale, new GUIContent("Scale"));
EditorGUILayout.PropertyField(iconFXScaleToRenderBounds, new GUIContent("Scale To Object Bounds"));
EditorGUILayout.PropertyField(iconFXTransitionDuration, new GUIContent("Transition Duration"));
EditorGUILayout.PropertyField(iconFXStayDuration, new GUIContent("Stay Duration"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
EditorGUILayout.PropertyField(seeThrough);
if (seeThrough.intValue != (int)SeeThroughMode.Never) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(seeThroughOccluderMask, new GUIContent("Occluder Layer"));
if (seeThroughOccluderMask.intValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(seeThroughOccluderMaskAccurate, new GUIContent("Accurate"));
EditorGUILayout.PropertyField(seeThroughOccluderThreshold, new GUIContent("Radius Threshold", "Multiplier to the object bounds. Making the bounds smaller prevents false occlusion tests."));
EditorGUILayout.PropertyField(seeThroughOccluderCheckInterval, new GUIContent("Check Interval", "Interval in seconds between occlusion tests."));
EditorGUILayout.PropertyField(seeThroughOccluderCheckIndividualObjects, new GUIContent("Check Individual Objects", "Interval in seconds between occlusion tests."));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(seeThroughDepthOffset, new GUIContent("Depth Offset" + ((seeThroughDepthOffset.floatValue > 0) ? " •" : "")));
EditorGUILayout.PropertyField(seeThroughMaxDepth, new GUIContent("Max Depth" + ((seeThroughMaxDepth.floatValue > 0) ? " •" : "")));
EditorGUILayout.PropertyField(seeThroughIntensity, new GUIContent("Intensity"));
EditorGUILayout.PropertyField(seeThroughTintColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(seeThroughTintAlpha, new GUIContent("Color Blend"));
EditorGUILayout.PropertyField(seeThroughNoise, new GUIContent("Noise"));
EditorGUILayout.PropertyField(seeThroughTexture, new GUIContent("Texture"));
if (seeThroughTexture.objectReferenceValue != null) {
EditorGUILayout.PropertyField(seeThroughTextureUVSpace, new GUIContent("UV Space"));
EditorGUILayout.PropertyField(seeThroughTextureScale, new GUIContent("Texture Scale"));
}
EditorGUILayout.PropertyField(seeThroughBorder, new GUIContent("Border When Hidden"));
if (seeThroughBorder.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(seeThroughBorderWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(seeThroughBorderColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(seeThroughBorderOnly, new GUIContent("Border Only"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(seeThroughChildrenSortingMode, new GUIContent("Children Sorting Mode"));
EditorGUILayout.PropertyField(seeThroughOrdered, new GUIContent("Ordered"));
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(hitFxInitialIntensity, "Hit FX", hitFxInitialIntensity.floatValue > 0);
if (hitFxInitialIntensity.floatValue > 0) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(hitFxInitialIntensity, new GUIContent("Initial Intensity"));
EditorGUILayout.PropertyField(hitFxMode, new GUIContent("Mode"));
EditorGUILayout.PropertyField(hitFxFadeOutDuration, new GUIContent("Fade Out Duration"));
EditorGUILayout.PropertyField(hitFxColor, new GUIContent("Color"));
if ((HitFxMode)hitFxMode.intValue == HitFxMode.LocalHit) {
EditorGUILayout.PropertyField(hitFxRadius, new GUIContent("Radius"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
if (serializedObject.ApplyModifiedProperties() || (Event.current.type == EventType.ValidateCommand &&
Event.current.commandName == "UndoRedoPerformed")) {
// Triggers profile reload on all Highlight Effect scripts
HighlightEffect[] effects = Misc.FindObjectsOfType<HighlightEffect>();
for (int t = 0; t < targets.Length; t++) {
HighlightProfile profile = (HighlightProfile)targets[t];
for (int k = 0; k < effects.Length; k++) {
if (effects[k] != null && effects[k].profile == profile && effects[k].profileSync) {
profile.Load(effects[k]);
effects[k].Refresh();
}
}
}
EditorUtility.SetDirty(target);
}
}
void DrawSectionField (SerializedProperty property, string label, bool active) {
EditorGUILayout.PropertyField(property, new GUIContent(active ? label + " •" : label));
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b3b0e551d6f4f4f3987e8e5be2e89285
timeCreated: 1542886545
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
using UnityEditor;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightSeeThroughOccluder))]
public class HighlightSeeThroughOccluderEditor : UnityEditor.Editor {
SerializedProperty mode, detectionMethod;
void OnEnable() {
mode = serializedObject.FindProperty("mode");
detectionMethod = serializedObject.FindProperty("detectionMethod");
}
public override void OnInspectorGUI() {
serializedObject.Update();
EditorGUILayout.PropertyField(mode);
if (mode.intValue == (int)OccluderMode.BlocksSeeThrough) {
EditorGUILayout.HelpBox("This object will occlude any see-through effect.", MessageType.Info);
EditorGUILayout.PropertyField(detectionMethod);
} else {
EditorGUILayout.HelpBox("This object will trigger see-through effect. Use only on objects that do not write to depth buffer normally, like sprites or transparent objects.", MessageType.Info);
}
serializedObject.ApplyModifiedProperties();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 11e725ecbe4d74569b232e1a0d57efba
timeCreated: 1548711355
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
using UnityEditor;
using UnityEngine;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightTrigger))]
public class HighlightTriggerEditor : UnityEditor.Editor {
SerializedProperty highlightOnHover, triggerMode, raycastCamera, raycastSource, raycastLayerMask;
SerializedProperty minDistance, maxDistance, respectUI, volumeLayerMask;
SerializedProperty selectOnClick, selectedProfile, selectedAndHighlightedProfile, singleSelection, toggleOnClick, keepSelection;
HighlightTrigger trigger;
void OnEnable() {
highlightOnHover = serializedObject.FindProperty("highlightOnHover");
triggerMode = serializedObject.FindProperty("triggerMode");
raycastCamera = serializedObject.FindProperty("raycastCamera");
raycastSource = serializedObject.FindProperty("raycastSource");
raycastLayerMask = serializedObject.FindProperty("raycastLayerMask");
minDistance = serializedObject.FindProperty("minDistance");
maxDistance = serializedObject.FindProperty("maxDistance");
respectUI = serializedObject.FindProperty("respectUI");
volumeLayerMask = serializedObject.FindProperty("volumeLayerMask");
selectOnClick = serializedObject.FindProperty("selectOnClick");
selectedProfile = serializedObject.FindProperty("selectedProfile");
selectedAndHighlightedProfile = serializedObject.FindProperty("selectedAndHighlightedProfile");
singleSelection = serializedObject.FindProperty("singleSelection");
toggleOnClick = serializedObject.FindProperty("toggle");
keepSelection = serializedObject.FindProperty("keepSelection");
trigger = (HighlightTrigger)target;
trigger.Init();
}
public override void OnInspectorGUI() {
serializedObject.Update ();
if (trigger.triggerMode == TriggerMode.RaycastOnThisObjectAndChildren) {
if (!trigger.hasColliders && !trigger.hasColliders2D) {
EditorGUILayout.HelpBox ("No collider found on this object or any of its children. Add colliders to allow automatic highlighting.", MessageType.Warning);
}
} else {
#if ENABLE_INPUT_SYSTEM
if (trigger.triggerMode == TriggerMode.ColliderEventsOnlyOnThisObject) {
EditorGUILayout.HelpBox("This trigger mode is not compatible with the new input system.", MessageType.Error);
}
#endif
if (trigger.GetComponent<Collider>() == null && trigger.GetComponent<Collider2D>() == null) {
EditorGUILayout.HelpBox ("No collider found on this object. Add a collider to allow automatic highlighting.", MessageType.Error);
}
}
EditorGUILayout.PropertyField(triggerMode);
switch (trigger.triggerMode) {
case TriggerMode.RaycastOnThisObjectAndChildren:
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(raycastCamera);
EditorGUILayout.PropertyField(raycastSource);
EditorGUILayout.PropertyField(raycastLayerMask);
EditorGUILayout.PropertyField(minDistance);
EditorGUILayout.PropertyField(maxDistance);
EditorGUI.indentLevel--;
break;
case TriggerMode.Volume:
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(volumeLayerMask);
EditorGUI.indentLevel--;
break;
}
if (trigger.triggerMode != TriggerMode.Volume) {
EditorGUILayout.PropertyField(respectUI);
}
EditorGUILayout.PropertyField(highlightOnHover);
EditorGUILayout.PropertyField(selectOnClick);
if (selectOnClick.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(selectedProfile);
EditorGUILayout.PropertyField(selectedAndHighlightedProfile);
EditorGUILayout.PropertyField(singleSelection);
EditorGUILayout.PropertyField(toggleOnClick);
if (trigger.triggerMode == TriggerMode.RaycastOnThisObjectAndChildren) {
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(keepSelection);
if (EditorGUI.EndChangeCheck()) {
// Update all triggers
HighlightTrigger[] triggers = Misc.FindObjectsOfType<HighlightTrigger>();
foreach(HighlightTrigger t in triggers) {
if (t.keepSelection != keepSelection.boolValue) {
t.keepSelection = keepSelection.boolValue;
EditorUtility.SetDirty(t);
}
}
}
}
EditorGUI.indentLevel--;
}
if (serializedObject.ApplyModifiedProperties()) {
trigger.Init();
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: eaf7f56fbcfa343efb5081d4309cb76b
timeCreated: 1548711355
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
namespace HighlightPlus {
public class TransparentWithDepth {
static Material bmDepthOnly;
[MenuItem ("GameObject/Effects/Highlight Plus/Add Depth To Transparent Object", false, 100)]
static void AddDepthOption () {
Renderer renderer = GetRenderer ();
if (renderer == null)
return;
if (!EditorUtility.DisplayDialog ("Add Depth To Transparent Object", "This option will force the transparent object to write to the depth buffer by adding a new special material to the renderer (existing materials are preserved) so it can occlude and allow See-Through effect.\nOnly use on transparent objects.\n\nProceed?", "Yes", "No")) {
return;
}
Material[] materials = renderer.sharedMaterials;
for (int k = 0; k < materials.Length; k++) {
if (materials [k] == bmDepthOnly) {
EditorUtility.DisplayDialog ("Depth Support", "Already set! Nothing to do.", "Ok");
return;
}
}
if (materials == null) {
renderer.sharedMaterial = bmDepthOnly;
} else {
List<Material> newMaterials = new List<Material> (materials);
newMaterials.Insert (0, bmDepthOnly);
renderer.sharedMaterials = newMaterials.ToArray ();
}
}
[MenuItem ("GameObject/Effects/Highlight Plus/Remove Depth Compatibility", false, 101)]
static void RemoveDepthOption () {
Renderer renderer = GetRenderer ();
if (renderer == null)
return;
Material[] materials = renderer.sharedMaterials;
for (int k = 0; k < materials.Length; k++) {
if (materials [k] == bmDepthOnly) {
List<Material> newMaterials = new List<Material> (renderer.sharedMaterials);
newMaterials.RemoveAt (k);
renderer.sharedMaterials = newMaterials.ToArray ();
return;
}
}
for (int k = 0; k < materials.Length; k++) {
if (materials [k] == bmDepthOnly) {
EditorUtility.DisplayDialog ("Depth Support", "This object was not previously modified! Nothing to do.", "Ok");
return;
}
}
}
static Renderer GetRenderer () {
if (Selection.activeGameObject == null) {
EditorUtility.DisplayDialog ("Depth Support", "This option can only be used on GameObjects.", "Ok");
return null;
}
Renderer renderer = Selection.activeGameObject.GetComponent<Renderer> ();
if (renderer == null) {
EditorUtility.DisplayDialog ("Depth Support", "This option can only be used on GameObjects with a Renderer component attached.", "Ok");
return null;
}
if (bmDepthOnly == null) {
bmDepthOnly = Resources.Load<Material> ("HighlightPlus/HighlightPlusDepthWrite");
if (bmDepthOnly == null) {
EditorUtility.DisplayDialog ("Depth Support", "HighlightPlusDepthWrite material not found!", "Ok");
return null;
}
}
return renderer;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: be6e3be6d17ed49a3bd16d816815d6fd
timeCreated: 1515683694
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,454 @@
**************************************
* HIGHLIGHT PLUS *
* Created by Ramiro Oliva (Kronnect) *
* README FILE *
**************************************
Notice about Universal Rendering Pipeline
-----------------------------------------
This package is designed for URP.
It requires Unity 2021.3 or later
To install the plugin correctly:
1) Make sure you have Universal Rendering Pipeline asset installed (from Package Manager).
2) Go to Project Settings / Graphics.
3) Double click the Universal Rendering Pipeline asset.
4) Double click the Forward Renderer asset.
5) Click "+" to add the Highlight Plus Renderer Feature to the list of the Forward Renderer Features.
Note: URP assets can be assigned to Settings / Graphics and also Settings / Quality. Check both sections!
You can also find a HighlightPlusForwardRenderer asset in the Highlight Plus / Pipelines / URP folder.
Make sure the Highlight Plus Scriptable Renderer Feature is listed in the Renderer Features of the Forward Renderer in the pipeline asset.
Video instructions: https://youtu.be/d4onpE5RDNs
Quick help: how to use this asset?
----------------------------------
1) Highlighting specific objects: add HighlightEffect.cs script to any GameObject. Customize the appearance options.
In the Highlight Effect inspector, you can specify which objects, in addition to this one, are also affected by the effect:
a) Only this object
b) This object and its children
c) All objects from the root to the children
d) All objects belonging to a layer
2) Control highlight effect when mouse is over:
Add HighlightTrigger.cs script to the GameObject. It will activate highlight on the gameobject when mouse pass over it.
3) Highlighting any object in the scene:
Select top menu GameObject -> Effects -> Highlight Plus -> Create Manager.
Customize appearance and behaviour of Highlight Manager. Those settings are default settings for all objects. If you want different settings for certain objects just add another HighlightEffect script to each different object. The manager will use those settings.
4) Make transparent shaders compatible with See-Through effect:
If you want the See-Through effect be seen through other transparent objects, they need to be modified so they write to depth buffer (by default transparent objects do not write to z-buffer).
To do so, select top menu GameObject -> Effects -> Highlight Plus -> Add Depth To Transparent Object.
5) Static batching:
Objects marked as "static" need a MeshCollider in order to be highlighted. This is because Unity combines the meshes of static objects so it's not possible to highlight individual objects if their meshes are combined.
To allow highlighting static objects make sure they have a MeshCollider attached (the MeshCollider can be disabled).
Help & Support Forum
--------------------
Check the Documentation folder for detailed instructions:
Have any question or issue?
* Support-Web: https://kronnect.com/support
* Support-Discord: https://discord.gg/EH2GMaM
* Email: contact@kronnect.com
* Twitter: @Kronnect
If you like Highlight Plus, please rate it on the Asset Store. It encourages us to keep improving it! Thanks!
Future updates
--------------
All our assets follow an incremental development process by which a few beta releases are published on our support forum (kronnect.com).
We encourage you to signup and engage our forum. The forum is the primary support and feature discussions medium.
Of course, all updates of Highlight Plus will be eventually available on the Asset Store.
More Cool Assets!
-----------------
Check out our other assets here:
https://assetstore.unity.com/publishers/15018
Version history
---------------
Version 22.1
- Added "Target" option under Include
- Added "Extra Coverage Pixels" to avoid cuts when using cloth or vertex shaders that transform vertices positions
Version 22.0.8
- [Fix] Fixed see-through not rendering properly on flipped sprites
Version 22.0
- Added "Highlight Effect Blocker" component. You can use it to cancel background outline/glow/overlay when a sprite or transparent object is highlighted.
Version 21.1
- Performance optimizations when using independent option
- QoL improvements: additional warnings in inspector
Version 21.0
- New effect: icon
- Improved "Combine Meshes" option which now supports meshes with 32 bit index format
Version 20.1.2
- Changes to improve compatibility with custom assembly definitions (requires removal and reimport of the plugin)
Version 20.1.1
- [Fix] VR fixes
Version 20.1
- Added "Padding" option: creates an empty space between the mesh and the objects
- Added "Sorting Priority" option to Highlight Effect inspector. Useful to ensure certain effects render on top of others.
- Added "Minimum Width" option when constant width is disabled (affects outline/glow widths)
- OnObjectHighlightStart event no longer checks only once on a specific object
- API: added OnObjectHighlightStay to HighlightManager/HighlightTrigger event which can be used to cancel the highlight on the current object
Version 20.0.2
- See-through: improved Editor debug of occluders in non-accurate/collider based mode
Version 20.0.1
- [Fix] Fixed GPU instancing on skinned mesh renderers
Version 20.0
- Added support for Unity 2023.3 RenderGraph
- Option to use RegEx for the Include Object Name Filter
- To avoid requiring the New Input System package, the "Old" input system is now used if "Both" option is enabled in Project Settings
- [Fix] Fixes for fast domain reload
- [Fix] Fixed: calling SelectObject while fading out from a previous UnSelectObject would fail
Version 12.1
- Added dithering style option to outer glow effect
- Added "use enclosing bounds" option to Target FX effect
- See-through border is now combined with multiple children
Version 12.0
- Upgraded to Unity 2021.3.16
- Outline: added "Sharpness" property to control the bluriness of outline in Highest Quality mode
- API: added HighlightEffect.lastHighlighted and HighlightEffect.lastSelected static fields
- [Fix] API: fixes an issue with Unselect method of Highlight Plus manager
Version 11.3
- Overlay effect: added Texture Scrolling option for non-triplanar uv space mode.
- API: added "OnHighlightStateChange" event. This event triggers as soon as the highlight state changes, regardless of any fade in/out effect
Version 11.2
- Change: removed "Glow Ignore Mask" and replaced by "Mask Mode"
- Added "Mask Mode" to Outline section
- API: added HighlightEffect.useUnscaledTime option
- [Fix] Fixed fade out option issue with see-through effect
Version 11.1
- See-through: added "Children Sorting Mode" option
- [Fix] Fixed outline clipping issue in VR when near to camera
Version 11.0.2
- Added support for split screen cameras
Version 11.0
- Added "Show In Preview Camera" option to Highlight Plus render feature
- Preview in Editor option has moved to the Highlight Plus render feature
- Outline improvements in highest quality mode
- Added Glow Blur Method option: Gaussian (higher quality, default) or Kawase (faster)
- Option to optimize skinned mesh data when using outline/outer glow with mesh-based rendering. Reduces draw calls significantly.
Version 10.2.2
- [Fix] Occluder system now ignores particle renderers
- [Fix] Fixed rendering sorting issue when several highlighted objects share same position
Version 10.2
- Added "Contour Style" option: 1) around visible parts, or 2) around object shape
Version 10.1
- Two outline edge modes are now available when Outline Quality is set to High, allowing to render interior edges
- Added "Inner Glow Blend Mode" option
Version 10.0
- Added support for sprites. Compatible effects: outline, glow, overlay, target and hit fx.
- Added "Overlay Visibility" option
- Fixes
Version 9.6
- Added new "UV Space" options to Overlay effect (now: triplanar, object space or screen space)
- Added mask texture and "UV Space" options to See-Through effect
- Camera Distance Fade now also affects the see-through effect
Version 9.5
- Outline: added Color Style property and new Gradient option
- Internal buffer for highest quality outline/glow format changed to R8 format to reduce memory and improve performance on mobile
- API: Refresh(discardCachedMeshes): added discardCachedMeshes optional parameter to force refresh of cached meshes (useful for combined meshes that have changed)
Version 9.4
- Highlight See Through Occluder: added mode for triggering the see-through offect on sprites and transparent objects
- Performance optimizations when using a high number of Highlight Effect components in the scene
- [Fix] Fixed shader compatibility issue on PS4
Version 9.3
- Overlay: added "Mode" option (only when highlighted or always)
- Nested highlight effects are now included unless the 'Ignore' option is selected
- Cached meshes are now reconstructed when calling the Refresh() method
Version 9.2
- Improved shared mesh cache handling
- Improved see-through camera-layer based detection
Version 9.1.2
- [Fix] Fixed outline/glow distortion due to floating point math issues at distant positions from origin
- [Fix] Fixed VR issue in Unity 2022.1 with Single Pass Instanced
Version 9.1.1
- [Fix] Fixed potential issue with Unity 2021.2 related to depthCameraAttachment handling
Version 9.1
- Added support for Unity 2022
- Added Layer Mask option to Highlight Trigger
- Added "Keep Selection" option in Highlight Manager and Highlight Trigger
- [Fix] Fixed a potential issue that could exceed the maximum 64k vertices when combining meshes
Version 9.0
- Added "Camera Distance Fade" option
- Improved see-through accurate method which now takes into account multi-part meshes from compound parents
- [Fix] Fixed glow/outline aspect ratio in Single Pass Instanced VR mode
Version 8.5
- Improved outline effect when combining "Independent" option with many elements in "Children" selection
- Improved see-through border only effect
Version 8.4.1
- [Fix] Fixed unnecessary memory allocation in the render feature
Version 8.4
- Added "Border Only" option to See-Through effect
- Adding a Highlight Effect component to a parent no longer deactivates highlighted children
Version 8.3
- Upgraded to Unity 2020.3.16 as minimum
Version 8.2
- Added "Ignore Mask" option to glow. Can be used to render the glow effect alone
- [Fix] Fixed issue with new input system and highlight manager/trigger if no Event System is present in the scene
- [Fix] Fixed glow passes UI overlap in Unity 2021.3.3 due to reorderable array bug
Version 8.1
- Selection state is now visible in inspector (used only by trigger and manager components)
- [Fix] Fixed outer glow not showing in higher quality with visibility set to normal and orthographic camera
- [Fix] Fixed mobile input using the new input system
- [Fix] Fixed outline settings mismatch when using a combination of Highlight Trigger and Manager
Version 8.0
- Added SelectObject / ToggleObject / UnselectObject methods to Highlight Manager
- Added ability to apply custom sorting to effects (check documentation: Custom sorting section)
- Independent option is now moved to Highlight Options section and affects both outline and glow
- Added "Clear Stencil" option to Highlight Plus Render Feature (useful to solve compatibility with other assets that use stencil buffers)
Version 7.9.2
- [Fix] Fixed an issue in Unity 2021.2 when using MSAA and High Quality outline/glow
Version 7.9.1
- Default values for all effects are now 0 (disabled) except outline so desired effects must be enabled. This option allows you to ensure no extra/undesired effects are activated by mistake
- Redesigned Highlight Plus Profile editor interface
- Removed dependency of HighlightManager
Version 7.8
- Added outer glow blend mode option
- API: added OnObjectHighlightStart/End events to HighlightTrigger (check documentation for differences with similar events on Highlight Effect main script)
- [Fix] API: Fixed specific issues with SetTarget method when used on shader graph based materials that don't use standard texture names
Version 7.7.2
- [Fix] Fixed fade in/out issue when disabling/enabling objects
Version 7.7
- Added support for the new Input System
- [Fix] Fixes to the align to ground option of target fx effect
Version 7.6.2
- [Fix] VR: fixed target effect "Align to Ground" issue with Single Pass Instanced
Version 7.6.1
- [Fix] Fixed overlay animation speed issue
Version 7.6
- Added "Target FX Align to Ground" option
- Added isSeeThroughOccluded(camera). Is true when any see-through occluder using raycast mode is blocking the see-through effect
- All shader keywords are now of local type reducing global keyword usage
- Fixes and improvements to see-through when combined with outline/outer glow
Version 7.5.2
- [Fix] See-through is now visible when using glow/outline/inner glow with Always Visible option
Version 7.5.1
- [Fix] Fixed regression bug with Outline in High Quality mode
Version 7.5
- Added new HitFX style: "Local Hit"
- Added new demo scene showcasing the HitFx variations
- Added "Overlay Texture" option
- Added "Min Distance" option to Highlight Manager and Highlight Trigger
- Added support for "Domain Reload" disabled option
- API: added OnObjectHighlightStart, OnObjectHighlightEnd events to HighlightManager
- [Fix] Fixed inner glow and overlay issue when MaterialPropertyBlock is used on the character material
Version 7.1
- Added "Respect UI" to Highlight Manager and Trigger which blocks interaction if pointer is over an UI element
Version 7.0.2
- Memory optimizations
Version 7.0
- Added support for Single Pass Instanced
- Internal improvements and fixes
Version 6.9
- Added "Ordered" option to see-through
- Removed "Non Overlap" option from see-through as now it pervents overdraw by default
Version 6.8
- Improvements to see-through rendering order
- [Fix] Fixed properties not being reflected in scene immediately when invoking Undo
Version 6.7
- Added "SeeThrough Max Depth" option. Limits the visibility of the see-through effect to certain distance from the occluders
- Added "SeeThrough Check Individual Objects" option. If enabled, occlusion test is performed for each individual child of the object, instead of using combined bounds
Version 6.6
- Added "SeeThrough Depth Offset" option. This option allows you to control the minimum distance from the occluder to the object before showing the see-through effect
- Added "SeeThrough Non Overlap" option. Enable it only if the see-through effect produces flickering due to overlapping geometry in the hidden object
- [Fix] Fixed properties not being reflected in scene immediately when invoking Undo
Version 6.5.2
- Added inspector tooltips and improved documentation
Version 6.5.1
- Calling ProfileLoad() method will now assign that profile to the highlight effect component in addition to loading its values
- Prevents _Time overflow which can cause glitching on some Android devices
Version 6.5
- Name filter now is ignored when effect group is set to Only This Object
- New shader "HighlightPlus/Geometry/UIMask" to cancel highlight effects when rendering through a UI Canvas (see documentation)
Version 6.4
- Added "Cameras Layer Mask" to specify which cameras can render the effects
- Hit FX color in Highlight Profile now exposes HDR color options
Version 6.3.1
- Added "Single Selection" option to Highlight Manager/Trigger
- Added "Toggle" option to Highlight Manager/Trigger
- Selection is cleared now when clicking anywhere in the scene (requires Highlight Manager)
- API: added SetGlowColor
- Improved Highlight Manager inspector
Version 6.2
- Added TargetFX Scale To Object Bounds (defaults to false)
- Added support for HDR color to Hit FX color field
- Option to list occluders in the inspector when See Through Occluder Mask "Accurate" option is enabled
Version 6.1
- Added more accurate occluder layer system ("Accurate" option)
- Added default hit fx settings to inspector & profile
- Added hit fx modes (overlay or inner glow)
Version 6.0
- Added Selection feature
- Inspector: sections can be now collapsed to reduce screen space
- API: added OnObjectSelected / OnObjectUnSelected events
Version 5.5 4/Apr/2021
- [Fix] Fixed glow overlay when MSAA is disabled on Windows
Version 5.4 5/Feb/2021
- Added Visibility option to targete effect
- Stencil mask is no longer computed when only overlay or inner glow is used improving performance
Version 5.3.4 22/01/2021
- Optimizations to material setters
- [Fix] Fixed outline color issue with quality level set to medium
Version 5.3.3
- Effects now reflect object transform changes when combines meshes option is enabled
Version 5.3
- Added "Combine Meshes" option to profile
- Optimizations and fixes
Version 5.2
- Added "Object Name Filter" option to profile
Version 5.1
- Added "Border When Hidden" effect (outline when see-through triggers)
Version 5.0.1
- Added support for Unity 2020.2 beta
Version 5.0
- API: added "TargetFX" method to programmatically start the target effect
- Added support for double-sided shader effects
Version 4.9
- Added "Medium" quality level
Version 4.8.2
- [Fix] Fixed issue with outline set to fastest and glow using highest in latest URP version
Version 4.8.1
- [Fix] Fixed issue with outline/glow when overlay cameras are present on the stack
Version 4.8
- Added "Outer Glow Blend Passes" option
- [Fix] Fixed outline & glow issue with alpha cutout when using non-highest quality mode
Version 4.7
- Added "Normals Option" with Smooth, Preserve and Reorient variants to improve results
- Target effect now only renders once per gameobject if a specific target transform is specified
- API: added OnTargetAnimates. Allows you to override center, rotation and scale of target effect on a per-frame basis.
Version 4.6
- Added "SubMesh Mask" which allows to exclude certain submeshes
- [Fix] Fixed shader compilation issue with Single Pass Instanced mode enabled
Version 4.4
- Exposed "Smooth Normals" option in inspector.
Version 4.3.2
- Added HitFX effect
- Improvements to SeeThrough Occluder when Detection Mode is set to RayCast
Version 4.3.1
- [Fix] Fixed issue with Highlight Effect Occluder script
Version 4.3
- Added GPU instancing support for outline / outer glow effects
Version 4.2.2
- [Fix] Fixed effect being rendered when object is outside of frustum camera
Version 4.2.1
- Profile: added "Constant Width" property
- Enabled HDR color picker to Color properties
- [Fix] Fixed missing outline with flat surfaces like quads under certain angles
Version 4.2
- Glow/Outline downsampling option added to profiles
- [Fix] Removed VR API usage console warning
Version 4.1
- Added Outline Independent option
- [Fix] Fixed error when highlight script is added to an empty gameobject
Version 4.0
- Support for URP Scriptable Rendering Feature

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 53265a9967ed548efaf71f5807638781
timeCreated: 1542901568
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f8ab49cee701ae143a6a36217e6d8399
guid: a233cc5176ac642f89469b5d4c676c89
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -1,10 +1,9 @@
fileFormatVersion: 2
guid: 6a63caa2b0e993043a42c11f35ff2d1a
guid: 3a476022645d74299b862c36d0daa1df
folderAsset: yes
timeCreated: 1522559134
timeCreated: 1542876301
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,10 +1,9 @@
fileFormatVersion: 2
guid: 932f8193e5396db4babac4756c406dee
guid: 6bd97436761b94109a0785ed6823647c
folderAsset: yes
timeCreated: 1522559213
timeCreated: 1542893576
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
#ifndef CUSTOM_VERTEX_TRANSFORM_INCLUDED
#define CUSTOM_VERTEX_TRANSFORM_INCLUDED
float4 ComputeVertexPosition(float4 vertex) {
// Add here any custom vertex transform
float4 pos = UnityObjectToClipPos(vertex);
return pos;
}
#endif

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 26b31a85c4f4c4b11850968651dddfeb
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
Shader "HighlightPlus/Geometry/JustDepth"
{
Properties
{
}
SubShader
{
Tags { "RenderType"="Opaque" }
ColorMask 0
Name "Write Depth"
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return 0;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 058a572e30b2d446bade2dda32bcef0f
timeCreated: 1515682635
licenseType: Store
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2752029129534311206
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HighlightBlockerOutlineAndGlow
m_Shader: {fileID: 4800000, guid: 3e461a1484e2948598abca48b53d8b58, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ColorMask: 15
- _Cull: 2
- _CutOff: 0.5
- _Cutoff: 0.5
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 2
- _StencilComp: 2
- _StencilOp: 0
- _StencilReadMask: 2
- _StencilWriteMask: 2
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []

View File

@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: b33e4c4ffb741a6479905b91f82dd34e
guid: d753c051e36754eef85b1868da81e4c7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 112000000
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2752029129534311206
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HighlightBlockerOverlay
m_Shader: {fileID: 4800000, guid: 3e461a1484e2948598abca48b53d8b58, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ColorMask: 15
- _Cull: 2
- _CutOff: 0.5
- _Cutoff: 0.5
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 4
- _StencilComp: 2
- _StencilOp: 0
- _StencilReadMask: 4
- _StencilWriteMask: 4
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9f2b7b7a5532e473e9bbba32efa31c4e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,182 @@
Shader "HighlightPlus/Geometry/BlurGlow" {
Properties {
_Color ("Color", Color) = (1,1,0) // not used; dummy property to avoid inspector warning "material has no _Color property"
_BlurScale("Blur Scale", Float) = 2.0
_Speed("Speed", Float) = 1
}
SubShader
{
ZTest Always
ZWrite Off
Cull Off
CGINCLUDE
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _MainTex_TexelSize;
float4 _MainTex_ST;
float _BlurScale, _Speed;
float _ResampleScale;
struct appdata {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2fCross {
float4 pos : SV_POSITION;
float2 uv: TEXCOORD0;
float2 uv1: TEXCOORD1;
float2 uv2: TEXCOORD2;
float2 uv3: TEXCOORD3;
float2 uv4: TEXCOORD4;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2fCross vertCross(appdata v) {
v2fCross o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = v.vertex;
o.pos.y *= _ProjectionParams.x;
o.uv = v.texcoord;
float3 offsets = _MainTex_TexelSize.xyx * float3(1, 1, -1);
o.uv1 = v.texcoord - offsets.xy;
o.uv2 = v.texcoord - offsets.zy;
o.uv3 = v.texcoord + offsets.zy;
o.uv4 = v.texcoord + offsets.xy;
return o;
}
v2fCross vertCrossKawase(appdata v) {
v2fCross o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = v.vertex;
o.pos.y *= _ProjectionParams.x;
o.uv = v.texcoord + _MainTex_TexelSize.xy * 0.5;
float animatedWidth = _BlurScale * _ResampleScale * (0.75 + 0.25 * sin(_Time.w * _Speed));
float3 offsets = _MainTex_TexelSize.xyx * float3(1, 1, -1) * animatedWidth;
o.uv1 = v.texcoord - offsets.xy;
o.uv2 = v.texcoord - offsets.zy;
o.uv3 = v.texcoord + offsets.zy;
o.uv4 = v.texcoord + offsets.xy;
return o;
}
v2fCross vertBlurH(appdata v) {
v2fCross o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = v.vertex;
o.pos.y *= _ProjectionParams.x;
float animatedWidth = _BlurScale * (1.0 + 0.25 * sin(_Time.w * _Speed));
o.uv = v.texcoord;
float2 inc = float2(_MainTex_TexelSize.x * 1.3846153846 * animatedWidth, 0);
o.uv1 = v.texcoord - inc;
o.uv2 = v.texcoord + inc;
float2 inc2 = float2(_MainTex_TexelSize.x * 3.2307692308 * animatedWidth, 0);
o.uv3 = v.texcoord - inc2;
o.uv4 = v.texcoord + inc2;
return o;
}
v2fCross vertBlurV(appdata v) {
v2fCross o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = v.vertex;
o.pos.y *= _ProjectionParams.x;
float animatedWidth = _BlurScale * (1.0 + 0.25 * sin(_Time.w * _Speed));
o.uv = v.texcoord;
float2 inc = float2(0, _MainTex_TexelSize.y * 1.3846153846 * animatedWidth);
o.uv1 = v.texcoord - inc;
o.uv2 = v.texcoord + inc;
float2 inc2 = float2(0, _MainTex_TexelSize.y * 3.2307692308 * animatedWidth);
o.uv3 = v.texcoord - inc2;
o.uv4 = v.texcoord + inc2;
return o;
}
float4 fragBlur (v2fCross i): SV_Target {
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float4 pixel = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv) * 0.2270270270
+ (UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv1) + UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv2)) * 0.3162162162
+ (UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv3) + UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv4)) * 0.0702702703;
return pixel;
}
float4 fragResample(v2fCross i) : SV_Target {
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float4 c1 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv1);
float4 c2 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv2);
float4 c3 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv3);
float4 c4 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv4);
return (c1+c2+c3+c4) * 0.25;
}
ENDCG
Pass {
Name "Gaussian Blur Horizontal"
CGPROGRAM
#pragma vertex vertBlurH
#pragma fragment fragBlur
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
Pass {
Name "Gaussian Blur Vertical"
CGPROGRAM
#pragma vertex vertBlurV
#pragma fragment fragBlur
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
Pass {
Name "Copy Resample"
CGPROGRAM
#pragma vertex vertCross
#pragma fragment fragResample
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
Pass {
Name "Fast Blur"
CGPROGRAM
#pragma vertex vertCrossKawase
#pragma fragment fragResample
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 84c84ee93ec484bdda371ffbdebfcc7c
timeCreated: 1556874239
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,168 @@
Shader "HighlightPlus/Geometry/BlurOutline" {
Properties {
_Color ("Color", Color) = (1,1,0) // not used; dummy property to avoid inspector warning "material has no _Color property"
_BlurScale("Blur Scale", Float) = 2.0
_BlurScaleFirstHoriz("Blur Scale First Horiz", Float) = 4
}
SubShader
{
ZTest Always
ZWrite Off
Cull Off
CGINCLUDE
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _MainTex_TexelSize;
float4 _MainTex_ST;
float _BlurScale;
float _BlurScaleFirstHoriz;
struct appdata {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2fCross {
float4 pos : SV_POSITION;
float2 uv: TEXCOORD0;
float2 uv1: TEXCOORD1;
float2 uv2: TEXCOORD2;
float2 uv3: TEXCOORD3;
float2 uv4: TEXCOORD4;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2fCross vertCross(appdata v) {
v2fCross o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = v.vertex;
o.pos.y *= _ProjectionParams.x;
o.uv = v.texcoord;
float3 offsets = _MainTex_TexelSize.xyx * float3(1, 1, -1);
o.uv1 = v.texcoord - offsets.xy;
o.uv2 = v.texcoord - offsets.zy;
o.uv3 = v.texcoord + offsets.zy;
o.uv4 = v.texcoord + offsets.xy;
return o;
}
v2fCross vertBlur(appdata v, float multiplier) {
v2fCross o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = v.vertex;
o.pos.y *= _ProjectionParams.x;
o.uv = v.texcoord;
float2 inc = float2(_MainTex_TexelSize.x * 1.3846153846 * multiplier, 0);
o.uv1 = v.texcoord - inc;
o.uv2 = v.texcoord + inc;
float2 inc2 = float2(_MainTex_TexelSize.x * 3.2307692308 * multiplier, 0);
o.uv3 = v.texcoord - inc2;
o.uv4 = v.texcoord + inc2;
return o;
}
v2fCross vertBlurH(appdata v) {
return vertBlur(v, _BlurScale);
}
v2fCross vertBlurH2(appdata v) {
return vertBlur(v, _BlurScaleFirstHoriz);
}
v2fCross vertBlurV(appdata v) {
v2fCross o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = v.vertex;
o.pos.y *= _ProjectionParams.x;
o.uv = v.texcoord;
float2 inc = float2(0, _MainTex_TexelSize.y * 1.3846153846 * _BlurScale);
o.uv1 = v.texcoord - inc;
o.uv2 = v.texcoord + inc;
float2 inc2 = float2(0, _MainTex_TexelSize.y * 3.2307692308 * _BlurScale);
o.uv3 = v.texcoord - inc2;
o.uv4 = v.texcoord + inc2;
return o;
}
float4 fragBlur (v2fCross i): SV_Target {
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float4 pixel = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv) * 0.2270270270
+ (UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv1) + UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv2)) * 0.3162162162
+ (UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv3) + UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv4)) * 0.0702702703;
return pixel;
}
float4 fragResample(v2fCross i) : SV_Target {
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float4 c1 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv1);
float4 c2 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv2);
float4 c3 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv3);
float4 c4 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv4);
return (c1+c2+c3+c4) * 0.25;
}
ENDCG
Pass {
Name "Blur Horizontal"
CGPROGRAM
#pragma vertex vertBlurH
#pragma fragment fragBlur
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
Pass {
Name "Blur Vertical"
CGPROGRAM
#pragma vertex vertBlurV
#pragma fragment fragBlur
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
Pass {
Name "Resample"
CGPROGRAM
#pragma vertex vertCross
#pragma fragment fragResample
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
Pass {
Name "Blur Horizontalx2"
CGPROGRAM
#pragma vertex vertBlurH2
#pragma fragment fragBlur
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 74f3491dcf1224f0c91238381c035439
timeCreated: 1556874239
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,95 @@
Shader "HighlightPlus/ClearStencil"
{
Properties
{
}
SubShader
{
Stencil {
Ref 2
Comp Always
Pass zero
}
ZTest Always
ZWrite Off
Cull Off
ColorMask 0
Pass // clear stencil full screen
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = float4(v.vertex.xy, 0, 0.5);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return 0;
}
ENDCG
}
Pass // clear stencil object-space
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return 0;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 844773224daae4c31a9160897f833c5b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,168 @@
Shader "HighlightPlus/Geometry/ComposeGlow" {
Properties {
_MainTex ("Texture", Any) = "black" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
[HideInInspector] _Cull ("Cull Mode", Int) = 2
[HideInInspector] _ZTest ("ZTest Mode", Int) = 0
[HideInInspector] _Flip("Flip", Vector) = (0, 1, 0)
[HideInInspector] _BlendSrc("Blend Src", Int) = 1
[HideInInspector] _BlendDst("Blend Dst", Int) = 1
_Debug("Debug Color", Color) = (0,0,0,0)
[HideInInspector] _GlowStencilComp ("Stencil Comp", Int) = 6
}
SubShader
{
Tags { "Queue"="Transparent+102" "RenderType"="Transparent" "DisableBatching" = "True" }
Blend [_BlendSrc] [_BlendDst]
// Compose effect on camera target
Pass
{
ZWrite Off
ZTest Always // [_ZTest]
Cull Off //[_Cull]
Stencil {
Ref 2
Comp [_GlowStencilComp]
Pass keep
ReadMask 2
WriteMask 2
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_MASK_CUTOUT
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPComposeGlowFinal);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPSourceRT);
float4 _HPSourceRT_TexelSize;
fixed4 _Color;
float3 _Flip;
fixed4 _Debug;
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float4 scrPos: TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = UnityObjectToClipPos(v.vertex);
o.scrPos = ComputeScreenPos(o.pos);
o.scrPos.y = o.scrPos.w * _Flip.x + o.scrPos.y * _Flip.y;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float2 uv = i.scrPos.xy/i.scrPos.w;
fixed glow = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPComposeGlowFinal, uv).r;
#if HP_MASK_CUTOUT
fixed maskN = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(0, 1) * _HPSourceRT_TexelSize.xy).r;
fixed maskS = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(0, -1) * _HPSourceRT_TexelSize.xy).r;
fixed maskW = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(-1, 0) * _HPSourceRT_TexelSize.xy).r;
fixed maskE = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(1, 0) * _HPSourceRT_TexelSize.xy).r;
glow *= maskN == 0 || maskS == 0 || maskW == 0 || maskE == 0;
#endif
fixed4 color = _Color;
color *= glow;
color += _Debug;
color.a = saturate(color.a);
return color;
}
ENDCG
}
// Compose effect on camera target (full-screen blit)
Pass
{
ZWrite Off
ZTest Always //[_ZTest]
Cull Off //[_Cull]
Stencil {
Ref 2
Comp NotEqual
Pass keep
ReadMask 2
WriteMask 2
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _MainTex_ST;
fixed4 _Color;
float3 _Flip;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = UnityStereoScreenSpaceUVAdjust(v.uv, _MainTex_ST);
o.uv.y = _Flip.x + o.uv.y * _Flip.y;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
fixed4 glow = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv);
fixed4 color = _Color;
color *= glow.r;
color.a = saturate(color.a);
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 975a91ee935da4d9c8a3e807fecd8047
timeCreated: 1544699251
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,181 @@
Shader "HighlightPlus/Geometry/ComposeOutline" {
Properties {
_MainTex ("Texture", Any) = "black" {}
_Color("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_Cull("Cull Mode", Int) = 2
_ZTest("ZTest Mode", Int) = 0
_Flip("Flip", Vector) = (0, 1, 0)
_Debug("Debug Color", Color) = (0,0,0,0)
_OutlineStencilComp("Stencil Comp", Int) = 6
_OutlineSharpness("Outline Sharpness", Float) = 1.0
}
SubShader
{
Tags { "Queue" = "Transparent+120" "RenderType" = "Transparent" "DisableBatching" = "True" }
Blend SrcAlpha OneMinusSrcAlpha
// Compose effect on camera target (optimal quad blit)
Pass
{
ZWrite Off
ZTest Always // [_ZTest]
Cull Off // [_Cull]
Stencil {
Ref 2
Comp [_OutlineStencilComp]
Pass keep
ReadMask 2
WriteMask 2
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALL_EDGES
#pragma multi_compile_local _ HP_MASK_CUTOUT
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPComposeOutlineFinal);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPSourceRT);
float4 _HPSourceRT_TexelSize;
fixed4 _Color;
float3 _Flip;
fixed4 _Debug;
fixed _OutlineSharpness;
#if HP_ALL_EDGES
#define OUTLINE_SOURCE outline.g
#else
#define OUTLINE_SOURCE outline.r
#endif
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float4 scrPos: TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = UnityObjectToClipPos(v.vertex);
o.scrPos = ComputeScreenPos(o.pos);
o.scrPos.y = o.scrPos.w * _Flip.x + o.scrPos.y * _Flip.y;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float2 uv = i.scrPos.xy/i.scrPos.w;
fixed4 outline = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPComposeOutlineFinal, uv);
fixed4 color = _Color;
color.a *= OUTLINE_SOURCE;
#if HP_MASK_CUTOUT
fixed4 maskN = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(0, 1) * _HPSourceRT_TexelSize.xy);
fixed4 maskS = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(0, -1) * _HPSourceRT_TexelSize.xy);
fixed4 maskW = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(-1, 0) * _HPSourceRT_TexelSize.xy);
fixed4 maskE = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv + float2(1, 0) * _HPSourceRT_TexelSize.xy);
color.a *= all(maskN.rgb==0) || all(maskS.rgb == 0) || all(maskW.rgb == 0) || all(maskE.rgb == 0);
#endif
color += _Debug;
color.a = saturate(color.a);
color.a = pow(color.a, _OutlineSharpness);
return color;
}
ENDCG
}
// Compose effect on camera target (full-screen blit)
Pass
{
ZWrite Off
ZTest Always //[_ZTest]
Cull Off // [_Cull]
Stencil {
Ref 2
Comp [_OutlineStencilComp]
Pass keep
ReadMask 2
WriteMask 2
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALL_EDGES
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _MainTex_ST;
fixed4 _Color;
float3 _Flip;
fixed _OutlineSharpness;
#if HP_ALL_EDGES
#define OUTLINE_SOURCE outline.g
#else
#define OUTLINE_SOURCE outline.r
#endif
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = UnityStereoScreenSpaceUVAdjust(v.uv, _MainTex_ST);
o.uv.y = _Flip.x + o.uv.y * _Flip.y;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
fixed4 outline = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv);
fixed4 color = _Color;
color.a *= OUTLINE_SOURCE;
color = saturate(color);
color.a = pow(color.a, _OutlineSharpness);
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0a6de74b6cfa9440182f8f56e4a0e4f1
timeCreated: 1544699251
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HighlightGlow
m_Shader: {fileID: 4800000, guid: 049d9e75e07674a78a703cf1203c07dd, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NoiseTex:
m_Texture: {fileID: 2800000, guid: 12319e92c3b5b45d193b1fe41ed05a1f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ConstantWidth: 1
- _Cull: 2
- _CutOff: 0.5
- _Cutoff: 0.5
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _GlowStencilComp: 6
- _GlowStencilOp: 0
- _GlowZTest: 4
- _Metallic: 0
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Glow: {r: 1, g: 0.025, b: 0.75, a: 0.5}
- _Glow2: {r: 0.01, g: 1, b: 0.5, a: 0}
- _GlowColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowDirection: {r: 1, g: 1, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
--- !u!114 &8957597210722627563
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1

View File

@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: fad17ab68b248b44694785c146cb2606
folderAsset: yes
DefaultImporter:
guid: 41672e7b4c6544aedbffb9e271c7ef7c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,134 @@
Shader "HighlightPlus/Geometry/Glow" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Glow2 ("Glow2", Vector) = (0.01, 1, 0.5, 0)
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_Cull ("Cull Mode", Int) = 2
_ConstantWidth ("Constant Width", Float) = 1
_MinimumWidth ("Minimum Width", Float) = 0
_GlowZTest ("ZTest", Int) = 4
_GlowStencilOp ("Stencil Operation", Int) = 0
_CutOff("CutOff", Float ) = 0.5
_GlowStencilComp ("Stencil Comp", Int) = 6
_NoiseTex("Noise Tex", 2D) = "white" {}
}
SubShader
{
Tags { "Queue"="Transparent+102" "RenderType"="Transparent" "DisableBatching"="True" }
// Glow passes
Pass
{
Stencil {
Ref 2
Comp [_GlowStencilComp]
Pass [_GlowStencilOp]
ReadMask 2
WriteMask 2
}
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull [_Cull]
ZTest [_GlowZTest]
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_instancing
#pragma multi_compile_local _ HP_ALPHACLIP
#pragma multi_compile_local _ HP_DITHER_BLUENOISE
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
fixed4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
//float4 _Glow; // x = intensity, y = width, z = magic number 1, w = magic number 2
float3 _Glow2; // x = outline width, y = glow speed, z = dither intensity
float _ConstantWidth, _MinimumWidth;
fixed _CutOff;
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainTex_TexelSize;
sampler2D _NoiseTex;
float4 _NoiseTex_TexelSize;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _GlowColor)
UNITY_DEFINE_INSTANCED_PROP(float4, _Glow)
UNITY_DEFINE_INSTANCED_PROP(float4, _GlowDirection)
UNITY_INSTANCING_BUFFER_END(Props)
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float4 pos = ComputeVertexPosition(v.vertex);
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = any(norm.xy)!=0 ? TransformViewToProjection(normalize(norm.xy)) : 0.0.xx;
float2 glowDirection = UNITY_ACCESS_INSTANCED_PROP(Props, _GlowDirection);
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) || defined(SINGLE_PASS_STEREO)
glowDirection.x *= 2.0;
#endif
offset += glowDirection;
float z = lerp(UNITY_Z_0_FAR_FROM_CLIPSPACE(pos.z), 2.0, UNITY_MATRIX_P[3][3]);
float minWidth = lerp(2, z, _MinimumWidth);
z = lerp(minWidth, z, _ConstantWidth);
float outlineWidth = _Glow2.x;
float4 glow = UNITY_ACCESS_INSTANCED_PROP(Props, _Glow);
float animatedWidth = glow.y * (1.0 + 0.25 * sin(_Time.w * _Glow2.y));
offset *= z * (outlineWidth + animatedWidth);
pos.xy += offset;
o.pos = pos;
o.color = UNITY_ACCESS_INSTANCED_PROP(Props, _GlowColor);
o.color.a = glow.x;
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
#if HP_ALPHACLIP
fixed4 col = tex2D(_MainTex, i.uv);
clip(col.a - _CutOff);
#endif
fixed4 color = i.color;
float4 glow = UNITY_ACCESS_INSTANCED_PROP(Props, _Glow);
#if HP_DITHER_BLUENOISE
float2 noiseUV = i.pos.xy * _NoiseTex_TexelSize.xy;
fixed dither = tex2D(_NoiseTex, noiseUV).r;
color.a *= saturate( 1.0 - _Glow2.z * dither);
#else
float2 screenPos = floor( i.pos.xy * glow.z ) * glow.w;
fixed dither = frac(screenPos.x + screenPos.y);
color.a *= saturate(1.0 - _Glow2.z + dither);
#endif
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 049d9e75e07674a78a703cf1203c07dd
ShaderImporter:
externalObjects: {}
defaultTextures:
- _MainTex: {instanceID: 0}
- _NoiseTex: {fileID: 2800000, guid: 12319e92c3b5b45d193b1fe41ed05a1f, type: 3}
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,69 @@
Shader "HighlightPlus/Geometry/IconFX"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_DarkColor ("Dark Color", Color) = (0.5, 0.5, 0.5,1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 200
Pass
{
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
half4 _Color, _DarkColor;
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 color : COLOR;
float2 uv : TEXCOORD0;
};
struct v2f
{
float4 pos : SV_POSITION;
float3 normal : TEXCOORD1;
float4 color : COLOR;
float2 uv : TEXCOORD0;
};
v2f vert (appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.normal = UnityObjectToWorldNormal(v.normal);
o.color = v.color;
o.uv = v.uv;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 finalColor = i.color;
// Basic Lambertian reflection (diffuse lighting)
float3 lightDir = normalize(_WorldSpaceLightPos0.xyz);
float lambert = max(dot(i.normal, lightDir), 0);
// Apply lighting to final color
finalColor = lerp(_DarkColor, _Color, lambert);
return finalColor;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 102d0b94573b248649f49d8cf8cc8fa1
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,98 @@
Shader "HighlightPlus/Geometry/InnerGlow" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_InnerGlowColor ("Inner Glow Color", Color) = (1,1,1,1)
_InnerGlowWidth ("Width", Float) = 1.0
_CutOff("CutOff", Float ) = 0.5
_Cull ("Cull Mode", Int) = 2
_InnerGlowZTest ("ZTest", Int) = 4
_InnerGlowBlendMode("Blend Mode", Int) = 1
}
SubShader
{
Tags { "Queue"="Transparent+122" "RenderType"="Transparent" }
// Inner Glow
Pass
{
Stencil {
Ref 4
ReadMask 4
Comp NotEqual
Pass keep
}
Blend SrcAlpha [_InnerGlowBlendMode]
ZWrite Off
ZTest [_InnerGlowZTest]
Cull [_Cull]
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALPHACLIP
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float3 wpos : TEXCOORD1;
float3 normal : NORMAL;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
fixed _CutOff;
fixed4 _InnerGlowColor;
fixed _InnerGlowWidth;
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
o.wpos = mul(unity_ObjectToWorld, v.vertex).xyz;
o.normal = UnityObjectToWorldNormal(v.normal);
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
#if UNITY_REVERSED_Z
o.pos.z += 0.0001;
#else
o.pos.z -= 0.0001;
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
#if HP_ALPHACLIP
fixed4 color = tex2D(_MainTex, i.uv);
clip(color.a - _CutOff);
#endif
float3 viewDir = normalize(i.wpos - _WorldSpaceCameraPos.xyz);
fixed dx = saturate(_InnerGlowWidth - abs(dot(viewDir, normalize(i.normal)))) / _InnerGlowWidth;
fixed4 col = _InnerGlowColor * dx;
return col;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e5a069457bd344391acd5af227c0ce11
timeCreated: 1544699250
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
Shader "HighlightPlus/Geometry/Mask" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_CutOff("CutOff", Float ) = 0.5
_Cull ("Cull Mode", Int) = 2
_ZTest("ZTest", Int) = 4
_Padding("Padding", Float) = 0
}
SubShader
{
Tags { "Queue"="Transparent+100" "RenderType"="Transparent" "DisableBatching"="True" }
CGINCLUDE
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainTex_TexelSize;
float _Padding;
fixed _CutOff;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
v.vertex.xyz *= 1 + _Padding;
o.pos = ComputeVertexPosition(v.vertex);
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
#if UNITY_REVERSED_Z
o.pos.z += 0.0001;
#else
o.pos.z -= 0.0001;
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
#if HP_ALPHACLIP
fixed4 col = tex2D(_MainTex, i.uv);
clip(col.a - _CutOff);
#endif
return 0;
}
ENDCG
// Create mask
Pass
{
Name "Mask"
Stencil {
Ref 2
Comp always
Pass replace
WriteMask 2
ReadMask 2
}
ColorMask 0
ZWrite Off
Cull [_Cull] // default Cull Back improves glow in high quality)
ZTest [_ZTest]
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALPHACLIP
ENDCG
}
// Create mask for see-through (the only difference is the ZTest)
Pass
{
Name "See-through Mask"
Stencil {
Ref 2
Comp always
Pass replace
WriteMask 2
ReadMask 2
}
ColorMask 0
ZWrite Off
Cull [_Cull] // default Cull Back improves glow in high quality)
ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALPHACLIP
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e694fa934b6db4a00b8d4b9887115332
timeCreated: 1544699251
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,59 @@
Shader "HighlightPlus/Geometry/SeeThroughOccluder" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
}
SubShader
{
Tags { "Queue"="Transparent+100" "RenderType"="Transparent" }
// Create mask
Pass
{
Stencil {
Ref 3
WriteMask 3
Comp always
Pass replace
}
ColorMask 0
ZWrite Off
Offset -1, -1
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return 0;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 229baf997355a43cda580dd4cf86b71e
timeCreated: 1544699251
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,94 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6555637095062934885
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HighlightOutline
m_Shader: {fileID: 4800000, guid: cbbf740e9c8644e8492d08b1a3fd0203, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ConstantWidth: 1
- _Cull: 2
- _Cutoff: 0.5
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _OutlineWidth: 0.01
- _OutlineZTest: 4
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _OutlineDirection: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}

View File

@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 2d5f7f910963a114fa770fe9550b73fd
folderAsset: yes
DefaultImporter:
guid: 580895c3d590f4760ba7d0ee2a5dc624
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,193 @@
Shader "HighlightPlus/Geometry/Outline" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_OutlineWidth ("Outline Offset", Float) = 0.01
_OutlineGradientTex("Outline Gradient Tex", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_Cull ("Cull Mode", Int) = 2
_ConstantWidth ("Constant Width", Float) = 1
_MinimumWidth("Minimum Width", Float) = 0
_OutlineZTest("ZTest", Int) = 4
_CutOff("CutOff", Float ) = 0.5
_OutlineStencilComp ("Stencil Comp", Int) = 6
}
SubShader
{
Tags { "Queue"="Transparent+120" "RenderType"="Transparent" "DisableBatching"="True" }
Pass
{
Name "Outline"
Stencil {
Ref 2
Comp [_OutlineStencilComp]
Pass replace
ReadMask 2
WriteMask 2
}
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull [_Cull]
ZTest [_OutlineZTest]
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_instancing
#pragma multi_compile_local _ HP_ALPHACLIP
#pragma multi_compile_local _ HP_OUTLINE_GRADIENT_WS HP_OUTLINE_GRADIENT_LS
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
fixed yt : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _OutlineColor;
sampler2D _OutlineGradientTex;
float _OutlineWidth;
float _ConstantWidth, _MinimumWidth;
fixed _CutOff;
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainTex_TexelSize;
fixed2 _OutlineVertexData;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _OutlineDirection)
UNITY_INSTANCING_BUFFER_END(Props)
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
#if HP_OUTLINE_GRADIENT_WS
float posy = mul(unity_ObjectToWorld, v.vertex).y;
o.yt = saturate( (posy - _OutlineVertexData.x) / _OutlineVertexData.y);
#else
o.yt = saturate( (v.vertex.y - _OutlineVertexData.x) / _OutlineVertexData.y);
#endif
o.pos = ComputeVertexPosition(v.vertex);
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = any(norm.xy)!=0 ? TransformViewToProjection(normalize(norm.xy)) : 0.0.xx;
float z = lerp(UNITY_Z_0_FAR_FROM_CLIPSPACE(o.pos.z), 2.0, UNITY_MATRIX_P[3][3]);
float minWidth = lerp(2, z, _MinimumWidth);
z = lerp(minWidth, z, _ConstantWidth);
float4 outlineDirection = UNITY_ACCESS_INSTANCED_PROP(Props, _OutlineDirection);
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) || defined(SINGLE_PASS_STEREO)
outlineDirection.x *= 2.0;
#endif
o.pos.xy += offset * z * _OutlineWidth + outlineDirection.xy * z;
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
#if HP_ALPHACLIP
fixed4 col = tex2D(_MainTex, i.uv);
clip(col.a - _CutOff);
#endif
#if HP_OUTLINE_GRADIENT_WS || HP_OUTLINE_GRADIENT_LS
half4 color = tex2D(_OutlineGradientTex, float2(i.yt, 0));
color.a *= _OutlineColor.a;
#else
half4 color = _OutlineColor;
#endif
return color;
}
ENDCG
}
Pass
{
Name "Outline Clear Stencil"
Stencil {
Ref 2
Comp Always
Pass zero
}
ColorMask 0
ZWrite Off
Cull [_Cull]
ZTest [_OutlineZTest]
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_instancing
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _OutlineColor;
float _OutlineWidth;
float _ConstantWidth;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _OutlineDirection)
UNITY_INSTANCING_BUFFER_END(Props)
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = any(norm.xy)!=0 ? TransformViewToProjection(normalize(norm.xy)) : 0.0.xx;
float z = lerp(UNITY_Z_0_FAR_FROM_CLIPSPACE(o.pos.z), 2.0, UNITY_MATRIX_P[3][3]);
z = _ConstantWidth * (z - 2.0) + 2.0;
float4 outlineDirection = UNITY_ACCESS_INSTANCED_PROP(Props, _OutlineDirection);
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) || defined(SINGLE_PASS_STEREO)
outlineDirection.x *= 2.0;
#endif
o.pos.xy += offset * z * _OutlineWidth + outlineDirection.xy * z;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return 0;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cbbf740e9c8644e8492d08b1a3fd0203
timeCreated: 1544699250
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,144 @@
Shader "HighlightPlus/Geometry/Overlay" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_OverlayColor ("Overlay Color", Color) = (1,1,1,1)
_OverlayBackColor ("Overlay Back Color", Color) = (1,1,1,1)
_OverlayData("Overlay Data", Vector) = (1,0.5,1,1)
_OverlayHitPosData("Overlay Hit Pos Data", Vector) = (0,0,0,0)
_OverlayHitStartTime("Overlay Hit Start Time", Float) = 0
_OverlayTexture("Overlay Texture", 2D) = "white" {}
_CutOff("CutOff", Float ) = 0.5
_Cull ("Cull Mode", Int) = 2
_OverlayZTest("ZTest", Int) = 4
}
SubShader
{
Tags { "Queue"="Transparent+121" "RenderType"="Transparent" "DisableBatching"="True" }
// Overlay
Pass
{
Name "Overlay"
Stencil {
Ref 4
ReadMask 4
Comp NotEqual
Pass keep
}
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull [_Cull]
Offset -1, -1 // avoid issues on Quest 2 standalone when using with other render features (ie. Liquid Volume Pro 2 irregular topology)
ZTest [_OverlayZTest]
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALPHACLIP
#pragma multi_compile_local _ HP_TEXTURE_TRIPLANAR HP_TEXTURE_SCREENSPACE HP_TEXTURE_OBJECTSPACE
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 norm : NORMAL;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float3 wpos : TEXCOORD1;
#if HP_TEXTURE_TRIPLANAR
float3 wnorm : TEXCOORD2;
#endif
#if HP_TEXTURE_SCREENSPACE
float4 scrPos : TEXCOORD3;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _OverlayColor;
sampler2D _MainTex;
float4 _MainTex_ST;
fixed4 _OverlayBackColor;
fixed4 _OverlayData; // x = speed, y = MinIntensity, z = blend, w = texture scale
float4 _OverlayHitPosData;
float _OverlayHitStartTime;
fixed _CutOff;
sampler2D _OverlayTexture;
float2 _OverlayTextureScrolling;
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
#if HP_TEXTURE_SCREENSPACE
o.scrPos = ComputeScreenPos(o.pos);
o.scrPos.x *= _ScreenParams.x / _ScreenParams.y;
#endif
o.wpos = mul(unity_ObjectToWorld, v.vertex).xyz;
#if HP_TEXTURE_TRIPLANAR
o.wnorm = UnityObjectToWorldNormal(v.norm);
#endif
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 color = tex2D(_MainTex, i.uv);
#if HP_ALPHACLIP
clip(color.a - _CutOff);
#endif
float time = _Time.y % 1000;
fixed t = _OverlayData.y + (1.0 - _OverlayData.y) * 2.0 * abs(0.5 - frac(time * _OverlayData.x));
fixed4 col = lerp(_OverlayColor, color * _OverlayBackColor * _OverlayColor, _OverlayData.z);
col.a *= t;
if (_OverlayHitPosData.w>0) {
float elapsed = _Time.y - _OverlayHitStartTime;
float hitDist = distance(i.wpos, _OverlayHitPosData.xyz);
float atten = saturate( min(elapsed, _OverlayHitPosData.w) / hitDist );
col.a *= atten;
}
#if HP_TEXTURE_TRIPLANAR
half3 triblend = saturate(pow(i.wnorm, 4));
triblend /= max(dot(triblend, half3(1,1,1)), 0.0001);
// triplanar uvs
float3 tpos = i.wpos * _OverlayData.w;
float2 uvX = tpos.zy;
float2 uvY = tpos.xz;
float2 uvZ = tpos.xy;
// albedo textures
fixed4 colX = tex2D(_OverlayTexture, uvX);
fixed4 colY = tex2D(_OverlayTexture, uvY);
fixed4 colZ = tex2D(_OverlayTexture, uvZ);
fixed4 tex = colX * triblend.x + colY * triblend.y + colZ * triblend.z;
col *= tex;
#elif HP_TEXTURE_SCREENSPACE
float2 uvOffset = _OverlayTextureScrolling * _Time.y;
col *= tex2D(_OverlayTexture, (i.scrPos.xy / i.scrPos.w) * _OverlayData.w + uvOffset);
#elif HP_TEXTURE_OBJECTSPACE
float2 uvOffset = _OverlayTextureScrolling * _Time.y;
col *= tex2D(_OverlayTexture, i.uv * _OverlayData.w + uvOffset);
#endif
return col;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d17a98d19ada34bb7b4f86130e590159
timeCreated: 1544699250
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -6,8 +6,8 @@ Material:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Plane
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_Name: HighlightPlusDepthWrite
m_Shader: {fileID: 4800000, guid: 058a572e30b2d446bade2dda32bcef0f, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@@ -62,7 +62,7 @@ Material:
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
@@ -72,5 +72,5 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.2509804, g: 0.2509804, b: 0.5019608, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 825cb444e111842cf97788cbb7583edd
timeCreated: 1546857910
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,170 @@
Shader "HighlightPlus/Geometry/SeeThrough" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_SeeThrough ("See Through", Range(0,1)) = 0.8
_SeeThroughTintColor ("See Through Tint Color", Color) = (1,0,0,0.8)
_SeeThroughNoise("Noise", Float) = 1
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_CutOff("CutOff", Float ) = 0.5
_SeeThroughStencilRef ("Stencil Ref", Int) = 2
_SeeThroughStencilComp ("Stencil Comp", Int) = 5
_SeeThroughStencilPassOp ("Stencil Pass Operation", Int) = 0
_SeeThroughDepthOffset ("Depth Offset", Float) = 0
_SeeThroughMaxDepth("Max Depth", Float) = 0
_SeeThroughTexture("Mask Texture", 2D) = "white" {}
_SeeThroughTextureScale("Mask Texture Scale", Float) = 1.0
_Cull ("Cull Mode", Int) = 2
}
SubShader
{
Tags { "Queue"="Transparent+201" "RenderType"="Transparent" "DisableBatching"="True" }
// See through effect
Pass
{
Name "See-through"
Stencil {
ReadMask 3
WriteMask 3
Ref [_SeeThroughStencilRef]
Comp [_SeeThroughStencilComp]
Pass [_SeeThroughStencilPassOp]
Fail [_SeeThroughStencilPassOp]
}
ZTest Greater
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Cull [_Cull] // default Cull Back improves glow in high quality)
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALPHACLIP
#pragma multi_compile_local _ HP_DEPTH_OFFSET
#pragma multi_compile_local _ HP_SEETHROUGH_ONLY_BORDER
#pragma multi_compile_local _ HP_TEXTURE_TRIPLANAR HP_TEXTURE_SCREENSPACE HP_TEXTURE_OBJECTSPACE
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 norm : NORMAL;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float2 uv : TEXCOORD0;
#if HP_DEPTH_OFFSET || HP_TEXTURE_SCREENSPACE
float4 scrPos : TEXCOORD1;
#endif
#if HP_DEPTH_OFFSET
float depth : TEXCOORD2;
#endif
float3 wpos : TEXCOORD3;
#if HP_TEXTURE_TRIPLANAR
float3 wnorm : TEXCOORD4;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
fixed _SeeThrough;
fixed4 _SeeThroughTintColor;
fixed _CutOff;
fixed _SeeThroughNoise;
float _SeeThroughDepthOffset;
float _SeeThroughMaxDepth;
fixed _HP_Fade;
sampler2D _SeeThroughTexture;
fixed _SeeThroughTextureScale;
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
#if HP_DEPTH_OFFSET || HP_TEXTURE_SCREENSPACE
o.scrPos = ComputeScreenPos(o.pos);
#endif
#if HP_DEPTH_OFFSET
COMPUTE_EYEDEPTH(o.depth);
#endif
o.wpos = mul(unity_ObjectToWorld, v.vertex).xyz;
#if HP_TEXTURE_TRIPLANAR
o.wnorm = UnityObjectToWorldNormal(v.norm);
#endif
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
float GetEyeDepth(float rawDepth) {
float persp = LinearEyeDepth(rawDepth);
float ortho = (_ProjectionParams.z-_ProjectionParams.y)*(1-rawDepth)+_ProjectionParams.y;
return lerp(persp,ortho,unity_OrthoParams.w);
}
fixed4 frag (v2f i) : SV_Target
{
#if HP_SEETHROUGH_ONLY_BORDER
return 0;
#else
#if HP_DEPTH_OFFSET
float sceneZ = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.scrPos.xy / i.scrPos.w);
float sceneDepth = GetEyeDepth(sceneZ);
if (i.depth - sceneDepth - _SeeThroughDepthOffset < 0 || i.depth - sceneDepth > _SeeThroughMaxDepth) discard;
#endif
fixed4 col = tex2D(_MainTex, i.uv);
#if HP_ALPHACLIP
clip(col.a - _CutOff);
#endif
col.rgb = lerp(col.rgb, _SeeThroughTintColor.rgb, _SeeThroughTintColor.a);
float scry = i.pos.y;
float time = _Time.w % 1.0;
col.rgb += _SeeThroughNoise *(frac( scry * time ) * 0.1);
col.a = _SeeThrough;
col.a = lerp(col.a, col.a * ( (scry % 2) - 1.0 ), _SeeThroughNoise);
col.a *= _HP_Fade;
#if HP_TEXTURE_TRIPLANAR
half3 triblend = saturate(pow(i.wnorm, 4));
triblend /= max(dot(triblend, half3(1,1,1)), 0.0001);
// triplanar uvs
float3 tpos = i.wpos * _SeeThroughTextureScale;
float2 uvX = tpos.zy;
float2 uvY = tpos.xz;
float2 uvZ = tpos.xy;
// albedo textures
fixed4 colX = tex2D(_SeeThroughTexture, uvX);
fixed4 colY = tex2D(_SeeThroughTexture, uvY);
fixed4 colZ = tex2D(_SeeThroughTexture, uvZ);
fixed4 tex = colX * triblend.x + colY * triblend.y + colZ * triblend.z;
col *= tex;
#elif HP_TEXTURE_SCREENSPACE
float2 uv = (i.scrPos.xy / i.scrPos.w);
uv.x *= _ScreenParams.x / _ScreenParams.y;
col *= tex2D(_SeeThroughTexture, uv * _SeeThroughTextureScale);
#elif HP_TEXTURE_OBJECTSPACE
col *= tex2D(_SeeThroughTexture, i.uv * _SeeThroughTextureScale);
#endif
return col;
#endif // HP_ONLY_BORDER
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 47198bbf0b2a44882aceef6af17a467d
timeCreated: 1544699250
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,124 @@
Shader "HighlightPlus/Geometry/SeeThroughBorder" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_SeeThroughBorderColor ("Outline Color", Color) = (0,0,0,1)
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_CutOff("CutOff", Float ) = 0.5
_SeeThroughBorderWidth ("Outline Offset", Float) = 0.01
_SeeThroughBorderConstantWidth ("Constant Width", Float) = 1
_SeeThroughStencilRef ("Stencil Ref", Int) = 2
_SeeThroughStencilComp ("Stencil Comp", Int) = 5
_SeeThroughDepthOffset ("Depth Offset", Float) = 0
_SeeThroughMaxDepth("Max Depth", Float) = 0
_SeeThroughStencilPassOp ("Stencil Pass Operation", Int) = 0
_Cull ("Cull Mode", Int) = 2
}
SubShader
{
Tags { "Queue"="Transparent+201" "RenderType"="Transparent" "DisableBatching"="True" }
// See through effect
Pass
{
Name "See-through border"
Stencil {
ReadMask 3
WriteMask 3
Ref [_SeeThroughStencilRef]
Comp [_SeeThroughStencilComp]
Pass [_SeeThroughStencilPassOp]
Fail [_SeeThroughStencilPassOp]
}
ZTest Greater
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Cull [_Cull] // default Cull Back improves glow in high quality)
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALPHACLIP
#pragma multi_compile_local _ HP_DEPTH_OFFSET
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float2 uv : TEXCOORD0;
#if HP_DEPTH_OFFSET
float4 scrPos : TEXCOORD1;
float depth : TEXCOORD2;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
fixed4 _SeeThroughBorderColor;
fixed _CutOff;
float _SeeThroughDepthOffset;
float _SeeThroughMaxDepth;
float _SeeThroughBorderWidth;
float _SeeThroughBorderConstantWidth;
fixed _HP_Fade;
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
#if HP_DEPTH_OFFSET
o.scrPos = ComputeScreenPos(o.pos);
COMPUTE_EYEDEPTH(o.depth);
#endif
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = any(norm.xy)!=0 ? TransformViewToProjection(normalize(norm.xy)) : 0.0.xx;
float z = lerp(UNITY_Z_0_FAR_FROM_CLIPSPACE(o.pos.z), 2.0, UNITY_MATRIX_P[3][3]);
z = _SeeThroughBorderConstantWidth * (z - 2.0) + 2.0;
o.pos.xy += offset * z * _SeeThroughBorderWidth;
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
float GetEyeDepth(float rawDepth) {
float persp = LinearEyeDepth(rawDepth);
float ortho = (_ProjectionParams.z-_ProjectionParams.y)*(1-rawDepth)+_ProjectionParams.y;
return lerp(persp,ortho,unity_OrthoParams.w);
}
fixed4 frag (v2f i) : SV_Target
{
#if HP_DEPTH_OFFSET
float sceneZ = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.scrPos.xy / i.scrPos.w);
float sceneDepth = GetEyeDepth(sceneZ);
if (i.depth - sceneDepth - _SeeThroughDepthOffset < 0 || i.depth - sceneDepth > _SeeThroughMaxDepth) discard;
#endif
#if HP_ALPHACLIP
fixed4 col = tex2D(_MainTex, i.uv);
clip(col.a - _CutOff);
#endif
fixed4 res = _SeeThroughBorderColor;
res.a *= _HP_Fade;
return res;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fe0a98aa774224cf1bc4a800a586a33a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,62 @@
Shader "HighlightPlus/Geometry/SeeThroughMask" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
}
SubShader
{
Tags { "Queue"="Transparent+201" "RenderType"="Transparent" "DisableBatching"="True" }
// See through effect
Pass
{
Name "See-through mask"
Stencil {
WriteMask 3
Ref 1
Comp always
Pass replace
}
ZTest Always
ZWrite On
ColorMask 0
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return 0;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 457d76fdfc7c4472faeb0297c0edab29
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,142 @@
Shader "HighlightPlus/Geometry/SolidColor" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_CutOff("CutOff", Float ) = 0.5
_Cull ("Cull Mode", Int) = 2
_ZTest("ZTest", Int) = 4
_EdgeThreshold("Edge Threshold", Float) = 0.995
_Padding("Padding", Float) = 0
}
SubShader
{
Tags { "Queue"="Transparent+100" "RenderType"="Transparent" "DisableBatching" = "True" }
// Compose effect on camera target
Pass
{
Name "Solid Color"
ZWrite Off
Cull [_Cull]
ZTest Always
Stencil {
Ref 2
Comp NotEqual
Pass replace
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_ALPHACLIP
#pragma multi_compile_local _ HP_DEPTHCLIP HP_DEPTHCLIP_INV
#pragma multi_compile_local _ HP_ALL_EDGES
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
sampler2D _MainTex;
#if HP_DEPTHCLIP || HP_DEPTHCLIP_INV || HP_ALL_EDGES
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
float4 _CameraDepthTexture_TexelSize;;
float _EdgeThreshold;
#endif
float4 _MainTex_ST;
float _Padding;
fixed _CutOff;
fixed4 _Color;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 scrPos : TEXCOORD1;
#if HP_DEPTHCLIP || HP_DEPTHCLIP_INV
float depth : TEXCOORD2;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
v.vertex.xyz *= 1.0 + _Padding;
o.pos = ComputeVertexPosition(v.vertex);
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
o.scrPos = ComputeScreenPos(o.pos);
#if HP_DEPTHCLIP || HP_DEPTHCLIP_INV
COMPUTE_EYEDEPTH(o.depth);
#endif
return o;
}
#if HP_ALL_EDGES
float3 GetNormal(float depth, float depth1, float depth2, float2 offset1, float2 offset2) {
float3 p1 = float3(offset1, depth1 - depth);
float3 p2 = float3(offset2, depth2 - depth);
float3 normal = cross(p1, p2);
return normalize(normal);
}
fixed ComputeDepthOutline(float2 uv) {
float3 uvInc = float3(_CameraDepthTexture_TexelSize.x, _CameraDepthTexture_TexelSize.y, 0);
float depthS = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv - uvInc.zy));
float depthW = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv - uvInc.xz));
float depthE = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv + uvInc.xz));
float depthN = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv + uvInc.zy));
float depth = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv));
float3 normalNW = GetNormal(depth, depthN, depthW, uvInc.zy, float2(-uvInc.x, 0));
float3 normalSE = GetNormal(depth, depthS, depthE, float2(0, -uvInc.y), uvInc.xz);
float dnorm = dot(normalNW, normalSE);
fixed outline = (fixed)(dnorm < _EdgeThreshold);
return outline;
}
#endif
fixed4 frag (v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
#if HP_ALPHACLIP
fixed4 col = tex2D(_MainTex, i.uv);
clip(col.a - _CutOff);
#endif
float2 uv = UnityStereoTransformScreenSpaceTex(i.scrPos.xy / i.scrPos.w);
#if HP_DEPTHCLIP || HP_DEPTHCLIP_INV
float depthRaw = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv);
float depthPersp = LinearEyeDepth(depthRaw);
#if defined(UNITY_REVERSED_Z)
depthRaw = 1.0 - depthRaw;
#endif
float depthOrtho = lerp(_ProjectionParams.y, _ProjectionParams.z, depthRaw);
float vz = unity_OrthoParams.w ? depthOrtho : depthPersp;
#if HP_DEPTHCLIP_INV
clip( i.depth * 0.999 - vz);
#else
clip( vz - i.depth * 0.999);
#endif
#endif
#if HP_ALL_EDGES
return fixed4(1.0, ComputeDepthOutline(uv), 1.0, 1.0);
#else
return fixed4(1.0, 1.0, 1.0, 1.0);
#endif
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 77643996218224478a471439e0ea5fb4
timeCreated: 1544699251
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,168 @@
Shader "HighlightPlus/Geometry/Target" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_ZTest ("ZTest", Int) = 0
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "Transparent-1" "DisableBatching" = "True" }
// Target FX decal
Pass
{
Stencil {
Ref 2
Comp NotEqual
ReadMask 2
}
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
ZTest [_ZTest]
Cull Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
struct appdata
{
float3 positionOS : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 positionCS : SV_POSITION;
float4 screenPos : TEXCOORD0;
float4 rayVS : TEXCOORD1;
float3 camPosVS : TEXCOORD2;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half4 _Color;
float4 _TargetFXRenderData;
CBUFFER_END
#define GROUND_NORMAL _TargetFXRenderData.xyz
#define FADE_POWER _TargetFXRenderData.w
v2f vert(appdata input)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
VertexPositionInputs vertexPositionInput = GetVertexPositionInputs(input.positionOS);
o.positionCS = vertexPositionInput.positionCS;
o.screenPos = ComputeScreenPos(o.positionCS);
float3 viewRay = vertexPositionInput.positionVS;
o.rayVS.w = viewRay.z;
float4x4 viewToObject = mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V);
o.rayVS.xyz = mul((float3x3)viewToObject, -viewRay);
o.camPosVS = mul(viewToObject, float4(0,0,0,1)).xyz;
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float depth = SampleSceneDepth(i.screenPos.xy / i.screenPos.w);
float3 decalPos;
if(unity_OrthoParams.w) {
#if defined(UNITY_REVERSED_Z)
depth = 1.0 - depth;
#endif
float sceneDepthVS = lerp(_ProjectionParams.y, _ProjectionParams.z, depth);
float2 rayVSEnd = float2(unity_OrthoParams.xy * (i.screenPos.xy - 0.5) * 2.0);
float4 posVS = float4(rayVSEnd, -sceneDepthVS, 1);
float3 wpos = mul(UNITY_MATRIX_I_V, posVS).xyz;
decalPos = mul(GetWorldToObjectMatrix(), float4(wpos, 1)).xyz;
} else {
float depthEye = LinearEyeDepth(depth, _ZBufferParams);
decalPos = i.camPosVS + (i.rayVS.xyz / i.rayVS.w) * depthEye;
}
clip(0.5 - abs(decalPos));
// check normal
float3 normal = normalize(cross(ddx(decalPos), -ddy(decalPos)));
float slope = dot(normal, GROUND_NORMAL);
clip(slope - 0.01);
float2 uv = decalPos.xz + 0.5;
half4 col = tex2D(_MainTex, uv);
col *= _Color;
// atten with elevation
col.a /= 1.0 + pow(1.0 + max(0, decalPos.y - 0.1), FADE_POWER);
return col;
}
ENDHLSL
}
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
ZTest [_ZTest]
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
fixed4 _Color;
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return tex2D(_MainTex, i.uv) * _Color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 54328cae8f89d442da972097ce4f23d9
timeCreated: 1544699250
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2752029129534311206
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HighlightUIMask
m_Shader: {fileID: 4800000, guid: 3e461a1484e2948598abca48b53d8b58, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ColorMask: 15
- _Cull: 2
- _CutOff: 0.5
- _Cutoff: 0.5
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 6
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 6
- _StencilWriteMask: 6
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 779128a8e84b44d4db81443c424af511
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,74 @@
Shader "HighlightPlus/UI/Mask" {
Properties {
_MainTex ("Texture", Any) = "white" {}
_Color ("Color", Color) = (1,1,1) // not used; dummy property to avoid inspector warning "material has no _Color property"
_CutOff("CutOff", Float ) = 0.5
_Stencil("Stencil ID", Float) = 14
_StencilWriteMask("Stencil Write Mask", Float) = 14
_StencilReadMask("Stencil Read Mask", Float) = 14
}
SubShader
{
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector" = "True" }
// Create mask
Pass
{
Stencil {
Ref [_Stencil]
Comp always
Pass replace
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
ColorMask 0
ZWrite Off
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "CustomVertexTransform.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainTex_TexelSize;
fixed _CutOff;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos: SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = ComputeVertexPosition(v.vertex);
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
clip(col.a - _CutOff);
return 0;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3e461a1484e2948598abca48b53d8b58
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,106 @@
fileFormatVersion: 2
guid: 0619ab933f4044ef7bca0b64517837b3
ModelImporter:
serializedVersion: 21300
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 0
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 1
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 0.2
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 0
importBlendShapes: 1
importCameras: 0
importLights: 0
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 1
tangentImportMode: 2
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 3
referencedClips: []
importAnimation: 0
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 0.2
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 0
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,13 +1,13 @@
fileFormatVersion: 2
guid: 2ae0822a56ca01448a345ecfaf5f10ed
guid: 12319e92c3b5b45d193b1fe41ed05a1f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
@@ -20,26 +20,25 @@ TextureImporter:
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 1
seamlessCubemap: 1
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 0
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
@@ -51,11 +50,11 @@ TextureImporter:
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaUsage: 0
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
@@ -64,23 +63,21 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 100
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
@@ -90,14 +87,36 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
@@ -107,11 +126,10 @@ TextureImporter:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -0,0 +1,100 @@
fileFormatVersion: 2
guid: 1de3c566a6c8c405b9f6f453137273ec
timeCreated: 1555360741
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: WebGL
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,10 +1,9 @@
fileFormatVersion: 2
guid: 3ddbd65d69a9f0b48bab4fe96a1fe099
guid: 89ce39cd6bb34454bbaf48f1d111f236
folderAsset: yes
timeCreated: 1522559122
timeCreated: 1542876305
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 888380afc233049ce9e618f9f36c8ba8
timeCreated: 1545593776
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 900
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,108 @@
using UnityEngine;
namespace HighlightPlus {
public enum HitFxMode {
Overlay = 0,
InnerGlow = 1,
LocalHit = 2
}
public partial class HighlightEffect : MonoBehaviour {
public static bool useUnscaledTime;
public static float GetTime() {
return useUnscaledTime ? Time.unscaledTime : Time.time;
}
[Range(0,1)] public float hitFxInitialIntensity;
public HitFxMode hitFxMode = HitFxMode.Overlay;
public float hitFxFadeOutDuration = 0.25f;
[ColorUsage(true, true)] public Color hitFxColor = Color.white;
public float hitFxRadius = 0.5f;
float hitInitialIntensity;
float hitStartTime;
float hitFadeOutDuration;
Color hitColor;
bool hitActive;
Vector3 hitPosition;
float hitRadius;
/// <summary>
/// Performs a hit effect using default values
/// </summary>
public void HitFX() {
HitFX(hitFxColor, hitFxFadeOutDuration, hitFxInitialIntensity);
}
/// <summary>
/// Performs a hit effect localized at hit position and radius with default values
/// </summary>
public void HitFX(Vector3 position) {
HitFX(hitFxColor, hitFxFadeOutDuration, hitFxInitialIntensity, position, hitFxRadius);
}
/// <summary>
/// Performs a hit effect using desired color, fade out duration and optionally initial intensity (0-1)
/// </summary>
public void HitFX(Color color, float fadeOutDuration, float initialIntensity = 1f) {
hitInitialIntensity = initialIntensity;
hitFadeOutDuration = fadeOutDuration;
hitColor = color;
hitStartTime = GetTime();
hitActive = true;
if (overlay == 0) {
UpdateMaterialProperties();
}
}
/// <summary>
/// Performs a hit effect using desired color, fade out duration, initial intensity (0-1), hit position and radius of effect
/// </summary>
public void HitFX(Color color, float fadeOutDuration, float initialIntensity, Vector3 position, float radius) {
hitInitialIntensity = initialIntensity;
hitFadeOutDuration = fadeOutDuration;
hitColor = color;
hitStartTime = GetTime();
hitActive = true;
hitPosition = position;
hitRadius = radius;
if (overlay == 0) {
UpdateMaterialProperties();
}
}
/// <summary>
/// Initiates the target FX on demand using predefined configuration (see targetFX... properties)
/// </summary>
public void TargetFX() {
targetFXStartTime = GetTime();
if (!_highlighted) {
highlighted = true;
}
if (!targetFX) {
targetFX = true;
UpdateMaterialProperties();
}
}
/// <summary>
/// Initiates the icon FX on demand using predefined configuration (see iconFX... properties)
/// </summary>
public void IconFX() {
iconFXStartTime = GetTime();
if (!_highlighted) {
highlighted = true;
}
if (!iconFX) {
iconFX = true;
UpdateMaterialProperties();
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e749f80d0d29a49d49d6e0f4752065cd
timeCreated: 1542876337
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using UnityEngine;
using UnityEngine.Rendering;
namespace HighlightPlus {
[DefaultExecutionOrder(100)]
[ExecuteInEditMode]
public class HighlightEffectBlocker : MonoBehaviour {
Renderer thisRenderer;
public bool blockOutlineAndGlow;
public bool blockOverlay;
void OnEnable () {
thisRenderer = GetComponentInChildren<Renderer>();
HighlightPlusRenderPassFeature.RegisterBlocker(this);
}
void OnDisable () {
HighlightPlusRenderPassFeature.UnregisterBlocker(this);
}
public void BuildCommandBuffer(CommandBuffer cmd, Material mat) {
if (thisRenderer == null) return;
Material[] sharedMats = thisRenderer.sharedMaterials;
if (sharedMats == null) return;
int submeshCount = sharedMats.Length;
for (int i = 0; i < submeshCount; i++) {
cmd.DrawRenderer(thisRenderer, mat, i);
}
}
}
}

View File

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

View File

@@ -0,0 +1,278 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
namespace HighlightPlus {
public partial class HighlightEffect : MonoBehaviour {
static readonly List<HighlightSeeThroughOccluder> occluders = new List<HighlightSeeThroughOccluder>();
static readonly Dictionary<Camera, int> occludersFrameCount = new Dictionary<Camera, int>();
static Material fxMatSeeThroughOccluder, fxMatDepthWrite;
static RaycastHit[] hits;
/// <summary>
/// True if the see-through is cancelled by an occluder using raycast method
/// </summary>
public bool IsSeeThroughOccluded(Camera cam) {
if (rms == null) return false;
// Compute bounds
Bounds bounds = new Bounds();
for (int r = 0; r < rms.Length; r++) {
if (rms[r].renderer != null) {
if (bounds.size.x == 0) {
bounds = rms[r].renderer.bounds;
} else {
bounds.Encapsulate(rms[r].renderer.bounds);
}
}
}
Vector3 pos = bounds.center;
Vector3 camPos = cam.transform.position;
Vector3 offset = pos - camPos;
float maxDistance = Vector3.Distance(pos, camPos);
if (hits == null || hits.Length == 0) {
hits = new RaycastHit[64];
}
int occludersCount = occluders.Count;
int hitCount = Physics.BoxCastNonAlloc(pos - offset, bounds.extents * 0.9f, offset.normalized, hits, Quaternion.identity, maxDistance);
for (int k = 0; k < hitCount; k++) {
for (int j = 0; j < occludersCount; j++) {
if (hits[k].collider.transform == occluders[j].transform) {
return true;
}
}
}
return false;
}
public static void RegisterOccluder(HighlightSeeThroughOccluder occluder) {
if (!occluders.Contains(occluder)) {
occluders.Add(occluder);
}
}
public static void UnregisterOccluder(HighlightSeeThroughOccluder occluder) {
if (occluders.Contains(occluder)) {
occluders.Remove(occluder);
}
}
/// <summary>
/// Test see-through occluders.
/// </summary>
/// <param name="cam">The camera to be tested</param>
/// <returns>Returns true if there's no raycast-based occluder cancelling the see-through effect</returns>
public bool RenderSeeThroughOccluders(CommandBuffer cb, Camera cam) {
int occludersCount = occluders.Count;
if (occludersCount == 0 || rmsCount == 0) return true;
bool useRayCastCheck = false;
// Check if raycast method is needed
for (int k = 0; k < occludersCount; k++) {
HighlightSeeThroughOccluder occluder = occluders[k];
if (occluder == null || !occluder.isActiveAndEnabled) continue;
if (occluder.mode == OccluderMode.BlocksSeeThrough && occluder.detectionMethod == DetectionMethod.RayCast) {
useRayCastCheck = true;
break;
}
}
if (useRayCastCheck) {
if (IsSeeThroughOccluded(cam)) return false;
}
// do not render see-through occluders more than once this frame per camera (there can be many highlight effect scripts in the scene, we only need writing to stencil once)
int lastFrameCount;
occludersFrameCount.TryGetValue(cam, out lastFrameCount);
int currentFrameCount = Time.frameCount;
if (currentFrameCount == lastFrameCount) return true;
occludersFrameCount[cam] = currentFrameCount;
if (fxMatSeeThroughOccluder == null) {
InitMaterial(ref fxMatSeeThroughOccluder, "HighlightPlus/Geometry/SeeThroughOccluder");
if (fxMatSeeThroughOccluder == null) return true;
}
if (fxMatDepthWrite == null) {
InitMaterial(ref fxMatDepthWrite, "HighlightPlus/Geometry/JustDepth");
if (fxMatDepthWrite == null) return true;
}
for (int k = 0; k < occludersCount; k++) {
HighlightSeeThroughOccluder occluder = occluders[k];
if (occluder == null || !occluder.isActiveAndEnabled) continue;
if (occluder.detectionMethod == DetectionMethod.Stencil) {
if (occluder.meshData == null) continue;
int meshDataLength = occluder.meshData.Length;
// Per renderer
for (int m = 0; m < meshDataLength; m++) {
// Per submesh
Renderer renderer = occluder.meshData[m].renderer;
if (renderer.isVisible) {
for (int s = 0; s < occluder.meshData[m].subMeshCount; s++) {
cb.DrawRenderer(renderer, occluder.mode == OccluderMode.BlocksSeeThrough ? fxMatSeeThroughOccluder : fxMatDepthWrite, s);
}
}
}
}
}
return true;
}
bool CheckOcclusion(Camera cam) {
if (!perCameraOcclusionData.TryGetValue(cam, out PerCameraOcclusionData occlusionData)) {
occlusionData = new PerCameraOcclusionData();
perCameraOcclusionData[cam] = occlusionData;
}
float now = GetTime();
int frameCount = Time.frameCount; // ensure all cameras are checked this frame
if (now - occlusionData.checkLastTime < seeThroughOccluderCheckInterval && Application.isPlaying && occlusionData.occlusionRenderFrame != frameCount) return occlusionData.lastOcclusionTestResult;
occlusionData.cachedOccluders.Clear();
occlusionData.cachedOccluderCollider = null;
if (rms == null || rms.Length == 0 || rms[0].renderer == null) return false;
occlusionData.checkLastTime = now;
occlusionData.occlusionRenderFrame = frameCount;
Vector3 camPos = cam.transform.position;
if (seeThroughOccluderCheckIndividualObjects) {
for (int r = 0; r < rms.Length; r++) {
if (rms[r].renderer != null) {
Bounds bounds = rms[r].renderer.bounds;
Vector3 pos = bounds.center;
float maxDistance = Vector3.Distance(pos, camPos);
if (Physics.BoxCast(pos, bounds.extents * seeThroughOccluderThreshold, (camPos - pos).normalized, out RaycastHit hitInfo, Quaternion.identity, maxDistance, seeThroughOccluderMask)) {
occlusionData.cachedOccluderCollider = hitInfo.collider;
occlusionData.lastOcclusionTestResult = true;
return true;
}
}
}
occlusionData.lastOcclusionTestResult = false;
return false;
} else {
// Compute combined bounds
Bounds bounds = rms[0].renderer.bounds;
for (int r = 1; r < rms.Length; r++) {
if (rms[r].renderer != null) {
bounds.Encapsulate(rms[r].renderer.bounds);
}
}
Vector3 pos = bounds.center;
float maxDistance = Vector3.Distance(pos, camPos);
occlusionData.lastOcclusionTestResult = Physics.BoxCast(pos, bounds.extents * seeThroughOccluderThreshold, (camPos - pos).normalized, out RaycastHit hitInfo, Quaternion.identity, maxDistance, seeThroughOccluderMask);
occlusionData.cachedOccluderCollider = hitInfo.collider;
return occlusionData.lastOcclusionTestResult;
}
}
const int MAX_OCCLUDER_HITS = 50;
static RaycastHit[] occluderHits;
void AddWithoutRepetition(List<Renderer> target, List<Renderer> source, LayerMask layerMask) {
int sourceCount = source.Count;
for (int k = 0; k < sourceCount; k++) {
Renderer entry = source[k];
if (entry != null && !target.Contains(entry) && ValidRenderer(entry) && ((1<<entry.gameObject.layer) & layerMask) != 0) {
target.Add(entry);
}
}
}
void CheckOcclusionAccurate(CommandBuffer cbuf, Camera cam) {
if (!perCameraOcclusionData.TryGetValue(cam, out PerCameraOcclusionData occlusionData)) {
occlusionData = new PerCameraOcclusionData();
perCameraOcclusionData[cam] = occlusionData;
}
float now = GetTime();
int frameCount = Time.frameCount; // ensure all cameras are checked this frame
bool reuse = now - occlusionData.checkLastTime < seeThroughOccluderCheckInterval && Application.isPlaying && occlusionData.occlusionRenderFrame != frameCount;
if (!reuse) {
occlusionData.cachedOccluders.Clear();
occlusionData.cachedOccluderCollider = null;
if (rms == null || rms.Length == 0 || rms[0].renderer == null) return;
occlusionData.checkLastTime = now;
occlusionData.occlusionRenderFrame = frameCount;
Quaternion quaternionIdentity = Quaternion.identity;
Vector3 camPos = cam.transform.position;
if (occluderHits == null || occluderHits.Length < MAX_OCCLUDER_HITS) {
occluderHits = new RaycastHit[MAX_OCCLUDER_HITS];
}
if (seeThroughOccluderCheckIndividualObjects) {
for (int r = 0; r < rms.Length; r++) {
if (rms[r].renderer != null) {
Bounds bounds = rms[r].renderer.bounds;
Vector3 pos = bounds.center;
float maxDistance = Vector3.Distance(pos, camPos);
int numOccluderHits = Physics.BoxCastNonAlloc(pos, bounds.extents * seeThroughOccluderThreshold, (camPos - pos).normalized, occluderHits, quaternionIdentity, maxDistance, seeThroughOccluderMask);
for (int k = 0; k < numOccluderHits; k++) {
occluderHits[k].collider.transform.root.GetComponentsInChildren(tempRR);
AddWithoutRepetition(occlusionData.cachedOccluders, tempRR, seeThroughOccluderMask);
}
}
}
} else {
// Compute combined bounds
Bounds bounds = rms[0].renderer.bounds;
for (int r = 1; r < rms.Length; r++) {
if (rms[r].renderer != null) {
bounds.Encapsulate(rms[r].renderer.bounds);
}
}
Vector3 pos = bounds.center;
float maxDistance = Vector3.Distance(pos, camPos);
int numOccluderHits = Physics.BoxCastNonAlloc(pos, bounds.extents * seeThroughOccluderThreshold, (camPos - pos).normalized, occluderHits, quaternionIdentity, maxDistance, seeThroughOccluderMask);
for (int k = 0; k < numOccluderHits; k++) {
occluderHits[k].collider.transform.root.GetComponentsInChildren(tempRR);
AddWithoutRepetition(occlusionData.cachedOccluders, tempRR, seeThroughOccluderMask);
}
}
}
// render occluders
int occluderRenderersCount = occlusionData.cachedOccluders.Count;
if (occluderRenderersCount > 0) {
for (int k = 0; k < occluderRenderersCount; k++) {
Renderer r = occlusionData.cachedOccluders[k];
if (r != null) {
cbuf.DrawRenderer(r, fxMatSeeThroughMask);
}
}
}
}
public void GetOccluders(Camera camera, List<Transform> occluders) {
occluders.Clear();
if (perCameraOcclusionData.TryGetValue(camera, out PerCameraOcclusionData occlusionData)) {
if (occlusionData.cachedOccluderCollider != null) {
occluders.Add(occlusionData.cachedOccluderCollider.transform);
return;
}
foreach (Renderer r in occlusionData.cachedOccluders) {
if (r != null) {
occluders.Add(r.transform);
}
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d0bc1f04199a64e66ae9630062b3a6ad
timeCreated: 1542876337
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,476 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
namespace HighlightPlus {
[RequireComponent(typeof(HighlightEffect))]
[DefaultExecutionOrder(100)]
[HelpURL("https://kronnect.com/guides/highlight-plus-introduction/")]
public class HighlightManager : MonoBehaviour {
[Tooltip("Enables highlight when pointer is over this object.")]
[SerializeField]
bool _highlightOnHover = true;
public bool highlightOnHover {
get { return _highlightOnHover; }
set {
if (_highlightOnHover != value) {
_highlightOnHover = value;
if (!_highlightOnHover) {
if (currentEffect != null) {
Highlight(false);
}
}
}
}
}
public LayerMask layerMask = -1;
public Camera raycastCamera;
public RayCastSource raycastSource = RayCastSource.MousePosition;
[Tooltip("Minimum distance for target.")]
public float minDistance;
[Tooltip("Maximum distance for target. 0 = infinity")]
public float maxDistance;
[Tooltip("Blocks interaction if pointer is over an UI element")]
public bool respectUI = true;
[Tooltip("If the object will be selected by clicking with mouse or tapping on it.")]
public bool selectOnClick;
[Tooltip("Optional profile for objects selected by clicking on them")]
public HighlightProfile selectedProfile;
[Tooltip("Profile to use whtn object is selected and highlighted.")]
public HighlightProfile selectedAndHighlightedProfile;
[Tooltip("Automatically deselects other previously selected objects")]
public bool singleSelection;
[Tooltip("Toggles selection on/off when clicking object")]
public bool toggle;
[Tooltip("Keeps current selection when clicking outside of any selectable object")]
public bool keepSelection = true;
HighlightEffect baseEffect, currentEffect;
Transform currentObject;
RaycastHit2D[] hitInfo2D;
public readonly static List<HighlightEffect> selectedObjects = new List<HighlightEffect>();
public event OnObjectSelectionEvent OnObjectSelected;
public event OnObjectSelectionEvent OnObjectUnSelected;
public event OnObjectHighlightEvent OnObjectHighlightStart;
public event OnObjectHighlightEvent OnObjectHighlightStay;
public event OnObjectHighlightEvent OnObjectHighlightEnd;
public static int lastTriggerFrame;
static HighlightManager _instance;
public static HighlightManager instance {
get {
if (_instance == null) {
_instance = Misc.FindObjectOfType<HighlightManager>();
}
return _instance;
}
}
[RuntimeInitializeOnLoadMethod]
static void DomainReloadDisabledSupport () {
selectedObjects.Clear();
lastTriggerFrame = 0;
_instance = null;
}
void OnEnable () {
currentObject = null;
currentEffect = null;
if (baseEffect == null) {
baseEffect = GetComponent<HighlightEffect>();
if (baseEffect == null) {
baseEffect = gameObject.AddComponent<HighlightEffect>();
}
}
if (raycastCamera == null) {
raycastCamera = GetCamera();
if (raycastCamera == null) {
Debug.LogError("Highlight Manager: no camera found!");
}
}
hitInfo2D = new RaycastHit2D[1];
InputProxy.Init();
}
void OnDisable () {
SwitchesObject(null);
internal_DeselectAll();
}
void Update () {
if (raycastCamera == null)
return;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
if (respectUI) {
EventSystem es = EventSystem.current;
if (es == null) {
es = CreateEventSystem();
}
List<RaycastResult> raycastResults = new List<RaycastResult>();
PointerEventData eventData = new PointerEventData(es);
Vector3 cameraPos = raycastCamera.transform.position;
if (raycastSource == RayCastSource.MousePosition) {
eventData.position = InputProxy.mousePosition;
} else {
eventData.position = new Vector2(raycastCamera.pixelWidth * 0.5f, raycastCamera.pixelHeight * 0.5f);
}
es.RaycastAll(eventData, raycastResults);
int hitCount = raycastResults.Count;
// check UI blocker
bool blocked = false;
for (int k = 0; k < hitCount; k++) {
RaycastResult rr = raycastResults[k];
if (rr.module is UnityEngine.UI.GraphicRaycaster) {
blocked = true;
break;
}
}
if (blocked) return;
// look for our gameobject
for (int k = 0; k < hitCount; k++) {
RaycastResult rr = raycastResults[k];
float distance = Vector3.Distance(rr.worldPosition, cameraPos);
if (distance < minDistance || (maxDistance > 0 && distance > maxDistance)) continue;
GameObject theGameObject = rr.gameObject;
if ((layerMask & (1 << rr.gameObject.layer)) == 0) continue;
// is this object state controller by Highlight Trigger?
HighlightTrigger trigger = theGameObject.GetComponent<HighlightTrigger>();
if (trigger != null) return;
// Toggles selection
Transform t = theGameObject.transform;
if (InputProxy.GetMouseButtonDown(0)) {
if (selectOnClick) {
ToggleSelection(t, !toggle);
}
} else {
// Check if the object has a Highlight Effect
if (t != currentObject) {
SwitchesObject(t);
}
}
return;
}
}
// if not blocked by UI and no hit found, fallback to raycast (required if no PhysicsRaycaster is present on the camera)
#endif
Ray ray;
if (raycastSource == RayCastSource.MousePosition) {
#if !(ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER)
if (!CanInteract()) {
return;
}
#endif
ray = raycastCamera.ScreenPointToRay(InputProxy.mousePosition);
} else {
ray = new Ray(raycastCamera.transform.position, raycastCamera.transform.forward);
}
VerifyHighlightStay();
RaycastHit hitInfo;
if (Physics.Raycast(ray, out hitInfo, maxDistance > 0 ? maxDistance : raycastCamera.farClipPlane, layerMask) && Vector3.Distance(hitInfo.point, ray.origin) >= minDistance) {
Transform t = hitInfo.collider.transform;
// is this object state controller by Highlight Trigger?
HighlightTrigger trigger = t.GetComponent<HighlightTrigger>();
if (trigger != null) return;
// Toggles selection
if (InputProxy.GetMouseButtonDown(0)) {
if (selectOnClick) {
ToggleSelection(t, !toggle);
}
}
else {
// Check if the object has a Highlight Effect
if (t != currentObject) {
SwitchesObject(t);
}
}
return;
}
else // check sprites
if (Physics2D.GetRayIntersectionNonAlloc(ray, hitInfo2D, maxDistance > 0 ? maxDistance : raycastCamera.farClipPlane, layerMask) > 0 && Vector3.Distance(hitInfo2D[0].point, ray.origin) >= minDistance) {
Transform t = hitInfo2D[0].collider.transform;
// is this object state controller by Highlight Trigger?
HighlightTrigger trigger = t.GetComponent<HighlightTrigger>();
if (trigger != null) return;
// Toggles selection
if (InputProxy.GetMouseButtonDown(0)) {
if (selectOnClick) {
ToggleSelection(t, !toggle);
}
}
else {
// Check if the object has a Highlight Effect
if (t != currentObject) {
SwitchesObject(t);
}
}
return;
}
// no hit
if (selectOnClick && !keepSelection && InputProxy.GetMouseButtonDown(0) && lastTriggerFrame < Time.frameCount) {
internal_DeselectAll();
}
SwitchesObject(null);
}
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
EventSystem CreateEventSystem() {
GameObject eo = new GameObject("Event System created by Highlight Plus", typeof(EventSystem), typeof(UnityEngine.InputSystem.UI.InputSystemUIInputModule));
return eo.GetComponent<EventSystem>();
}
#endif
void VerifyHighlightStay () {
if (currentObject == null || currentEffect == null || !currentEffect.highlighted) return;
if (OnObjectHighlightStay != null && !OnObjectHighlightStay(currentObject.gameObject)) {
SwitchesObject(null);
}
}
void SwitchesObject (Transform newObject) {
if (currentEffect != null) {
if (highlightOnHover) {
Highlight(false);
}
currentEffect = null;
}
currentObject = newObject;
if (newObject == null) return;
HighlightTrigger ht = newObject.GetComponent<HighlightTrigger>();
if (ht != null && ht.enabled)
return;
HighlightEffect otherEffect = newObject.GetComponent<HighlightEffect>();
if (otherEffect == null) {
// Check if there's a parent highlight effect that includes this object
HighlightEffect parentEffect = newObject.GetComponentInParent<HighlightEffect>();
if (parentEffect != null && parentEffect.Includes(newObject)) {
currentEffect = parentEffect;
if (highlightOnHover) {
Highlight(true);
}
return;
}
}
currentEffect = otherEffect != null ? otherEffect : baseEffect;
baseEffect.enabled = currentEffect == baseEffect;
currentEffect.SetTarget(currentObject);
if (highlightOnHover) {
Highlight(true);
}
}
#if !(ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER)
bool CanInteract() {
if (!respectUI) return true;
EventSystem es = EventSystem.current;
if (es == null) return true;
if (Application.isMobilePlatform && InputProxy.touchCount > 0 && es.IsPointerOverGameObject(InputProxy.GetFingerIdFromTouch(0))) {
return false;
} else if (es.IsPointerOverGameObject(-1))
return false;
return true;
}
#endif
void ToggleSelection (Transform t, bool forceSelection) {
// We need a highlight effect on each selected object
HighlightEffect hb = t.GetComponent<HighlightEffect>();
if (hb == null) {
HighlightEffect parentEffect = t.GetComponentInParent<HighlightEffect>();
if (parentEffect != null && parentEffect.Includes(t)) {
hb = parentEffect;
if (hb.previousSettings == null) {
hb.previousSettings = ScriptableObject.CreateInstance<HighlightProfile>();
}
hb.previousSettings.Save(hb);
}
else {
hb = t.gameObject.AddComponent<HighlightEffect>();
hb.previousSettings = ScriptableObject.CreateInstance<HighlightProfile>();
// copy default highlight effect settings from this manager into this highlight plus component
hb.previousSettings.Save(baseEffect);
hb.previousSettings.Load(hb);
}
}
bool currentState = hb.isSelected;
bool newState = forceSelection ? true : !currentState;
if (newState == currentState) return;
if (newState) {
if (OnObjectSelected != null && !OnObjectSelected(t.gameObject)) return;
}
else {
if (OnObjectUnSelected != null && !OnObjectUnSelected(t.gameObject)) return;
}
if (singleSelection) {
internal_DeselectAll();
}
currentEffect = hb;
currentEffect.isSelected = newState;
baseEffect.enabled = false;
if (currentEffect.isSelected) {
if (currentEffect.previousSettings == null) {
currentEffect.previousSettings = ScriptableObject.CreateInstance<HighlightProfile>();
}
hb.previousSettings.Save(hb);
if (!selectedObjects.Contains(currentEffect)) {
selectedObjects.Add(currentEffect);
}
}
else {
if (currentEffect.previousSettings != null) {
currentEffect.previousSettings.Load(hb);
}
if (selectedObjects.Contains(currentEffect)) {
selectedObjects.Remove(currentEffect);
}
}
Highlight(newState);
}
void Highlight (bool state) {
if (currentEffect == null) return;
if (state) {
if (!currentEffect.highlighted) {
if (OnObjectHighlightStart != null && currentEffect.target != null) {
if (!OnObjectHighlightStart(currentEffect.target.gameObject)) {
currentObject = null; // allows re-checking so it keeps checking with the event
return;
}
}
}
}
else {
if (currentEffect.highlighted) {
if (OnObjectHighlightEnd != null && currentEffect.target != null) {
OnObjectHighlightEnd(currentEffect.target.gameObject);
}
}
}
if (selectOnClick || currentEffect.isSelected) {
if (currentEffect.isSelected) {
if (state && selectedAndHighlightedProfile != null) {
selectedAndHighlightedProfile.Load(currentEffect);
}
else if (selectedProfile != null) {
selectedProfile.Load(currentEffect);
}
else {
currentEffect.previousSettings.Load(currentEffect);
}
if (currentEffect.highlighted && currentEffect.fading != HighlightEffect.FadingState.FadingOut) {
currentEffect.UpdateMaterialProperties();
}
else {
currentEffect.SetHighlighted(true);
}
return;
}
else if (!highlightOnHover) {
currentEffect.SetHighlighted(false);
return;
}
}
currentEffect.SetHighlighted(state);
}
public static Camera GetCamera () {
Camera raycastCamera = Camera.main;
if (raycastCamera == null) {
raycastCamera = Misc.FindObjectOfType<Camera>();
}
return raycastCamera;
}
void internal_DeselectAll () {
foreach (HighlightEffect hb in selectedObjects) {
if (hb != null && hb.gameObject != null) {
if (OnObjectUnSelected != null) {
if (!OnObjectUnSelected(hb.gameObject)) continue;
}
hb.RestorePreviousHighlightEffectSettings();
hb.isSelected = false;
hb.SetHighlighted(false);
}
}
selectedObjects.Clear();
}
/// <summary>
/// Deselects any selected object in the scene
/// </summary>
public static void DeselectAll () {
if (instance != null) {
_instance.internal_DeselectAll();
return;
}
foreach (HighlightEffect hb in selectedObjects) {
if (hb != null && hb.gameObject != null) {
hb.RestorePreviousHighlightEffectSettings();
hb.isSelected = false;
hb.SetHighlighted(false);
}
}
selectedObjects.Clear();
}
/// <summary>
/// Manually causes highlight manager to select an object
/// </summary>
public void SelectObject (Transform t) {
ToggleSelection(t, true);
}
/// <summary>
/// Manually causes highlight manager to toggle selection on an object
/// </summary>
public void ToggleObject (Transform t) {
ToggleSelection(t, false);
}
/// <summary>
/// Manually causes highlight manager to unselect an object
/// </summary>
public void UnselectObject (Transform t) {
if (t == null) return;
HighlightEffect hb = t.GetComponent<HighlightEffect>();
if (hb == null) return;
if (hb.isSelected) {
ToggleSelection(t, false);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: af4d46fd89b9543e5be2358ac0c9ced0
timeCreated: 1542876337
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
{
"name": "HighlightPlus",
"rootNamespace": "",
"references": [
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:df380645f10b7bc4b97d4f5eb6303d95"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 21f2291e6889b15478ccb0ee25050878
guid: 6fa512e17c315dd428ad692183dd0e8c
AssemblyDefinitionImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,287 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
#if UNITY_2023_3_OR_NEWER
using UnityEngine.Rendering.RenderGraphModule;
#endif
namespace HighlightPlus {
public class HighlightPlusRenderPassFeature : ScriptableRendererFeature {
class HighlightPass : ScriptableRenderPass {
class PassData {
public Camera camera;
#if UNITY_2022_1_OR_NEWER
public RTHandle colorTarget, depthTarget;
#else
public RenderTargetIdentifier colorTarget, depthTarget;
#endif
#if UNITY_2023_3_OR_NEWER
public TextureHandle colorTexture, depthTexture;
#endif
public bool clearStencil;
public CommandBuffer cmd;
}
readonly PassData passData = new PassData();
// far objects render first
class DistanceComparer : IComparer<HighlightEffect> {
public Vector3 camPos;
public int Compare (HighlightEffect e1, HighlightEffect e2) {
if (e1.sortingPriority < e2.sortingPriority) return -1;
if (e1.sortingPriority > e2.sortingPriority) return 1;
Vector3 e1Pos = e1.transform.position;
float dx1 = e1Pos.x - camPos.x;
float dy1 = e1Pos.y - camPos.y;
float dz1 = e1Pos.z - camPos.z;
float distE1 = dx1 * dx1 + dy1 * dy1 + dz1 * dz1 + e1.sortingOffset;
Vector3 e2Pos = e2.transform.position;
float dx2 = e2Pos.x - camPos.x;
float dy2 = e2Pos.y - camPos.y;
float dz2 = e2Pos.z - camPos.z;
float distE2 = dx2 * dx2 + dy2 * dy2 + dz2 * dz2 + e2.sortingOffset;
if (distE1 > distE2) return -1;
if (distE1 < distE2) return 1;
return 0;
}
}
public bool usesCameraOverlay;
ScriptableRenderer renderer;
RenderTextureDescriptor cameraTextureDescriptor;
static DistanceComparer effectDistanceComparer = new DistanceComparer();
bool clearStencil;
static RenderTextureDescriptor sourceDesc;
static Material blockerOutlineAndGlowMat, blockerOverlayMat, blockerAllMat;
public void Setup (HighlightPlusRenderPassFeature passFeature, ScriptableRenderer renderer) {
this.renderPassEvent = passFeature.renderPassEvent;
this.clearStencil = passFeature.clearStencil;
this.renderer = renderer;
ConfigureInput(ScriptableRenderPassInput.Depth);
}
#if UNITY_2023_3_OR_NEWER
[Obsolete]
#endif
public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) {
this.cameraTextureDescriptor = cameraTextureDescriptor;
}
#if UNITY_2023_3_OR_NEWER
[Obsolete]
#endif
public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) {
#if UNITY_2022_1_OR_NEWER
RTHandle cameraColorTarget = renderer.cameraColorTargetHandle;
RTHandle cameraDepthTarget = renderer.cameraDepthTargetHandle;
#else
RenderTargetIdentifier cameraColorTarget = renderer.cameraColorTarget;
RenderTargetIdentifier cameraDepthTarget = renderer.cameraDepthTarget;
#endif
#if !UNITY_2021_2_OR_NEWER
// In Unity 2021.2, when MSAA > 1, cameraDepthTarget is no longer cameraColorTarget
if (!usesCameraOverlay && (cameraTextureDescriptor.msaaSamples > 1 || cam.cameraType == CameraType.SceneView)) {
cameraDepthTarget = cameraColorTarget;
}
#endif
passData.clearStencil = clearStencil;
passData.camera = renderingData.cameraData.camera;
passData.colorTarget = cameraColorTarget;
passData.depthTarget = cameraDepthTarget;
sourceDesc = renderingData.cameraData.cameraTargetDescriptor;
CommandBuffer cmd = CommandBufferPool.Get("Highlight Plus");
cmd.Clear();
passData.cmd = cmd;
ExecutePass(passData);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
static void ExecutePass (PassData passData) {
int count = HighlightEffect.effects.Count;
HighlightEffect.effects.RemoveAll(t => t == null);
count = HighlightEffect.effects.Count;
if (count == 0) return;
Camera cam = passData.camera;
int camLayer = 1 << cam.gameObject.layer;
CameraType camType = cam.cameraType;
if (!HighlightEffect.customSorting && ((camType == CameraType.Game && (sortFrameCount++) % 10 == 0) || !Application.isPlaying)) {
effectDistanceComparer.camPos = cam.transform.position;
HighlightEffect.effects.Sort(effectDistanceComparer);
}
bool outlineOccludersPending = outlineAndGlowOccluders.Count > 0;
for (int k = 0; k < count; k++) {
HighlightEffect effect = HighlightEffect.effects[k];
if (!(effect.ignoreObjectVisibility || effect.isVisible)) continue;
if (!effect.isActiveAndEnabled) continue;
if (camType == CameraType.Reflection && !effect.reflectionProbes) continue;
if ((effect.camerasLayerMask & camLayer) == 0) continue;
if (outlineOccludersPending) {
outlineOccludersPending = false;
foreach (HighlightEffectBlocker blocker in outlineAndGlowOccluders) {
if (blocker != null && blocker.isActiveAndEnabled) {
int stencilOp = 0;
if (blocker.blockOutlineAndGlow) stencilOp += 2;
if (blocker.blockOverlay) stencilOp += 4;
if (stencilOp == 2) {
if (blockerOutlineAndGlowMat == null) {
blockerOutlineAndGlowMat = Resources.Load<Material>("HighlightPlus/HighlightBlockerOutlineAndGlow");
}
blocker.BuildCommandBuffer(passData.cmd, blockerOutlineAndGlowMat);
}
else if (stencilOp == 4) {
if (blockerOverlayMat == null) {
blockerOverlayMat = Resources.Load<Material>("HighlightPlus/HighlightBlockerOverlay");
}
blocker.BuildCommandBuffer(passData.cmd, blockerOverlayMat);
}
else if (stencilOp == 6) {
if (blockerAllMat == null) {
blockerAllMat = Resources.Load<Material>("HighlightPlus/HighlightUIMask");
}
blocker.BuildCommandBuffer(passData.cmd, blockerAllMat);
}
}
}
}
effect.SetCommandBuffer(passData.cmd);
effect.BuildCommandBuffer(passData.camera, passData.colorTarget, passData.depthTarget, passData.clearStencil, ref sourceDesc);
passData.clearStencil = false;
}
}
#if UNITY_2023_3_OR_NEWER
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) {
using (var builder = renderGraph.AddUnsafePass<PassData>("Highlight Plus Pass RG", out var passData)) {
builder.AllowPassCulling(false);
passData.clearStencil = clearStencil;
UniversalCameraData cameraData = frameData.Get<UniversalCameraData>();
passData.camera = cameraData.camera;
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
passData.colorTexture = resourceData.activeColorTexture;
passData.depthTexture = resourceData.activeDepthTexture;
builder.UseTexture(resourceData.activeColorTexture, AccessFlags.ReadWrite);
builder.UseTexture(resourceData.activeDepthTexture, AccessFlags.Read);
builder.UseTexture(resourceData.cameraDepthTexture, AccessFlags.Read);
sourceDesc = cameraData.cameraTargetDescriptor;
builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => {
CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd);
passData.cmd = cmd;
passData.colorTarget = passData.colorTexture;
passData.depthTarget = passData.depthTexture;
ExecutePass(passData);
});
}
}
#endif
}
HighlightPass renderPass;
public RenderPassEvent renderPassEvent = RenderPassEvent.AfterRenderingTransparents;
[Tooltip("Clears stencil buffer before rendering highlight effects. This option can solve compatibility issues with shaders that also use stencil buffers.")]
public bool clearStencil;
/// <summary>
/// Makes the effects visible in Edit mode.
/// </summary>
[Tooltip("If enabled, effects will be visible also in Edit mode (when not in Play mode).")]
public bool previewInEditMode = true;
/// <summary>
/// Makes the effects visible in Edit mode.
/// </summary>
[Tooltip("If enabled, effects will be visible also in Preview camera (preview camera shown when a camera is selected in Editor).")]
public bool showInPreviewCamera = true;
public static bool installed;
public static bool showingInEditMode;
public static List<HighlightEffectBlocker> outlineAndGlowOccluders = new List<HighlightEffectBlocker>();
public static int sortFrameCount;
const string PREVIEW_CAMERA_NAME = "Preview Camera";
void OnDisable () {
installed = false;
}
public override void Create () {
renderPass = new HighlightPass();
VRCheck.Init();
}
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses (ScriptableRenderer renderer, ref RenderingData renderingData) {
if (HighlightEffect.effects.Count == 0) return;
showingInEditMode = previewInEditMode;
Camera cam = renderingData.cameraData.camera;
#if UNITY_EDITOR
if (!previewInEditMode && !Application.isPlaying) {
return;
}
if (cam.cameraType == CameraType.Preview) {
return;
}
if (!showInPreviewCamera && PREVIEW_CAMERA_NAME.Equals(cam.name)) {
return;
}
#endif
#if UNITY_2019_4_OR_NEWER
if (renderingData.cameraData.renderType == CameraRenderType.Base) {
renderPass.usesCameraOverlay = cam.GetUniversalAdditionalCameraData().cameraStack.Count > 0;
}
#endif
renderPass.Setup(this, renderer);
renderer.EnqueuePass(renderPass);
installed = true;
}
public static void RegisterBlocker (HighlightEffectBlocker occluder) {
if (!outlineAndGlowOccluders.Contains(occluder)) {
outlineAndGlowOccluders.Add(occluder);
}
}
public static void UnregisterBlocker (HighlightEffectBlocker occluder) {
outlineAndGlowOccluders.Remove(occluder);
}
}
}

Some files were not shown because too many files have changed in this diff Show More