feat: highlight plus

This commit is contained in:
hypercross 2025-08-28 14:56:06 +08:00
parent a930ba8503
commit 4eb764dc34
118 changed files with 14519 additions and 0 deletions

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c1cfaabf0583f44b4871807a898aaf31
folderAsset: yes
timeCreated: 1542886534
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEditor;
using UnityEngine;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightEffectBlocker))]
public class HighlightEffectBlockerEditor : Editor {
SerializedProperty include, layerMask, blockOutlineAndGlow, blockOverlay, nameFilter, useRegEx;
HighlightEffectBlocker hb;
void OnEnable() {
include = serializedObject.FindProperty("include");
layerMask = serializedObject.FindProperty("layerMask");
nameFilter = serializedObject.FindProperty("nameFilter");
useRegEx = serializedObject.FindProperty("useRegEx");
blockOutlineAndGlow = serializedObject.FindProperty("blockOutlineAndGlow");
blockOverlay = serializedObject.FindProperty("blockOverlay");
hb = (HighlightEffectBlocker)target;
}
public override void OnInspectorGUI() {
serializedObject.Update();
EditorGUILayout.PropertyField(include);
if (include.intValue == (int)BlockerTargetOptions.LayerInChildren) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(layerMask);
EditorGUI.indentLevel--;
}
if (include.intValue != (int)BlockerTargetOptions.OnlyThisObject) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(nameFilter, new GUIContent("Object Name Filter"));
EditorGUILayout.PropertyField(useRegEx, new GUIContent("Use Regular Expressions"));
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(blockOutlineAndGlow);
EditorGUILayout.PropertyField(blockOverlay);
if (serializedObject.ApplyModifiedProperties()) {
hb.Refresh();
}
}
}
}

View File

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

File diff suppressed because it is too large Load Diff

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,77 @@
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, unhighlightOnUI;
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");
unhighlightOnUI = serializedObject.FindProperty("unhighlightOnUI");
}
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);
if (respectUI.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(unhighlightOnUI);
EditorGUI.indentLevel--;
}
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,605 @@
using UnityEditor;
using UnityEngine;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightProfile))]
[CanEditMultipleObjects]
public class HighlightProfileEditor : UnityEditor.Editor {
SerializedProperty effectGroup, effectGroupLayer, effectNameFilter, effectNameUseRegEx, combineMeshes, alphaCutOff, cullBackFaces;
SerializedProperty overlay, overlayMode, overlayColor, overlayAnimationSpeed, overlayMinIntensity, overlayTexture, overlayTextureScale, overlayTextureScrolling, overlayTextureUVSpace, overlayBlending, overlayVisibility;
SerializedProperty overlayPattern, overlayPatternScrolling, overlayPatternScale, overlayPatternSize, overlayPatternSoftness, overlayPatternRotation;
SerializedProperty fadeInDuration, fadeOutDuration, constantWidth, normalsOption, minimumWidth, extraCoveragePixels;
SerializedProperty outline, outlineColor, outlineColorStyle, outlineGradient, outlineGradientInLocalSpace, outlineGradientKnee, outlineGradientPower;
SerializedProperty outlineWidth, outlineBlurPasses, outlineQuality, outlineEdgeMode, outlineEdgeThreshold, outlineSharpness, padding;
SerializedProperty outlineDownsampling, outlineVisibility, outlineIndependent, outlineContourStyle, outlineMaskMode;
SerializedProperty outlineStylized, outlinePattern, outlinePatternScale, outlinePatternThreshold, outlinePatternDistortionAmount, outlinePatternStopMotionScale;
SerializedProperty outlinePatternDistortionTexture;
SerializedProperty outlineDashed, outlineDashWidth, outlineDashGap, outlineDashSpeed;
SerializedProperty outlineDistanceScaleBias;
SerializedProperty glow, glowWidth, glowQuality, glowBlurMethod, glowDownsampling, glowHQColor, glowDithering, glowDitheringStyle, glowMagicNumber1, glowMagicNumber2, glowAnimationSpeed, glowDistanceScaleBias;
SerializedProperty glowBlendPasses, glowVisibility, glowBlendMode, glowPasses, glowMaskMode, glowHighPrecision;
SerializedProperty innerGlow, innerGlowWidth, innerGlowColor, innerGlowBlendMode, innerGlowVisibility, innerGlowPower;
SerializedProperty targetFX, targetFXTexture, targetFXColor, targetFXRotationSpeed, targetFXInitialScale, targetFXEndScale, targetFXScaleToRenderBounds, targetFXUseEnclosingBounds, targetFXSquare, targetFXOffset;
SerializedProperty targetFXAlignToGround, targetFXFadePower, targetFXGroundMaxDistance, targetFXGroundLayerMask, targetFXTransitionDuration, targetFXStayDuration, targetFXVisibility;
SerializedProperty targetFXStyle, targetFXFrameWidth, targetFXCornerLength, targetFXFrameMinOpacity, targetFXGroundMinAltitude;
SerializedProperty targetFXRotationAngle, targetFxCenterOnHitPosition, targetFxAlignToNormal;
SerializedProperty iconFX, iconFXAssetType, iconFXPrefab, 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, hitFXTriggerMode;
SerializedProperty cameraDistanceFade, cameraDistanceFadeNear, cameraDistanceFadeFar;
SerializedProperty labelEnabled, labelText, labelColor, labelPrefab, labelVerticalOffset, lineLength, labelFollowCursor;
SerializedProperty labelTextSize, labelMode, labelAlignment, labelShowInEditorMode;
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");
normalsOption = serializedObject.FindProperty("normalsOption");
fadeInDuration = serializedObject.FindProperty("fadeInDuration");
fadeOutDuration = serializedObject.FindProperty("fadeOutDuration");
constantWidth = serializedObject.FindProperty("constantWidth");
extraCoveragePixels = serializedObject.FindProperty("extraCoveragePixels");
minimumWidth = serializedObject.FindProperty("minimumWidth");
padding = serializedObject.FindProperty("padding");
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");
overlayPattern = serializedObject.FindProperty("overlayPattern");
overlayPatternScrolling = serializedObject.FindProperty("overlayPatternScrolling");
overlayPatternScale = serializedObject.FindProperty("overlayPatternScale");
overlayPatternSize = serializedObject.FindProperty("overlayPatternSize");
overlayPatternSoftness = serializedObject.FindProperty("overlayPatternSoftness");
overlayPatternRotation = serializedObject.FindProperty("overlayPatternRotation");
outline = serializedObject.FindProperty("outline");
outlineColor = serializedObject.FindProperty("outlineColor");
outlineColorStyle = serializedObject.FindProperty("outlineColorStyle");
outlineGradient = serializedObject.FindProperty("outlineGradient");
outlineGradientInLocalSpace = serializedObject.FindProperty("outlineGradientInLocalSpace");
outlineGradientKnee = serializedObject.FindProperty("outlineGradientKnee");
outlineGradientPower = serializedObject.FindProperty("outlineGradientPower");
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");
outlineStylized = serializedObject.FindProperty("outlineStylized");
outlinePattern = serializedObject.FindProperty("outlinePattern");
outlinePatternScale = serializedObject.FindProperty("outlinePatternScale");
outlinePatternThreshold = serializedObject.FindProperty("outlinePatternThreshold");
outlinePatternDistortionAmount = serializedObject.FindProperty("outlinePatternDistortionAmount");
outlinePatternStopMotionScale = serializedObject.FindProperty("outlinePatternStopMotionScale");
outlinePatternDistortionTexture = serializedObject.FindProperty("outlinePatternDistortionTexture");
outlineDashed = serializedObject.FindProperty("outlineDashed");
outlineDashWidth = serializedObject.FindProperty("outlineDashWidth");
outlineDashGap = serializedObject.FindProperty("outlineDashGap");
outlineDashSpeed = serializedObject.FindProperty("outlineDashSpeed");
outlineDistanceScaleBias = serializedObject.FindProperty("outlineDistanceScaleBias");
glow = serializedObject.FindProperty("glow");
glowWidth = serializedObject.FindProperty("glowWidth");
glowQuality = serializedObject.FindProperty("glowQuality");
glowHighPrecision = serializedObject.FindProperty("glowHighPrecision");
glowBlurMethod = serializedObject.FindProperty("glowBlurMethod");
glowDownsampling = serializedObject.FindProperty("glowDownsampling");
glowHQColor = serializedObject.FindProperty("glowHQColor");
glowAnimationSpeed = serializedObject.FindProperty("glowAnimationSpeed");
glowDistanceScaleBias = serializedObject.FindProperty("glowDistanceScaleBias");
glowDithering = serializedObject.FindProperty("glowDithering");
glowDitheringStyle = serializedObject.FindProperty("glowDitheringStyle");
glowMagicNumber1 = serializedObject.FindProperty("glowMagicNumber1");
glowMagicNumber2 = serializedObject.FindProperty("glowMagicNumber2");
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");
innerGlowPower = serializedObject.FindProperty("innerGlowPower");
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");
targetFXSquare = serializedObject.FindProperty("targetFXSquare");
targetFXOffset = serializedObject.FindProperty("targetFXOffset");
targetFxCenterOnHitPosition = serializedObject.FindProperty("targetFxCenterOnHitPosition");
targetFxAlignToNormal = serializedObject.FindProperty("targetFxAlignToNormal");
targetFXAlignToGround = serializedObject.FindProperty("targetFXAlignToGround");
targetFXFadePower = serializedObject.FindProperty("targetFXFadePower");
targetFXColor = serializedObject.FindProperty("targetFXColor");
targetFXTransitionDuration = serializedObject.FindProperty("targetFXTransitionDuration");
targetFXStayDuration = serializedObject.FindProperty("targetFXStayDuration");
targetFXVisibility = serializedObject.FindProperty("targetFXVisibility");
targetFXStyle = serializedObject.FindProperty("targetFXStyle");
targetFXFrameWidth = serializedObject.FindProperty("targetFXFrameWidth");
targetFXCornerLength = serializedObject.FindProperty("targetFXCornerLength");
targetFXFrameMinOpacity = serializedObject.FindProperty("targetFXFrameMinOpacity");
targetFXRotationAngle = serializedObject.FindProperty("targetFXRotationAngle");
targetFXGroundMinAltitude = serializedObject.FindProperty("targetFXGroundMinAltitude");
targetFXGroundMaxDistance = serializedObject.FindProperty("targetFXGroundMaxDistance");
targetFXGroundLayerMask = serializedObject.FindProperty("targetFXGroundLayerMask");
iconFX = serializedObject.FindProperty("iconFX");
iconFXAssetType = serializedObject.FindProperty("iconFXAssetType");
iconFXPrefab = serializedObject.FindProperty("iconFXPrefab");
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");
hitFXTriggerMode = serializedObject.FindProperty("hitFXTriggerMode");
cameraDistanceFade = serializedObject.FindProperty("cameraDistanceFade");
cameraDistanceFadeNear = serializedObject.FindProperty("cameraDistanceFadeNear");
cameraDistanceFadeFar = serializedObject.FindProperty("cameraDistanceFadeFar");
labelEnabled = serializedObject.FindProperty("labelEnabled");
labelText = serializedObject.FindProperty("labelText");
labelTextSize = serializedObject.FindProperty("labelTextSize");
labelColor = serializedObject.FindProperty("labelColor");
labelPrefab = serializedObject.FindProperty("labelPrefab");
labelVerticalOffset = serializedObject.FindProperty("labelVerticalOffset");
lineLength = serializedObject.FindProperty("lineLength");
labelFollowCursor = serializedObject.FindProperty("labelFollowCursor");
labelMode = serializedObject.FindProperty("labelMode");
labelShowInEditorMode = serializedObject.FindProperty("labelShowInEditorMode");
labelAlignment = serializedObject.FindProperty("labelAlignment");
}
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(padding, new GUIContent("Padding"));
EditorGUILayout.PropertyField(cullBackFaces);
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(outlineBlurPasses, new GUIContent("Blur Passes"));
EditorGUILayout.PropertyField(outlineSharpness, new GUIContent("Sharpness"));
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(outlineGradientKnee, new GUIContent("Knee"));
EditorGUILayout.PropertyField(outlineGradientPower, new GUIContent("Power"));
EditorGUI.indentLevel--;
break;
}
}
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);
EditorGUILayout.PropertyField(outlineStylized, new GUIContent("Stylized Effect"));
if (outlineStylized.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(outlinePatternDistortionTexture, new GUIContent("Distortion Texture (R)", "Distortion texture for the stylized effect. Only red channel is used."));
if (outlinePatternDistortionTexture.objectReferenceValue != null) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(outlinePatternDistortionAmount, new GUIContent("Distortion Amount"));
EditorGUILayout.PropertyField(outlinePatternScale, new GUIContent("Scale"));
EditorGUILayout.PropertyField(outlinePatternStopMotionScale, new GUIContent("Stop Motion Speed"));
}
EditorGUILayout.PropertyField(outlinePattern, new GUIContent("Pattern (R)", "Pattern for the stylized effect. Only red channel is used."));
if (outlinePattern.objectReferenceValue != null) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(outlinePatternThreshold, new GUIContent("Threshold"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(outlineDashed, new GUIContent("Dashed Effect"));
if (outlineDashed.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(outlineDashWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(outlineDashGap, new GUIContent("Gap"));
EditorGUILayout.PropertyField(outlineDashSpeed, new GUIContent("Speed"));
EditorGUI.indentLevel--;
}
if (!constantWidth.boolValue) {
EditorGUILayout.PropertyField(outlineDistanceScaleBias, new GUIContent("Distance Scale Bias", "Controls how quickly the outline effect scales down with distance. Lower values make the effect fade faster with distance."));
}
}
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(glowHighPrecision, new GUIContent("High Precision"));
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"));
if (glowQuality.intValue == (int)QualityLevel.Highest && !constantWidth.boolValue) {
EditorGUILayout.PropertyField(glowDistanceScaleBias, new GUIContent("Distance Scale Bias", "Controls how quickly the glow effect scales down with distance. Lower values make the effect fade faster with distance."));
}
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(innerGlowPower, new GUIContent("Power"));
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(overlayTextureScale, new GUIContent("Scale"));
if ((TextureUVSpace)overlayTextureUVSpace.intValue != TextureUVSpace.Triplanar) {
EditorGUILayout.PropertyField(overlayTextureScrolling, new GUIContent("Scrolling"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(overlayTextureUVSpace, new GUIContent("UV Space"));
EditorGUILayout.PropertyField(overlayPattern, new GUIContent("Pattern"));
if ((HighlightPlus.OverlayPattern)overlayPattern.enumValueIndex != HighlightPlus.OverlayPattern.None) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(overlayPatternScrolling, new GUIContent("Scrolling"));
EditorGUILayout.PropertyField(overlayPatternScale, new GUIContent("Scale"));
EditorGUILayout.PropertyField(overlayPatternSize, new GUIContent("Size"));
EditorGUILayout.PropertyField(overlayPatternSoftness, new GUIContent("Softness"));
EditorGUILayout.PropertyField(overlayPatternRotation, new GUIContent("Rotation"));
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(targetFXStyle, new GUIContent("Style"));
if (targetFXStyle.intValue == (int)TargetFXStyle.Texture) {
EditorGUILayout.PropertyField(targetFXTexture, new GUIContent("Texture"));
}
else {
EditorGUILayout.PropertyField(targetFXFrameWidth, new GUIContent("Width"));
EditorGUILayout.PropertyField(targetFXCornerLength, new GUIContent("Length"));
EditorGUILayout.PropertyField(targetFXFrameMinOpacity, new GUIContent("Min Opacity"));
}
EditorGUILayout.PropertyField(targetFXColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(targetFXUseEnclosingBounds, new GUIContent("Use Enclosing Bounds"));
EditorGUILayout.PropertyField(targetFXOffset, new GUIContent("Offset"));
EditorGUILayout.PropertyField(targetFxCenterOnHitPosition, new GUIContent("Center On Hit Position"));
EditorGUILayout.PropertyField(targetFxAlignToNormal, new GUIContent("Align To Hit Normal"));
EditorGUILayout.PropertyField(targetFXRotationSpeed, new GUIContent("Rotation Speed"));
EditorGUILayout.PropertyField(targetFXRotationAngle, new GUIContent("Rotation Angle"));
EditorGUILayout.PropertyField(targetFXInitialScale, new GUIContent("Initial Scale"));
EditorGUILayout.PropertyField(targetFXEndScale, new GUIContent("End Scale"));
EditorGUILayout.PropertyField(targetFXScaleToRenderBounds, new GUIContent("Scale To Object Bounds"));
if (targetFXScaleToRenderBounds.boolValue) {
EditorGUILayout.PropertyField(targetFXSquare, new GUIContent("Square"));
}
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"));
EditorGUILayout.PropertyField(targetFXGroundMinAltitude, new GUIContent("Ground Min Altitude"));
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(iconFXAssetType, new GUIContent("Asset Type"));
if (iconFXAssetType.intValue == (int)IconAssetType.Mesh) {
EditorGUILayout.PropertyField(iconFXMesh, new GUIContent("Mesh"));
EditorGUILayout.PropertyField(iconFXLightColor, new GUIContent("Light Color"));
EditorGUILayout.PropertyField(iconFXDarkColor, new GUIContent("Dark Color"));
}
else {
EditorGUILayout.PropertyField(iconFXPrefab, new GUIContent("Prefab"));
}
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(hitFxMode, new GUIContent("Style"));
EditorGUILayout.PropertyField(hitFXTriggerMode, new GUIContent("Trigger 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();
EditorGUILayout.BeginVertical(GUI.skin.box);
DrawSectionField(labelEnabled, "Label", labelEnabled.boolValue);
if (labelEnabled.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(labelMode, new GUIContent("Mode"));
EditorGUILayout.PropertyField(labelShowInEditorMode, new GUIContent("Always Show In Editor Mode"));
EditorGUILayout.PropertyField(labelAlignment, new GUIContent("Alignment"));
EditorGUILayout.PropertyField(labelText, new GUIContent("Text"));
EditorGUILayout.PropertyField(labelTextSize, new GUIContent("Text Size"));
EditorGUILayout.PropertyField(labelColor, new GUIContent("Color"));
EditorGUILayout.PropertyField(labelPrefab, new GUIContent("Prefab", "The prefab to use for the label. Must contain a Canvas and TextMeshProUGUI component."));
EditorGUILayout.PropertyField(labelVerticalOffset, new GUIContent("Vertical Offset"));
EditorGUILayout.PropertyField(lineLength, new GUIContent("Line Length"));
EditorGUILayout.PropertyField(labelFollowCursor, new GUIContent("Follow Cursor"));
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,111 @@
using UnityEditor;
using UnityEngine;
namespace HighlightPlus {
[CustomEditor(typeof(HighlightTrigger))]
public class HighlightTriggerEditor : UnityEditor.Editor {
SerializedProperty highlightOnHover, triggerMode, raycastCamera, raycastSource, raycastLayerMask;
SerializedProperty minDistance, maxDistance, respectUI, unhighlightOnUI, 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");
unhighlightOnUI = serializedObject.FindProperty("unhighlightOnUI");
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 && !ENABLE_LEGACY_INPUT_MANAGER
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);
if (respectUI.boolValue) {
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(unhighlightOnUI);
EditorGUI.indentLevel--;
}
}
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,87 @@
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;
}
}
EditorUtility.DisplayDialog("Depth Support", "This object was not previously modified! Nothing to do.", "Ok");
}
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,486 @@
**************************************
* 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 32
- Added "Use Original Shader" option. This advanced option allows using glow/outline in highest quality using the original material shader and support advanced shaders with vertex transformations.
- Optimization: Outer Glow / Outline in highest quality now dynamically reduce the number of blur passes based on object distance when Constant Width option is disabled
- Highlight Effect Blocker: added options to include children
Version 31.0
- New demo scene "TargetClickExample": target over floor and objects and object instantiation
- New demo scene "Two Managers": using two highlight managers with different settings and target layers each
- New demo scene "Effects": showing extra stylized options
- Target: added "Center On Hit Position" and "Align To Hit Normal" options
- Highlight Manager/Trigger: added OnObjectClicked event
- Label: added "Always Show In Editor Mode" option
Version 30.0
- New effect: Label -> displays a text next to the highlighted object
- Outline: added "Stylized" (toon/charcoal style) option in highest quality mode
- Outline: added "Dashed" style
- Outline: added "Gradient" option to Highest Quality mode
- Outer Glow: added "High Precision" option for smoother results
- Inner Glow: added "Power" property
- Icon: added option to use a prefab instead of a mesh
- Target: added "Style" option with Texture, Frame, InwardCorners and Cross options
- Target: added minimum opacity options
- Target: align to ground, added Ground Min Altitude to support transparent ground surfaces
- Overlay: added pattern option (polkadots, grid, lines, zigzag)
- Hit FX: added trigger mode option (scripting/when highlighted)
- Improved padding
- Smoother outer glow
- Added "Highlight Root" component. Can be used to specify a different root in the hierarchy when Root To Children is used.
- Highlight Trigger & Highlight Manager: added "Unhighlight On UI" option under "Respect UI"
- Render Feature: added option to show/hide effects in Scene View
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

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

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3a476022645d74299b862c36d0daa1df
folderAsset: yes
timeCreated: 1542876301
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6bd97436761b94109a0785ed6823647c
folderAsset: yes
timeCreated: 1542893576
licenseType: Store
DefaultImporter:
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

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d753c051e36754eef85b1868da81e4c7
NativeFormatImporter:
externalObjects: {}
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,203 @@
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) * _BlurScale;
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 pixel0 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv);
float4 pixel1 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv1);
float4 pixel2 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv2);
float4 pixel3 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv3);
float4 pixel4 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv4);
#if SOURCE_SOLID_COLOR
pixel0.r = pixel0.r > 0;
pixel1.r = pixel1.r > 0;
pixel2.r = pixel2.r > 0;
pixel3.r = pixel3.r > 0;
pixel4.r = pixel4.r > 0;
#endif
float4 pixel = pixel0 * 0.2270270270 + (pixel1 + pixel2) * 0.3162162162 + (pixel3 + pixel4) * 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);
#if SOURCE_SOLID_COLOR
c1.r = c1.r > 0;
c2.r = c2.r > 0;
c3.r = c3.r > 0;
c4.r = c4.r > 0;
#endif
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 multi_compile _ SOURCE_SOLID_COLOR
#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
#pragma multi_compile _ SOURCE_SOLID_COLOR
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,182 @@
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 pixel0 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv);
float4 pixel1 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv1);
float4 pixel2 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv2);
float4 pixel3 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv3);
float4 pixel4 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.uv4);
#if SOURCE_SOLID_COLOR
pixel0.r = pixel0.r > 0;
pixel1.r = pixel1.r > 0;
pixel2.r = pixel2.r > 0;
pixel3.r = pixel3.r > 0;
pixel4.r = pixel4.r > 0;
#endif
float4 pixel = pixel0 * 0.2270270270 + (pixel1 + pixel2) * 0.3162162162 + (pixel3 + pixel4) * 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
#pragma multi_compile_local_fragment _ SOURCE_SOLID_COLOR
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,120 @@
Shader "HighlightPlus/Geometry/ComposeGlow" {
Properties {
_MainTex ("Texture", Any) = "black" {}
_Color ("Color", Color) = (1,1,1)
[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
_Padding("Padding", Float) = 0
}
SubShader
{
Tags { "Queue"="Transparent+102" "RenderType"="Transparent" "DisableBatching" = "True" }
Blend [_BlendSrc] [_BlendDst]
BlendOp Add
// Compose effect on camera target
Pass
{
Name "Compose Glow"
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
#pragma multi_compile_local _ HP_ALL_EDGES
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPComposeOutlineFinal);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPComposeGlowFinal);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPSourceRT);
float4 _HPSourceRT_TexelSize;
fixed4 _Color;
float3 _Flip;
fixed4 _Debug;
half _Padding;
#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;
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;
// read padding from outline
fixed4 outline = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPComposeOutlineFinal, uv);
glow = step(OUTLINE_SOURCE, _Padding) * glow / _Padding;
color.a *= glow;
color.a = saturate(color.a);
color = lerp(color, _Debug, 1.0 - 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,169 @@
Shader "HighlightPlus/Geometry/ComposeOutline" {
Properties {
_MainTex ("Texture", Any) = "black" {}
_Color("Color", Color) = (1,1,1)
_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
_PatternTex("Pattern Texture", 2D) = "black" {}
_PatternData("Pattern Data", Vector) = (1.0, 0.5, 0.1, 0)
_DistortionTex("Distortion Texture", 2D) = "white" {}
_DashData("Dash Data", Vector) = (0.1, 0.1, 1.0, 0.1)
_OutlineGradientTex("Outline Gradient Texture", 2D) = "white" {}
_OutlineGradientData("Outline Gradient Data", Vector) = (0.5, 1.0, 0, 0)
_Padding("Padding", Float) = 0
}
SubShader
{
Tags { "Queue" = "Transparent+120" "RenderType" = "Transparent" "DisableBatching" = "True" }
Blend SrcAlpha OneMinusSrcAlpha
// Compose effect on camera target (optimal quad blit)
Pass
{
Name "Composte Outline"
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
#pragma multi_compile_local _ HP_STYLIZED
#pragma multi_compile_local _ HP_DASHED
#pragma multi_compile_local _ HP_OUTLINE_GRADIENT_WS
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPComposeOutlineFinal);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HPSourceRT);
float4 _HPSourceRT_TexelSize;
sampler2D _PatternTex;
float4 _PatternData;
#define PATTERN_SCALE _PatternData.x
#define PATTERN_THRESHOLD _PatternData.y
#define PATTERN_DISTORTION_AMOUNT _PatternData.z
#define PATTERN_STOP_MOTION_SCALE _PatternData.w
sampler2D _DistortionTex;
fixed4 _Color;
float3 _Flip;
fixed4 _Debug;
half _OutlineSharpness;
half _Padding;
half4 _DashData;
#define DASH_WIDTH _DashData.x
#define DASH_GAP _DashData.y
#define DASH_SPEED _DashData.z
#if HP_ALL_EDGES
#define OUTLINE_SOURCE outline.g
#else
#define OUTLINE_SOURCE outline.r
#endif
sampler2D _OutlineGradientTex;
float2 _OutlineGradientData;
#define OUTLINE_GRADIENT_KNEE _OutlineGradientData.x
#define OUTLINE_GRADIENT_POWER _OutlineGradientData.y
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;
#if HP_STYLIZED
// Apply pattern texture with distortion
float2 patternUV = uv * PATTERN_SCALE + floor(_Time.y * PATTERN_STOP_MOTION_SCALE) / PATTERN_STOP_MOTION_SCALE;
fixed pattern = tex2D(_DistortionTex, patternUV).x;
uv.x += (pattern - 0.5) * PATTERN_DISTORTION_AMOUNT;
#if !HP_MASK_CUTOUT
fixed mask = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPSourceRT, uv).r;
if (mask > 0.5) return 0;
#endif
#endif
fixed4 outline = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HPComposeOutlineFinal, uv);
fixed4 color = _Color;
OUTLINE_SOURCE = step(OUTLINE_SOURCE, _Padding) * OUTLINE_SOURCE / _Padding;
color.a *= OUTLINE_SOURCE;
#if HP_OUTLINE_GRADIENT_WS
half gradientT = pow(color.a * OUTLINE_GRADIENT_KNEE, OUTLINE_GRADIENT_POWER);
half4 gradientC = tex2D(_OutlineGradientTex, float2(gradientT, 0));
color.rgb = gradientC.rgb;
color.a *= gradientC.a;
#endif
#if HP_DASHED
float dashPattern = sin(( dot(float2(uv.x, uv.y), float2(uv.x, uv.y)) * _HPSourceRT_TexelSize.z * DASH_WIDTH + _Time.w * DASH_SPEED)) + DASH_GAP;
clip(dashPattern);
#endif
#if HP_STYLIZED
fixed patternCutout = tex2D(_PatternTex, patternUV * 4.0).x;
color.a = saturate(color.a - patternCutout * PATTERN_THRESHOLD * 10);
#endif
#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.a = saturate(color.a);
color.a = pow(color.a, _OutlineSharpness);
color = lerp(color, _Debug, 1.0 - color.a);
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

@ -0,0 +1,8 @@
fileFormatVersion: 2
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,75 @@
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;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
float3 normal : TEXCOORD1;
float4 color : COLOR;
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 = 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,103 @@
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)
_InnerGlowData ("Data", Vector) = (1,1,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 norm : NORMAL;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float3 wpos : TEXCOORD1;
float3 norm : NORMAL;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
fixed _CutOff;
fixed4 _InnerGlowColor;
fixed4 _InnerGlowData;
#define INNER_GLOW_WIDTH _InnerGlowData.x
#define INNER_GLOW_POWER _InnerGlowData.y
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.norm = UnityObjectToWorldNormal(v.norm);
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);
float hn = abs(dot(viewDir, normalize(i.norm)));
fixed dx = saturate((INNER_GLOW_WIDTH - hn) / INNER_GLOW_WIDTH);
dx = 1.0 - pow( 1.0 - dx, INNER_GLOW_POWER);
fixed4 col = _InnerGlowColor;
col.a *= dx;
col.a = saturate(col.a);
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,123 @@
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;
float3 normal : NORMAL;
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);
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]);
o.pos.xy += offset * z * _Padding;
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

@ -0,0 +1,8 @@
fileFormatVersion: 2
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,259 @@
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
_OverlayPatternScrolling("Pattern Scrolling", Vector) = (0,0,0,0)
_OverlayPatternData("Pattern Data", Vector) = (0,0,0,0)
}
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
#pragma multi_compile_local _ HP_PATTERN_POLKADOTS HP_PATTERN_GRID HP_PATTERN_STAGGERED_LINES HP_PATTERN_ZIGZAG
#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;
float2 _OverlayPatternScrolling;
float4 _OverlayPatternData;
#define PATTERN_SCALE (_OverlayPatternData.x)
#define PATTERN_SIZE (_OverlayPatternData.y)
#define PATTERN_SOFTNESS (_OverlayPatternData.z)
#define PATTERN_ROTATION (_OverlayPatternData.w)
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;
}
// Helper to rotate UVs by angle in degrees
float2 rotateUV(float2 uv, float angleDeg) {
float angleRad = radians(angleDeg);
float s = sin(angleRad);
float c = cos(angleRad);
float2 center = float2(0.5, 0.5);
uv -= center;
float2 rotated = float2(
uv.x * c - uv.y * s,
uv.x * s + uv.y * c
);
return rotated + center;
}
// Function to create antialiased polka dot pattern
float polkaDotPattern(float2 uv) {
float2 scrolledUV = uv + _OverlayPatternScrolling * _Time.y;
float2 rotatedUV = rotateUV(scrolledUV, PATTERN_ROTATION);
float2 localUV = rotatedUV;
// Offset every other row
localUV.x += 0.5 / PATTERN_SCALE * (floor(rotatedUV.y * PATTERN_SCALE) % 2.0);
float2 scaledUV = localUV * PATTERN_SCALE;
float2 gridPos = frac(scaledUV) - 0.5;
float dist = length(gridPos);
float alpha = smoothstep(PATTERN_SIZE + PATTERN_SOFTNESS, PATTERN_SIZE - PATTERN_SOFTNESS, dist);
return saturate(alpha);
}
// Function to create antialiased grid pattern
float gridPattern(float2 uv) {
float2 scrolledUV = uv + _OverlayPatternScrolling * _Time.y;
float2 rotatedUV = rotateUV(scrolledUV, PATTERN_ROTATION);
float2 scaledUV = rotatedUV * PATTERN_SCALE;
float2 grid = abs(frac(scaledUV) - 0.5);
float lin = min(grid.x, grid.y);
float alpha = smoothstep(PATTERN_SIZE + PATTERN_SOFTNESS, PATTERN_SIZE - PATTERN_SOFTNESS, lin);
return saturate(alpha);
}
// Function to create antialiased staggered horizontal dashed lines
float staggeredLinePattern(float2 uv) {
float2 scrolledUV = uv + _OverlayPatternScrolling * _Time.y;
float2 rotatedUV = rotateUV(scrolledUV, PATTERN_ROTATION);
float2 scaledUV = rotatedUV * PATTERN_SCALE;
// Row index for staggering the dash pattern
float row = floor(scaledUV.y);
float dashOffset = (row % 2.0) * 0.5; // Stagger by half a pattern period along X
float staggeredX = scaledUV.x + dashOffset;
// Calculate visibility for the horizontal line itself.
// Thickness is controlled by PATTERN_SIZE.
// hline_alpha = 1 if on the line, 0 if in the gap between lines.
float hline_alpha = smoothstep(PATTERN_SIZE + PATTERN_SOFTNESS, PATTERN_SIZE - PATTERN_SOFTNESS, abs(frac(scaledUV.y) - 0.5));
// Calculate visibility for the dash segments along the X-axis.
// Let's use a fixed 50% duty cycle for dashes (dash length = gap length).
// For a 50% duty cycle, the effective "size" parameter for the dash segment is 0.25.
// (because abs(frac(X)-0.5) goes from 0 to 0.5; visible for 0 to 0.25 means 0.25*2=0.5 of the period).
float dash_segment_parameter = 0.25;
float dash_alpha = smoothstep(dash_segment_parameter + PATTERN_SOFTNESS, dash_segment_parameter - PATTERN_SOFTNESS, abs(frac(staggeredX) - 0.5));
// Final alpha: The pixel is visible if it's on a horizontal line AND on a dash segment of that line.
float final_alpha = hline_alpha * dash_alpha;
return saturate(final_alpha);
}
// Function to create antialiased zigzag pattern
float zigZagPattern(float2 uv) {
float2 scrolledUV = uv + _OverlayPatternScrolling * _Time.y;
float2 rotatedUV = rotateUV(scrolledUV, PATTERN_ROTATION);
float2 scaledUV = rotatedUV * PATTERN_SCALE;
// y_center_norm is a triangle wave ^ shape, ranging from 0 to 1, based on scaledUV.x
// It represents the normalized y-coordinate of the zigzag centerline within a vertical cell.
float y_center_norm = abs(frac(scaledUV.x) - 0.5) * 2.0;
// y_pixel_norm is the normalized y-coordinate of the current pixel within a vertical cell.
float y_pixel_norm = frac(scaledUV.y);
// dist is the vertical distance from the pixel's normalized y to the zigzag centerline's normalized y.
float dist = abs(y_pixel_norm - y_center_norm);
// PATTERN_SIZE defines half the thickness of the line in normalized cell coordinates.
// Alpha is 1 if dist is small (within PATTERN_SIZE), 0 if dist is large.
float alpha = smoothstep(PATTERN_SIZE + PATTERN_SOFTNESS, PATTERN_SIZE - PATTERN_SOFTNESS, dist);
return saturate(alpha);
}
fixed4 SampleOverlayTexture(float2 uv) {
float2 uvOffset = _OverlayTextureScrolling * _Time.y;
fixed4 tex = tex2D(_OverlayTexture, uv * _OverlayData.w + uvOffset);
#if HP_PATTERN_POLKADOTS
tex.a *= polkaDotPattern(uv);
#endif
#if HP_PATTERN_GRID
tex.a *= gridPattern(uv);
#endif
#if HP_PATTERN_STAGGERED_LINES
tex.a *= staggeredLinePattern(uv);
#endif
#if HP_PATTERN_ZIGZAG
tex.a *= zigZagPattern(uv);
#endif
return tex;
}
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;
float2 uvX = tpos.zy;
float2 uvY = tpos.xz;
float2 uvZ = tpos.xy;
// albedo textures
fixed4 colX = SampleOverlayTexture(uvX);
fixed4 colY = SampleOverlayTexture(uvY);
fixed4 colZ = SampleOverlayTexture(uvZ);
fixed4 tex = colX * triblend.x + colY * triblend.y + colZ * triblend.z;
col *= tex;
#elif HP_TEXTURE_SCREENSPACE
col *= SampleOverlayTexture(i.scrPos.xy / i.scrPos.w);
#elif HP_TEXTURE_OBJECTSPACE
col *= SampleOverlayTexture(i.uv);
#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

@ -0,0 +1,76 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: HighlightPlusDepthWrite
m_Shader: {fileID: 4800000, guid: 058a572e30b2d446bade2dda32bcef0f, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
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}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _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
}
SubShader
{
Tags { "Queue"="Transparent+100" "RenderType"="Transparent" "DisableBatching" = "True" }
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;
fixed _CutOff;
fixed4 _Color;
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;
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);
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 screenUV = i.scrPos.xy / i.scrPos.w;
float2 uv = UnityStereoTransformScreenSpaceTex(screenUV);
#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,291 @@
Shader "HighlightPlus/Geometry/Target" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_ZTest ("ZTest", Int) = 0
_TargetFXFrameData ("Frame Data (Width, Length, ShowCornersOnly)", Vector) = (0.1, 0.3, 0, 0)
_TargetFXRenderData ("Render Data (Normal, FadePower, CustomAltitude)", Vector) = (0, 1, 0, 0)
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "Transparent-1" "DisableBatching" = "True" }
Pass
{
Name "Target FX Decal"
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
ZTest [_ZTest]
Cull Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_TARGET_FRAME HP_TARGET_INWARD_CORNERS HP_TARGET_CROSS
#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;
float4 _TargetFXFrameData;
CBUFFER_END
#define GROUND_NORMAL _TargetFXRenderData.xyz
#define FADE_POWER _TargetFXRenderData.w
#define FRAME_WIDTH _TargetFXFrameData.x
#define CORNER_LENGTH _TargetFXFrameData.y
#define FRAME_MIN_OPACITY _TargetFXFrameData.z
#define GROUND_MIN_ALTITUDE _TargetFXFrameData.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);
// Calculate correct ray origin on near plane for orthographic
float3 rayOrigin = float3(rayVSEnd, -_ProjectionParams.y);
float3 rayDirWS = mul((float3x3)UNITY_MATRIX_I_V, float3(0, 0, 1)); // Camera forward in world space
float3 rayOriginWS = mul(UNITY_MATRIX_I_V, float4(rayOrigin, 1)).xyz;
// Ground plane intersection
float t = (GROUND_MIN_ALTITUDE - rayOriginWS.y) / rayDirWS.y;
float3 hitPosWS = rayOriginWS + rayDirWS * t;
float3 hitPosVS = mul(UNITY_MATRIX_V, float4(hitPosWS, 1)).xyz;
sceneDepthVS = min(-hitPosVS.z, sceneDepthVS);
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);
float3 rayDir = i.rayVS.xyz / i.rayVS.w;
float3 rayOrigin = i.camPosVS;
float t = (GROUND_MIN_ALTITUDE - rayOrigin.y) / rayDir.y;
depthEye = min(t, depthEye);
decalPos = rayOrigin + rayDir * 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;
#if HP_TARGET_FRAME
float2 d = abs(uv - 0.5);
float dist = max(d.x, d.y);
float fw = fwidth(dist);
float frame = smoothstep(0.5 - FRAME_WIDTH - fw, 0.5 - FRAME_WIDTH, dist) *
smoothstep(0.5 + fw, 0.5, dist);
float cornerMask = step(0.5 - CORNER_LENGTH, d.x) * step(0.5 - CORNER_LENGTH, d.y);
frame *= cornerMask;
col = _Color;
col.a *= frame;
col.a += FRAME_MIN_OPACITY;
col.a = saturate(col.a);
#elif HP_TARGET_CROSS
uv = abs(0.5 - uv);
float2 d = abs(uv - 0.5);
float dist = max(d.x, d.y);
float fw = fwidth(dist);
float frame = smoothstep(0.5 - FRAME_WIDTH - fw, 0.5 - FRAME_WIDTH, dist) *
smoothstep(0.5 + fw, 0.5, dist);
float cornerMask = step(0.5 - CORNER_LENGTH, d.x) * step(0.5 - CORNER_LENGTH, d.y);
frame *= cornerMask;
col = _Color;
col.a *= frame;
col.a += FRAME_MIN_OPACITY;
col.a = saturate(col.a);
#elif HP_TARGET_INWARD_CORNERS
float2 d = abs(uv - 0.5);
d = (1 - CORNER_LENGTH) - d;
float dist = max(d.x, d.y);
float fw = fwidth(dist);
float frame = smoothstep(0.5 - FRAME_WIDTH - fw, 0.5 - FRAME_WIDTH, dist) *
smoothstep(0.5 + fw, 0.5, dist);
float cornerMask = step(0.5 - CORNER_LENGTH, d.x) * step(0.5 - CORNER_LENGTH, d.y);
frame *= cornerMask;
col = _Color;
col.a *= frame;
col.a += FRAME_MIN_OPACITY;
col.a = saturate(col.a);
#else
col = tex2D(_MainTex, uv) * _Color;
#endif
// atten with elevation
col.a /= 1.0 + pow(1.0 + max(0, decalPos.y - 0.1), FADE_POWER);
return col;
}
ENDHLSL
}
Pass
{
Name "Target FX"
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
ZTest [_ZTest]
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_local _ HP_TARGET_FRAME HP_TARGET_INWARD_CORNERS HP_TARGET_CROSS
#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;
float4 _TargetFXFrameData;
#define FRAME_WIDTH _TargetFXFrameData.x
#define CORNER_LENGTH _TargetFXFrameData.y
#define FRAME_MIN_OPACITY _TargetFXFrameData.z
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
{
float2 uv = i.uv;
#if HP_TARGET_FRAME
float2 d = abs(uv - 0.5);
float dist = max(d.x, d.y);
float fw = fwidth(dist);
float frame = smoothstep(0.5 - FRAME_WIDTH - fw, 0.5 - FRAME_WIDTH, dist) *
smoothstep(0.5 + fw, 0.5, dist);
float cornerMask = step(0.5 - CORNER_LENGTH, d.x) * step(0.5 - CORNER_LENGTH, d.y);
frame *= cornerMask;
fixed4 col = _Color;
col.a *= frame;
col.a += FRAME_MIN_OPACITY;
col.a = saturate(col.a);
return col;
#elif HP_TARGET_CROSS
uv = abs(0.5 - uv);
float2 d = abs(uv - 0.5);
float dist = max(d.x, d.y);
float fw = fwidth(dist);
float frame = smoothstep(0.5 - FRAME_WIDTH - fw, 0.5 - FRAME_WIDTH, dist) *
smoothstep(0.5 + fw, 0.5, dist);
float cornerMask = step(0.5 - CORNER_LENGTH, d.x) * step(0.5 - CORNER_LENGTH, d.y);
frame *= cornerMask;
fixed4 col = _Color;
col.a *= frame;
col.a += FRAME_MIN_OPACITY;
col.a = saturate(col.a);
return col;
#elif HP_TARGET_INWARD_CORNERS
float2 d = abs(uv - 0.5);
d = (1 - CORNER_LENGTH) - d;
float dist = max(d.x, d.y);
float fw = fwidth(dist);
float frame = smoothstep(0.5 - FRAME_WIDTH - fw, 0.5 - FRAME_WIDTH, dist) *
smoothstep(0.5 + fw, 0.5, dist);
float cornerMask = step(0.5 - CORNER_LENGTH, d.x) * step(0.5 - CORNER_LENGTH, d.y);
frame *= cornerMask;
fixed4 col = _Color;
col.a *= frame;
col.a += FRAME_MIN_OPACITY;
col.a = saturate(col.a);
return col;
#else
return tex2D(_MainTex, uv) * _Color;
#endif
}
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:

View File

@ -0,0 +1,325 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3702149465375245816
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 58649581226587046}
- component: {fileID: 648609806128164915}
- component: {fileID: 2784097919007915135}
m_Layer: 5
m_Name: Line
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &58649581226587046
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3702149465375245816}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 2.9855256}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4533417537477099933}
m_Father: {fileID: 3636418573986312812}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 397.52823, y: 120.7039}
m_SizeDelta: {x: 200, y: 2}
m_Pivot: {x: 0, y: 0}
--- !u!222 &648609806128164915
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3702149465375245816}
m_CullTransparentMesh: 1
--- !u!114 &2784097919007915135
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3702149465375245816}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7963606135631250497
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3636418573986312812}
- component: {fileID: 6922919391405308110}
- component: {fileID: 6208036440593313210}
- component: {fileID: 8045949807637697546}
- component: {fileID: 6701531831790591149}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3636418573986312812
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7963606135631250497}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 58649581226587046}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &6922919391405308110
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7963606135631250497}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &6208036440593313210
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7963606135631250497}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!114 &8045949807637697546
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7963606135631250497}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0e63182d0d6a34016b819144ebdd9188, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 0}
worldPosition: {x: 0, y: 0, z: 0}
--- !u!225 &6701531831790591149
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7963606135631250497}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1 &8163980735836251147
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4533417537477099933}
- component: {fileID: 2328294341262372320}
- component: {fileID: 7358679494392228084}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4533417537477099933
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8163980735836251147}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 58649581226587046}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &2328294341262372320
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8163980735836251147}
m_CullTransparentMesh: 1
--- !u!114 &7358679494392228084
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8163980735836251147}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Label
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 14
m_fontSizeBase: 14
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 4
m_VerticalAlignment: 1024
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 933a5612c43104c29af0a700ea5fa149
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 12319e92c3b5b45d193b1fe41ed05a1f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 0
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
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: 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: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: 42704efe49aef4f97903c9877e0c60a0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
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: Standalone
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: 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
- serializedVersion: 3
buildTarget: WebGL
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: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
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

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 89ce39cd6bb34454bbaf48f1d111f236
folderAsset: yes
timeCreated: 1542876305
licenseType: Store
DefaultImporter:
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,192 @@
using System;
using UnityEngine;
namespace HighlightPlus {
public enum HitFxMode {
Overlay = 0,
InnerGlow = 1,
LocalHit = 2
}
public enum HitFXTriggerMode {
Scripting = 0,
WhenHighlighted = 10
}
public partial class HighlightEffect : MonoBehaviour {
public static bool useUnscaledTime;
[NonSerialized]
public Transform currentHitTarget;
[NonSerialized]
public Vector3 currentHitLocalPosition;
[NonSerialized]
public Vector3 currentHitNormal;
public static float GetTime () {
return useUnscaledTime ? Time.unscaledTime : Time.time;
}
#region Hit FX handling
[Range(0, 1)] public float hitFxInitialIntensity;
public HitFxMode hitFxMode = HitFxMode.Overlay;
public HitFXTriggerMode hitFXTriggerMode = HitFXTriggerMode.Scripting;
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();
}
}
#endregion
/// <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();
}
}
#region Label handling
[NonSerialized]
public HighlightLabel label;
void ReleaseLabel () {
label?.Release();
label = null;
}
void CheckLabel (bool disabling) {
// Enable label
bool shouldShowLabel = labelMode == LabelMode.Always || (_highlighted && labelMode == LabelMode.WhenHighlighted) || (labelShowInEditorMode && !Application.isPlaying);
shouldShowLabel = shouldShowLabel && !disabling && rmsCount != 0;
if (shouldShowLabel && labelEnabled) {
// Lazy initialization of label prefab
if (label == null && labelPrefab != null) {
label = HighlightLabelPoolManager.GetLabelInstance(labelPrefab);
}
if (label != null) {
label.textLabel = labelText;
label.textColor = labelColor;
label.textSize = labelTextSize;
label.width = lineLength;
label.labelAlignment = labelAlignment;
if (!label.isVisible) {
label.SetPosition(labelTarget == null ? target : labelTarget, Misc.vector3Zero, new Vector3(0, labelVerticalOffset, 0));
label.Show();
}
}
}
else if (!labelEnabled) {
ReleaseLabel();
#if UNITY_EDITOR
if (!Application.isPlaying) {
HighlightLabelPoolManager.DestroySceneLabels();
}
#endif
}
else if (label != null) {
label.Hide();
}
}
public void SetHitPosition (Transform target, Vector3 localPosition, Vector3 offsetWS, Vector3 normalWS) {
if (labelEnabled && labelFollowCursor && label != null) {
label.SetPosition(target, localPosition, offsetWS);
}
currentHitTarget = target;
currentHitLocalPosition = localPosition;
currentHitNormal = normalWS;
}
/// <summary>
/// Recreates label
/// </summary>
public void RefreshLabel () {
HighlightLabelPoolManager.DestroySceneLabels();
CheckLabel(false);
}
#endregion
}
}

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,90 @@
using UnityEngine;
using UnityEngine.Rendering;
using System.Collections.Generic;
namespace HighlightPlus {
public enum BlockerTargetOptions {
OnlyThisObject,
Children,
LayerInChildren
}
[DefaultExecutionOrder(100)]
[ExecuteInEditMode]
public class HighlightEffectBlocker : MonoBehaviour {
public BlockerTargetOptions include = BlockerTargetOptions.OnlyThisObject;
public LayerMask layerMask = -1;
public string nameFilter;
public bool useRegEx;
public bool blockOutlineAndGlow = true;
public bool blockOverlay = true;
List<Renderer> renderers;
void OnEnable () {
Refresh();
HighlightPlusRenderPassFeature.RegisterBlocker(this);
}
void OnDisable () {
HighlightPlusRenderPassFeature.UnregisterBlocker(this);
}
public void Refresh() {
if (renderers == null) {
renderers = new List<Renderer>();
} else {
renderers.Clear();
}
switch (include) {
case BlockerTargetOptions.OnlyThisObject:
Renderer r = GetComponent<Renderer>();
if (r != null) renderers.Add(r);
return;
case BlockerTargetOptions.Children:
GetComponentsInChildren<Renderer>(true, renderers);
break;
case BlockerTargetOptions.LayerInChildren:
Renderer[] childRenderers = GetComponentsInChildren<Renderer>(true);
for (int k = 0; k < childRenderers.Length; k++) {
Renderer cr = childRenderers[k];
if (cr != null && ((1 << cr.gameObject.layer) & layerMask) != 0) {
renderers.Add(cr);
}
}
break;
}
if (!string.IsNullOrEmpty(nameFilter)) {
for (int k = renderers.Count - 1; k >= 0; k--) {
string objName = renderers[k].name;
if (useRegEx) {
if (!System.Text.RegularExpressions.Regex.IsMatch(objName, nameFilter)) {
renderers.RemoveAt(k);
}
} else if (!objName.Contains(nameFilter)) {
renderers.RemoveAt(k);
}
}
}
}
public void BuildCommandBuffer (CommandBuffer cmd, Material mat) {
if (renderers == null) return;
int renderersCount = renderers.Count;
for (int k=0;k<renderersCount;k++) {
Renderer r = renderers[k];
if (r == null || !r.enabled || !r.gameObject.activeInHierarchy) continue;
int submeshCount = r.sharedMaterials.Length;
for (int i = 0; i < submeshCount; i++) {
cmd.DrawRenderer(r, 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,175 @@
using System;
using TMPro;
using UnityEngine;
namespace HighlightPlus {
[ExecuteAlways]
public partial class HighlightLabel : MonoBehaviour {
public Camera cam;
[NonSerialized]
public Transform target;
[NonSerialized]
public Vector3 localPosition;
[NonSerialized]
public Vector3 worldOffset;
[NonSerialized]
public bool isVisible;
[NonSerialized]
public LabelAlignment labelAlignment = LabelAlignment.Auto;
public GameObject labelPrefab;
internal bool isPooled;
TextMeshProUGUI text;
RectTransform panel;
CanvasGroup canvasGroup;
public virtual float alpha {
get {
return canvasGroup?.alpha ?? 1f;
}
set {
if (canvasGroup != null) {
canvasGroup.alpha = value;
}
}
}
public virtual Color textColor {
get {
return text?.color ?? Color.white;
}
set {
if (text != null) {
text.color = value;
}
}
}
public virtual string textLabel {
get {
return text?.text ?? "";
}
set {
if (text != null) {
text.text = value;
}
}
}
public virtual float textSize {
get {
return text?.fontSize ?? 14;
}
set {
if (text != null) {
text.fontSize = value;
}
}
}
public virtual float width {
get {
return text?.rectTransform.sizeDelta.x ?? 200;
}
set {
if (text == null) return;
if (text.rectTransform != null) {
Vector2 currentSize = text.rectTransform.sizeDelta;
if (currentSize.x != value) {
text.rectTransform.sizeDelta = new Vector2(value, currentSize.y);
}
}
RectTransform panelRectTransform = panel.GetComponent<RectTransform>();
if (panelRectTransform != null) {
Vector2 currentSize = panelRectTransform.sizeDelta;
if (currentSize.x != value) {
panelRectTransform.sizeDelta = new Vector2(value, currentSize.y);
}
}
}
}
void Awake () {
text = GetComponentInChildren<TextMeshProUGUI>();
panel = transform.GetChild(0).GetComponentInChildren<RectTransform>();
canvasGroup = GetComponent<CanvasGroup>();
}
/// <summary>
/// Return the label to the pool
/// </summary>
public virtual void ReturnToPool () {
if (!isPooled) return;
gameObject.SetActive(false);
HighlightLabelPoolManager.ReturnToPool(this);
}
public virtual void SetPosition(Transform target, Vector3 localPosition, Vector3 worldOffset) {
this.target = target;
this.localPosition = localPosition;
this.worldOffset = worldOffset;
}
public virtual void UpdatePosition () {
if (panel == null || text == null) return;
if (cam == null) {
cam = Camera.main;
if (cam == null) return;
}
if (target == null) return;
Vector3 worldPosition = target.TransformPoint(localPosition);
panel.position = cam.WorldToScreenPoint(worldPosition + worldOffset);
if (labelAlignment == LabelAlignment.Left || (labelAlignment == LabelAlignment.Auto && panel.position.x + width * 2f > cam.pixelWidth * 0.95f)) {
panel.pivot = Vector2.right;
text.alignment = TextAlignmentOptions.BottomLeft;
}
else {
panel.pivot = Vector2.zero;
text.alignment = TextAlignmentOptions.BottomRight;
}
}
/// <summary>
/// Show the label
/// </summary>
public virtual void Show () {
isVisible = true;
#if UNITY_EDITOR
if (!Application.isPlaying) {
HighlightLabelPoolManager.Refresh();
}
#endif
}
/// <summary>
/// Hide the label
/// </summary>
public virtual void Hide () {
if (this == null) return;
gameObject.SetActive(false);
isVisible = false;
}
/// <summary>
/// Hide & destroy the label
/// </summary>
public virtual void Release () {
if (this == null) return;
Hide();
if (isPooled) {
ReturnToPool();
}
}
}
}

View File

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

View File

@ -0,0 +1,134 @@
using System.Collections.Generic;
using UnityEngine;
namespace HighlightPlus {
[ExecuteAlways]
[DefaultExecutionOrder(-100)]
public class HighlightLabelPoolManager : MonoBehaviour {
private static HighlightLabelPoolManager instance;
private static readonly Dictionary<GameObject, Queue<HighlightLabel>> labelPools = new Dictionary<GameObject, Queue<HighlightLabel>>();
private static readonly HashSet<HighlightLabel> activeLabels = new HashSet<HighlightLabel>();
private static readonly int initialPoolSize = 5;
const string LABEL_INSTANCE_NAME = "Highlight Plus Label";
const string LABEL_POOL_NAME = "Highlight Plus Label Pool Manager";
[RuntimeInitializeOnLoadMethod]
static void DomainReloadDisabledSupport () {
DestroySceneLabels();
}
void OnEnable () {
if (instance == null) {
instance = this;
} else if (instance != this) {
DestroyImmediate(gameObject);
}
ClearPools();
}
void OnDestroy () {
labelPools.Clear();
activeLabels.Clear();
}
public static void DestroySceneLabels () {
// Find and destroy any existing pool managers
HighlightLabelPoolManager[] existingManagers = Misc.FindObjectsOfType<HighlightLabelPoolManager>(true);
foreach (var manager in existingManagers) {
if (manager != null) {
DestroyImmediate(manager.gameObject);
}
}
ClearPools();
instance = null;
}
static void ClearPools () {
if (instance != null) {
for (int i = instance.transform.childCount - 1; i >= 0; i--) {
Transform child = instance.transform.GetChild(i);
if (child != null) {
DestroyImmediate(child.gameObject);
}
}
}
labelPools.Clear();
activeLabels.Clear();
}
private static void InitializePool (GameObject prefab) {
if (!labelPools.ContainsKey(prefab)) {
labelPools[prefab] = new Queue<HighlightLabel>();
for (int i = 0; i < initialPoolSize; i++) {
CreatePooledLabel(prefab);
}
}
}
private static HighlightLabel CreatePooledLabel (GameObject prefab) {
GameObject labelInstanceGO = Instantiate(prefab);
labelInstanceGO.name = LABEL_INSTANCE_NAME;
labelInstanceGO.transform.SetParent(instance.transform, false);
HighlightLabel labelInstance = labelInstanceGO.GetComponentInChildren<HighlightLabel>();
labelInstance.labelPrefab = prefab;
labelInstance.isPooled = true;
labelInstanceGO.SetActive(false);
labelPools[prefab].Enqueue(labelInstance);
return labelInstance;
}
public static HighlightLabel GetLabelInstance (GameObject prefab) {
if (instance == null) {
GameObject go = new GameObject(LABEL_POOL_NAME);
instance = go.AddComponent<HighlightLabelPoolManager>();
}
// Initialize pool if needed
InitializePool(prefab);
// Try to get from pool
HighlightLabel labelInstance = null;
while (labelInstance == null && labelPools[prefab].Count > 0) {
labelInstance = labelPools[prefab].Dequeue();
}
if (labelInstance != null) {
activeLabels.Add(labelInstance);
return labelInstance;
}
// Create new instance if pool is empty
HighlightLabel newLabel = CreatePooledLabel(prefab);
activeLabels.Add(newLabel);
return newLabel;
}
public static void ReturnToPool (HighlightLabel label) {
if (label.labelPrefab != null && labelPools.ContainsKey(label.labelPrefab)) {
labelPools[label.labelPrefab].Enqueue(label);
activeLabels.Remove(label);
}
}
public static void Refresh () {
if (instance == null) return;
instance.LateUpdate();
}
void LateUpdate () {
foreach (var label in activeLabels) {
if (label == null) continue;
if (label.isVisible) {
label.UpdatePosition();
if (!label.gameObject.activeSelf) {
label.gameObject.SetActive(true);
}
}
}
}
}
}

View File

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

View File

@ -0,0 +1,533 @@
using System;
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("Unhighlights the object when the pointer is over a UI element")]
public bool unhighlightOnUI;
[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 event OnObjectClickEvent OnObjectClicked;
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) {
if (!TryGetComponent(out baseEffect)) {
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) {
if (unhighlightOnUI && currentEffect != null && currentEffect.highlighted) {
currentEffect.SetHighlighted(false);
}
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;
UpdateHitPosition(theGameObject.transform, rr.worldPosition, Misc.vector3Zero);
// 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);
}
}
}
// 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()) {
if (unhighlightOnUI && currentEffect != null && currentEffect.highlighted) {
currentEffect.SetHighlighted(false);
}
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?
if (t.TryGetComponent(out HighlightTrigger _)) {
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);
}
UpdateHitPosition(t, hitInfo.point, hitInfo.normal);
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?
if (t.TryGetComponent(out HighlightTrigger _)) {
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);
}
UpdateHitPosition(t, hitInfo2D[0].point, Misc.vector3Zero);
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;
if (newObject.TryGetComponent(out HighlightTrigger ht) && ht.enabled) {
return;
}
if (!newObject.TryGetComponent(out HighlightEffect otherEffect)) {
// 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);
}
}
void UpdateHitPosition (Transform target, Vector3 positionWS, Vector3 normalWS) {
if (currentEffect == null) return;
Vector3 localPosition = target.InverseTransformPoint(positionWS);
currentEffect.SetHitPosition(target, localPosition, Misc.vector3Zero, normalWS);
if (InputProxy.GetMouseButtonDown(0) && OnObjectClicked != null) {
OnObjectClicked(target.gameObject, positionWS, normalWS);
}
}
#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) {
if (t == null) return;
// 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.camerasLayerMask = baseEffect.camerasLayerMask;
hb.ignoreObjectVisibility = baseEffect.ignoreObjectVisibility;
hb.reflectionProbes = baseEffect.reflectionProbes;
hb.normalsOption = baseEffect.normalsOption;
hb.optimizeSkinnedMesh = baseEffect.optimizeSkinnedMesh;
hb.GPUInstancing = baseEffect.GPUInstancing;
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>
/// Unselects all objects in the scene
/// </summary>
public void UnselectObjects () {
DeselectAll();
}
/// <summary>
/// Manually causes highlight manager to select an object
/// </summary>
public void SelectObject (Transform t) {
ToggleSelection(t, true);
}
/// <summary>
/// Manually causes highlight manager to select multiple objects
/// </summary>
/// <param name="objects">Array of objects to select</param>
public void SelectObjects (Transform[] objects) {
foreach (var obj in objects) {
SelectObject(obj);
}
}
public void SelectObjects (List<Transform> objects) {
foreach (var obj in objects) {
SelectObject(obj);
}
}
/// <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,301 @@
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();
static Comparison<HighlightEffect> cachedEffectComparisonDelegate;
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;
if (cachedEffectComparisonDelegate == null) {
cachedEffectComparisonDelegate = effectDistanceComparer.Compare;
}
HighlightEffect.effects.Sort(cachedEffectComparisonDelegate);
}
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 Scene View.
/// </summary>
[Tooltip("If enabled, effects will be visible also in Scene View.")]
public bool showInSceneView = 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;
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";
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;
}
CameraType camType = cam.cameraType;
if (camType == CameraType.SceneView && !showInSceneView) {
return;
}
if (!showInPreviewCamera && (camType == CameraType.Preview || cam.name.StartsWith(PREVIEW_CAMERA_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);
}
}
}

View File

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

View File

@ -0,0 +1,730 @@
using System;
using UnityEngine;
namespace HighlightPlus {
[CreateAssetMenu(menuName = "Highlight Plus Profile", fileName = "Highlight Plus Profile", order = 100)]
[HelpURL("https://www.dropbox.com/s/1p9h8xys68lm4a3/Documentation.pdf?dl=0")]
public class HighlightProfile : ScriptableObject {
[Tooltip("Different options to specify which objects are affected by this Highlight Effect component.")]
public TargetOptions effectGroup = TargetOptions.Children;
[Tooltip("The layer that contains the affected objects by this effect when effectGroup is set to LayerMask.")]
public LayerMask effectGroupLayer = -1;
[Tooltip("Only include objects whose names contains this text.")]
public string effectNameFilter;
[Tooltip("Use RegEx to determine if an object name matches the effectNameFilter.")]
public bool effectNameUseRegEx;
[Tooltip("Combine meshes of all objects in this group affected by Highlight Effect reducing draw calls.")]
public bool combineMeshes;
[Tooltip("The alpha threshold for transparent cutout objects. Pixels with alpha below this value will be discarded.")]
[Range(0, 1)]
public float alphaCutOff;
[Tooltip("If back facing triangles are ignored.Backfaces triangles are not visible but you may set this property to false to force highlight effects to act on those triangles as well.")]
public bool cullBackFaces = true;
[Tooltip("Normals handling option:\nPreserve original: use original mesh normals.\nSmooth: average normals to produce a smoother outline/glow mesh based effect.\nReorient: recomputes normals based on vertex direction to centroid.")]
public NormalsOption normalsOption;
public float fadeInDuration;
public float fadeOutDuration;
[Tooltip("Fades out effects based on distance to camera")]
public bool cameraDistanceFade;
[Tooltip("The closest distance particles can get to the camera before they fade from the camera's view.")]
public float cameraDistanceFadeNear;
[Tooltip("The farthest distance particles can get away from the camera before they fade from the camera's view.")]
public float cameraDistanceFadeFar = 1000;
[Tooltip("Keeps the outline/glow size unaffected by object distance.")]
public bool constantWidth = true;
[Tooltip("Increases the screen coverage for the outline/glow to avoid cuts when using cloth or vertex shader that transform mesh vertices")]
public int extraCoveragePixels;
[Tooltip("Minimum width when the constant width option is not used")]
[Range(0, 1)]
public float minimumWidth;
[Range(0, 1)]
[Tooltip("Intensity of the overlay effect. A value of 0 disables the overlay completely.")]
public float overlay;
public OverlayMode overlayMode = OverlayMode.WhenHighlighted;
[ColorUsage(showAlpha: false, hdr: true)] public Color overlayColor = Color.yellow;
public float overlayAnimationSpeed = 1f;
[Range(0, 1)]
public float overlayMinIntensity = 0.5f;
[Range(0, 1)]
[Tooltip("Controls the blending or mix of the overlay color with the natural colors of the object.")]
public float overlayBlending = 1.0f;
[Tooltip("Optional overlay texture.")]
public Texture2D overlayTexture;
public TextureUVSpace overlayTextureUVSpace;
public float overlayTextureScale = 1f;
public Vector2 overlayTextureScrolling;
public Visibility overlayVisibility = Visibility.Normal;
[Tooltip("Optional overlay pattern texture.")]
public OverlayPattern overlayPattern = OverlayPattern.None;
public Vector2 overlayPatternScrolling;
[Tooltip("Scale of the overlay pattern")]
[Range(1f, 100f)]
public float overlayPatternScale = 10f;
[Tooltip("Size/Thickness of the overlay pattern")]
[Range(0.01f, 1f)]
public float overlayPatternSize = 0.15f;
[Tooltip("Softness of the overlay pattern")]
[Range(0.01f, 0.5f)]
public float overlayPatternSoftness = 0.02f;
[Tooltip("Rotation angle for the overlay pattern in degrees")]
[Range(-180f, 180f)]
public float overlayPatternRotation = 0f;
[Range(0, 1)]
[Tooltip("Intensity of the outline. A value of 0 disables the outline completely.")]
public float outline = 1f;
[ColorUsage(true, true)] public Color outlineColor = Color.black;
public ColorStyle outlineColorStyle = ColorStyle.SingleColor;
[GradientUsage(hdr: true, ColorSpace.Linear)] public Gradient outlineGradient;
public bool outlineGradientInLocalSpace;
[Range(1, 3)]
public int outlineBlurPasses = 2;
public float outlineWidth = 0.45f;
public QualityLevel outlineQuality = QualityLevel.High;
public OutlineEdgeMode outlineEdgeMode = OutlineEdgeMode.Exterior;
public float outlineEdgeThreshold = 0.995f;
[Tooltip("Controls how quickly the outline effect scales down with distance when constant width is disabled. Lower values make the effect fade faster with distance.")]
public float outlineDistanceScaleBias = 25f;
public float outlineSharpness = 1f;
[Range(1, 8)]
[Tooltip("Reduces the quality of the outline but improves performance a bit.")]
public int outlineDownsampling = 1;
public ContourStyle outlineContourStyle = ContourStyle.AroundVisibleParts;
public float outlineGradientKnee = 0.4f;
public float outlineGradientPower = 8f;
[Tooltip("Enables stylized outline effect.")]
public bool outlineStylized;
[Tooltip("Pattern texture used for the stylized outline effect.")]
public Texture2D outlinePattern;
[Tooltip("Scale of the pattern texture.")]
public float outlinePatternScale = 0.3f;
[Tooltip("Threshold for the pattern texture.")]
[Range(0, 1)]
public float outlinePatternThreshold = 0.3f;
[Tooltip("Distortion amount for the pattern texture.")]
[Range(0, 1.5f)]
public float outlinePatternDistortionAmount = 0.5f;
[Tooltip("Stop motion scale for the distortion effect.")]
public float outlinePatternStopMotionScale = 5f;
[Tooltip("Distortion texture used for the stylized outline effect.")]
public Texture2D outlinePatternDistortionTexture;
[Tooltip("Adds a empty margin between the outline mesh and the effects")]
[Range(0, 1)]
public float padding;
[Tooltip("Enables dashed outline effect.")]
public bool outlineDashed;
[Tooltip("Width of the dashed outline.")]
[Range(0, 1)]
public float outlineDashWidth = 0.5f;
[Tooltip("Gap of the dashed outline.")]
[Range(0, 1)]
public float outlineDashGap = 0.3f;
[Tooltip("Speed of the dashed outline.")]
public float outlineDashSpeed = 2f;
public Visibility outlineVisibility = Visibility.Normal;
[Tooltip("If enabled, this object won't combine the outline with other objects.")]
public bool outlineIndependent;
[Tooltip("Select the mask mode used with this effect.")]
public MaskMode outlineMaskMode = MaskMode.Stencil;
[Range(0, 5)]
[Tooltip("The intensity of the outer glow effect. A value of 0 disables the glow completely.")]
public float glow;
public float glowWidth = 0.4f;
public QualityLevel glowQuality = QualityLevel.High;
public BlurMethod glowBlurMethod = BlurMethod.Gaussian;
public bool glowHighPrecision = true;
[Tooltip("Controls how quickly the glow effect scales down with distance when constant width is disabled. Lower values make the effect fade faster with distance.")]
public float glowDistanceScaleBias = 25f;
[Range(1, 8)]
[Tooltip("Reduces the quality of the glow but improves performance a bit.")]
public int glowDownsampling = 2;
[ColorUsage(true, true)] public Color glowHQColor = new Color(0.64f, 1f, 0f, 1f);
[Tooltip("When enabled, outer glow renders with dithering. When disabled, glow appears as a solid color.")]
[Range(0, 1)]
public float glowDithering = 1;
public GlowDitheringStyle glowDitheringStyle = GlowDitheringStyle.Pattern;
[Tooltip("Seed for the dithering effect")]
public float glowMagicNumber1 = 0.75f;
[Tooltip("Another seed for the dithering effect that combines with first seed to create different patterns")]
public float glowMagicNumber2 = 0.5f;
public float glowAnimationSpeed = 1f;
public Visibility glowVisibility = Visibility.Normal;
public GlowBlendMode glowBlendMode = GlowBlendMode.Additive;
[Tooltip("Blends glow passes one after another. If this option is disabled, glow passes won't overlap (in this case, make sure the glow pass 1 has a smaller offset than pass 2, etc.)")]
public bool glowBlendPasses = true;
public GlowPassData[] glowPasses;
[Tooltip("Select the mask mode used with this effect.")]
public MaskMode glowMaskMode = MaskMode.Stencil;
[Range(0, 5f)]
[Tooltip("The intensity of the inner glow effect. A value of 0 disables the glow completely.")]
public float innerGlow;
[Range(0, 2)]
public float innerGlowWidth = 1f;
public float innerGlowPower = 1f;
public InnerGlowBlendMode innerGlowBlendMode = InnerGlowBlendMode.Additive;
[ColorUsage(true, true)] public Color innerGlowColor = Color.white;
public Visibility innerGlowVisibility = Visibility.Normal;
[Tooltip("Enables the targetFX effect. This effect draws an animated sprite over the object.")]
public bool targetFX;
[Tooltip("Style of the target FX effect.")]
public TargetFXStyle targetFXStyle = TargetFXStyle.Texture;
[Tooltip("Width of the frame when using Frame style.")]
[Range(0.001f, 0.5f)]
public float targetFXFrameWidth = 0.1f;
[Tooltip("Length of the frame corners when using Frame style.")]
[Range(0.1f, 1f)]
public float targetFXCornerLength = 0.25f;
[Tooltip("Minimum opacity of the frame when using Frame style.")]
[Range(0, 1)]
public float targetFXFrameMinOpacity;
public Texture2D targetFXTexture;
[ColorUsage(true, true)] public Color targetFXColor = Color.white;
public float targetFXRotationSpeed = 50f;
public float targetFXRotationAngle;
public float targetFXInitialScale = 4f;
public float targetFXEndScale = 1.5f;
[Tooltip("Makes target scale relative to object renderer bounds.")]
public bool targetFXScaleToRenderBounds;
[Tooltip("Makes target FX effect square")]
public bool targetFXSquare = true;
[Tooltip("Places target FX sprite at the bottom of the highlighted object.")]
public bool targetFXAlignToGround;
[Tooltip("Max distance from the center of the highlighted object to the ground.")]
public float targetFXGroundMaxDistance = 15f;
public LayerMask targetFXGroundLayerMask = -1;
[Tooltip("Fade out effect with altitude")]
public float targetFXFadePower = 32;
[Tooltip("Enable to render a single target FX effect at the center of the enclosing bounds")]
public bool targetFXUseEnclosingBounds;
[Tooltip("Optional world space offset for the position of the targetFX effect")]
public Vector3 targetFXOffset;
[Tooltip("If enabled, the target FX effect will be centered on the hit position")]
public bool targetFxCenterOnHitPosition;
[Tooltip("If enabled, the target FX effect will align to the hit normal")]
public bool targetFxAlignToNormal;
public float targetFXTransitionDuration = 0.5f;
[Tooltip("0 = stay forever")]
public float targetFXStayDuration = 1.5f;
public Visibility targetFXVisibility = Visibility.AlwaysOnTop;
[Tooltip("If the ground is transparent, the effect won't work. You can set this property to the altitude of the transparent ground to force the effect to render at this altitude.")]
public float targetFXGroundMinAltitude = -1000;
[Tooltip("Enables the iconFX effect. This effect draws an animated object over the object.")]
public bool iconFX;
public IconAssetType iconFXAssetType;
public GameObject iconFXPrefab;
public Mesh iconFXMesh;
[ColorUsage(true, true)] public Color iconFXLightColor = Color.white;
[ColorUsage(true, true)] public Color iconFXDarkColor = Color.gray;
public float iconFXRotationSpeed = 50f;
public IconAnimationOption iconFXAnimationOption = IconAnimationOption.None;
public float iconFXAnimationAmount = 0.1f;
public float iconFXAnimationSpeed = 3f;
public float iconFXScale = 1f;
[Tooltip("Makes target scale relative to object renderer bounds.")]
public bool iconFXScaleToRenderBounds;
[Tooltip("Optional world space offset for the position of the iconFX effect")]
public Vector3 iconFXOffset = new Vector3(0, 1, 0);
public float iconFXTransitionDuration = 0.5f;
[Tooltip("0 = stay forever")]
public float iconFXStayDuration = 1.5f;
[Tooltip("Enables the label effect. This effect shows a text label over the object.")]
public bool labelEnabled;
[Tooltip("The text to display in the label")]
public string labelText = "Label";
[Tooltip("The size of the label text")]
public float labelTextSize = 14;
[ColorUsage(true, true)] public Color labelColor = Color.white;
[Tooltip("The prefab to use for the label. Must contain a Canvas and TextMeshProUGUI component.")]
public GameObject labelPrefab;
public float labelVerticalOffset;
[Tooltip("The horizontal offset of the label with respect to the object bounds")]
public float lineLength = 200;
[Tooltip("If enabled, the label will follow the cursor when hovering the object")]
public bool labelFollowCursor = true;
public LabelMode labelMode = LabelMode.WhenHighlighted;
[Tooltip("If enabled, the label will be shown in editor mode (non playing)")]
public bool labelShowInEditorMode = true;
[Tooltip("Controls the alignment of the label relative to the target object on screen.")]
public LabelAlignment labelAlignment = LabelAlignment.Auto;
[Tooltip("See-through mode for this Highlight Effect component.")]
public SeeThroughMode seeThrough = SeeThroughMode.Never;
[Tooltip("This mask setting let you specify which objects will be considered as occluders and cause the see-through effect for this Highlight Effect component. For example, you assign your walls to a different layer and specify that layer here, so only walls and not other objects, like ground or ceiling, will trigger the see-through effect.")]
public LayerMask seeThroughOccluderMask = -1;
[Tooltip("Uses stencil buffers to ensure pixel-accurate occlusion test. If this option is disabled, only physics raycasting is used to test for occlusion.")]
public bool seeThroughOccluderMaskAccurate;
[Tooltip("A multiplier for the occluder volume size which can be used to reduce the actual size of occluders when Highlight Effect checks if they're occluding this object.")]
[Range(0.01f, 0.9f)] public float seeThroughOccluderThreshold = 0.4f;
[Tooltip("The interval of time between occlusion tests.")]
public float seeThroughOccluderCheckInterval = 1f;
[Tooltip("If enabled, occlusion test is performed for each children element. If disabled, the bounds of all children is combined and a single occlusion test is performed for the combined bounds.")]
public bool seeThroughOccluderCheckIndividualObjects;
[Tooltip("Shows the see-through effect only if the occluder if at this 'offset' distance from the object.")]
public float seeThroughDepthOffset;
[Tooltip("Hides the see-through effect if the occluder is further than this distance from the object (0 = infinite)")]
public float seeThroughMaxDepth;
[Range(0, 5f)] public float seeThroughIntensity = 0.8f;
[Range(0, 1)] public float seeThroughTintAlpha = 0.5f;
public Color seeThroughTintColor = Color.red;
[Range(0, 1)] public float seeThroughNoise = 1f;
[Range(0, 1)] public float seeThroughBorder;
public Color seeThroughBorderColor = Color.black;
public float seeThroughBorderWidth = 0.45f;
[Tooltip("Only display the border instead of the full see-through effect.")]
public bool seeThroughBorderOnly;
[Tooltip("This option clears the stencil buffer after rendering the see-through effect which results in correct rendering order and supports other stencil-based effects that render afterwards.")]
public bool seeThroughOrdered;
[Tooltip("Optional see-through mask effect texture.")]
public Texture2D seeThroughTexture;
public TextureUVSpace seeThroughTextureUVSpace;
public float seeThroughTextureScale = 1f;
[Tooltip("The order by which children objects are rendered by the see-through effect")]
public SeeThroughSortingMode seeThroughChildrenSortingMode = SeeThroughSortingMode.Default;
[Range(0, 1)] public float hitFxInitialIntensity;
public HitFxMode hitFxMode = HitFxMode.Overlay;
public HitFXTriggerMode hitFXTriggerMode = HitFXTriggerMode.Scripting;
public float hitFxFadeOutDuration = 0.25f;
[ColorUsage(true, true)] public Color hitFxColor = Color.white;
public float hitFxRadius = 0.5f;
public void Load (HighlightEffect effect) {
effect.effectGroup = effectGroup;
effect.effectGroupLayer = effectGroupLayer;
effect.effectNameFilter = effectNameFilter;
effect.effectNameUseRegEx = effectNameUseRegEx;
effect.combineMeshes = combineMeshes;
effect.alphaCutOff = alphaCutOff;
effect.cullBackFaces = cullBackFaces;
effect.padding = padding;
effect.normalsOption = normalsOption;
effect.fadeInDuration = fadeInDuration;
effect.fadeOutDuration = fadeOutDuration;
effect.cameraDistanceFade = cameraDistanceFade;
effect.cameraDistanceFadeFar = cameraDistanceFadeFar;
effect.cameraDistanceFadeNear = cameraDistanceFadeNear;
effect.constantWidth = constantWidth;
effect.extraCoveragePixels = extraCoveragePixels;
effect.minimumWidth = minimumWidth;
effect.overlay = overlay;
effect.overlayMode = overlayMode;
effect.overlayColor = overlayColor;
effect.overlayAnimationSpeed = overlayAnimationSpeed;
effect.overlayMinIntensity = overlayMinIntensity;
effect.overlayBlending = overlayBlending;
effect.overlayTexture = overlayTexture;
effect.overlayTextureUVSpace = overlayTextureUVSpace;
effect.overlayTextureScale = overlayTextureScale;
effect.overlayTextureScrolling = overlayTextureScrolling;
effect.overlayVisibility = overlayVisibility;
effect.overlayPattern = overlayPattern;
effect.overlayPatternScrolling = overlayPatternScrolling;
effect.overlayPatternScale = overlayPatternScale;
effect.overlayPatternSize = overlayPatternSize;
effect.overlayPatternSoftness = overlayPatternSoftness;
effect.overlayPatternRotation = overlayPatternRotation;
effect.outline = outline;
effect.outlineColor = outlineColor;
effect.outlineColorStyle = outlineColorStyle;
effect.outlineGradient = outlineGradient;
effect.outlineGradientInLocalSpace = outlineGradientInLocalSpace;
effect.outlineWidth = outlineWidth;
effect.outlineBlurPasses = outlineBlurPasses;
effect.outlineQuality = outlineQuality;
effect.outlineEdgeMode = outlineEdgeMode;
effect.outlineEdgeThreshold = outlineEdgeThreshold;
effect.outlineDistanceScaleBias = outlineDistanceScaleBias;
effect.outlineSharpness = outlineSharpness;
effect.outlineDownsampling = outlineDownsampling;
effect.outlineVisibility = outlineVisibility;
effect.outlineIndependent = outlineIndependent;
effect.outlineContourStyle = outlineContourStyle;
effect.outlineMaskMode = outlineMaskMode;
effect.outlineStylized = outlineStylized;
effect.outlinePattern = outlinePattern;
effect.outlinePatternScale = outlinePatternScale;
effect.outlinePatternThreshold = outlinePatternThreshold;
effect.outlinePatternDistortionTexture = outlinePatternDistortionTexture;
effect.outlinePatternDistortionAmount = outlinePatternDistortionAmount;
effect.outlinePatternStopMotionScale = outlinePatternStopMotionScale;
effect.outlineDashed = outlineDashed;
effect.outlineDashWidth = outlineDashWidth;
effect.outlineDashGap = outlineDashGap;
effect.outlineDashSpeed = outlineDashSpeed;
effect.outlineGradientKnee = outlineGradientKnee;
effect.outlineGradientPower = outlineGradientPower;
effect.glow = glow;
effect.glowWidth = glowWidth;
effect.glowQuality = glowQuality;
effect.glowBlurMethod = glowBlurMethod;
effect.glowHighPrecision = glowHighPrecision;
effect.glowDistanceScaleBias = glowDistanceScaleBias;
effect.glowDownsampling = glowDownsampling;
effect.glowHQColor = glowHQColor;
effect.glowDithering = glowDithering;
effect.glowDitheringStyle = glowDitheringStyle;
effect.glowMagicNumber1 = glowMagicNumber1;
effect.glowMagicNumber2 = glowMagicNumber2;
effect.glowAnimationSpeed = glowAnimationSpeed;
effect.glowVisibility = glowVisibility;
effect.glowBlendMode = glowBlendMode;
effect.glowBlendPasses = glowBlendPasses;
effect.glowPasses = GetGlowPassesCopy(glowPasses);
effect.glowMaskMode = glowMaskMode;
effect.innerGlow = innerGlow;
effect.innerGlowWidth = innerGlowWidth;
effect.innerGlowPower = innerGlowPower;
effect.innerGlowColor = innerGlowColor;
effect.innerGlowBlendMode = innerGlowBlendMode;
effect.innerGlowVisibility = innerGlowVisibility;
effect.targetFX = targetFX;
effect.targetFXColor = targetFXColor;
effect.targetFXInitialScale = targetFXInitialScale;
effect.targetFXEndScale = targetFXEndScale;
effect.targetFXScaleToRenderBounds = targetFXScaleToRenderBounds;
effect.targetFXAlignToGround = targetFXAlignToGround;
effect.targetFXGroundMaxDistance = targetFXGroundMaxDistance;
effect.targetFXGroundLayerMask = targetFXGroundLayerMask;
effect.targetFXFadePower = targetFXFadePower;
effect.targetFXRotationSpeed = targetFXRotationSpeed;
effect.targetFXRotationAngle = targetFXRotationAngle;
effect.targetFXStayDuration = targetFXStayDuration;
effect.targetFXTexture = targetFXTexture;
effect.targetFXTransitionDuration = targetFXTransitionDuration;
effect.targetFXVisibility = targetFXVisibility;
effect.targetFXUseEnclosingBounds = targetFXUseEnclosingBounds;
effect.targetFXSquare = targetFXSquare;
effect.targetFXOffset = targetFXOffset;
effect.targetFxCenterOnHitPosition = targetFxCenterOnHitPosition;
effect.targetFxAlignToNormal = targetFxAlignToNormal;
effect.targetFXStyle = targetFXStyle;
effect.targetFXFrameWidth = targetFXFrameWidth;
effect.targetFXCornerLength = targetFXCornerLength;
effect.targetFXFrameMinOpacity = targetFXFrameMinOpacity;
effect.targetFXGroundMinAltitude = targetFXGroundMinAltitude;
effect.iconFX = iconFX;
effect.iconFXAssetType = iconFXAssetType;
effect.iconFXPrefab = iconFXPrefab;
effect.iconFXMesh = iconFXMesh;
effect.iconFXLightColor = iconFXLightColor;
effect.iconFXDarkColor = iconFXDarkColor;
effect.iconFXAnimationOption = iconFXAnimationOption;
effect.iconFXAnimationAmount = iconFXAnimationAmount;
effect.iconFXAnimationSpeed = iconFXAnimationSpeed;
effect.iconFXScale = iconFXScale;
effect.iconFXScaleToRenderBounds = iconFXScaleToRenderBounds;
effect.iconFXOffset = iconFXOffset;
effect.iconFXRotationSpeed = iconFXRotationSpeed;
effect.iconFXStayDuration = iconFXStayDuration;
effect.iconFXTransitionDuration = iconFXTransitionDuration;
effect.seeThrough = seeThrough;
effect.seeThroughOccluderMask = seeThroughOccluderMask;
effect.seeThroughOccluderMaskAccurate = seeThroughOccluderMaskAccurate;
effect.seeThroughOccluderThreshold = seeThroughOccluderThreshold;
effect.seeThroughOccluderCheckInterval = seeThroughOccluderCheckInterval;
effect.seeThroughOccluderCheckIndividualObjects = seeThroughOccluderCheckIndividualObjects;
effect.seeThroughIntensity = seeThroughIntensity;
effect.seeThroughTintAlpha = seeThroughTintAlpha;
effect.seeThroughTintColor = seeThroughTintColor;
effect.seeThroughNoise = seeThroughNoise;
effect.seeThroughBorder = seeThroughBorder;
effect.seeThroughBorderColor = seeThroughBorderColor;
effect.seeThroughBorderWidth = seeThroughBorderWidth;
effect.seeThroughBorderOnly = seeThroughBorderOnly;
effect.seeThroughDepthOffset = seeThroughDepthOffset;
effect.seeThroughMaxDepth = seeThroughMaxDepth;
effect.seeThroughOrdered = seeThroughOrdered;
effect.seeThroughTexture = seeThroughTexture;
effect.seeThroughTextureScale = seeThroughTextureScale;
effect.seeThroughTextureUVSpace = seeThroughTextureUVSpace;
effect.seeThroughChildrenSortingMode = seeThroughChildrenSortingMode;
effect.hitFxInitialIntensity = hitFxInitialIntensity;
effect.hitFxMode = hitFxMode;
effect.hitFXTriggerMode = hitFXTriggerMode;
effect.hitFxFadeOutDuration = hitFxFadeOutDuration;
effect.hitFxColor = hitFxColor;
effect.hitFxRadius = hitFxRadius;
effect.labelEnabled = labelEnabled;
effect.labelText = labelText;
effect.labelTextSize = labelTextSize;
effect.labelColor = labelColor;
effect.labelPrefab = labelPrefab;
effect.labelVerticalOffset = labelVerticalOffset;
effect.lineLength = lineLength;
effect.labelFollowCursor = labelFollowCursor;
effect.labelMode = labelMode;
effect.labelAlignment = labelAlignment;
effect.labelShowInEditorMode = labelShowInEditorMode;
effect.UpdateMaterialProperties();
}
public void Save (HighlightEffect effect) {
effectGroup = effect.effectGroup;
effectGroupLayer = effect.effectGroupLayer;
effectNameFilter = effect.effectNameFilter;
effectNameUseRegEx = effect.effectNameUseRegEx;
combineMeshes = effect.combineMeshes;
alphaCutOff = effect.alphaCutOff;
cullBackFaces = effect.cullBackFaces;
padding = effect.padding;
normalsOption = effect.normalsOption;
fadeInDuration = effect.fadeInDuration;
fadeOutDuration = effect.fadeOutDuration;
cameraDistanceFade = effect.cameraDistanceFade;
cameraDistanceFadeFar = effect.cameraDistanceFadeFar;
cameraDistanceFadeNear = effect.cameraDistanceFadeNear;
constantWidth = effect.constantWidth;
extraCoveragePixels = effect.extraCoveragePixels;
minimumWidth = effect.minimumWidth;
overlay = effect.overlay;
overlayMode = effect.overlayMode;
overlayColor = effect.overlayColor;
overlayAnimationSpeed = effect.overlayAnimationSpeed;
overlayMinIntensity = effect.overlayMinIntensity;
overlayBlending = effect.overlayBlending;
overlayTexture = effect.overlayTexture;
overlayTextureUVSpace = effect.overlayTextureUVSpace;
overlayTextureScale = effect.overlayTextureScale;
overlayTextureScrolling = effect.overlayTextureScrolling;
overlayVisibility = effect.overlayVisibility;
overlayPattern = effect.overlayPattern;
overlayPatternScrolling = effect.overlayPatternScrolling;
overlayPatternScale = effect.overlayPatternScale;
overlayPatternSize = effect.overlayPatternSize;
overlayPatternSoftness = effect.overlayPatternSoftness;
overlayPatternRotation = effect.overlayPatternRotation;
outline = effect.outline;
outlineColor = effect.outlineColor;
outlineColorStyle = effect.outlineColorStyle;
outlineGradient = effect.outlineGradient;
outlineGradientInLocalSpace = effect.outlineGradientInLocalSpace;
outlineWidth = effect.outlineWidth;
outlineBlurPasses = effect.outlineBlurPasses;
outlineQuality = effect.outlineQuality;
outlineEdgeMode = effect.outlineEdgeMode;
outlineEdgeThreshold = effect.outlineEdgeThreshold;
outlineDistanceScaleBias = effect.outlineDistanceScaleBias;
outlineSharpness = effect.outlineSharpness;
outlineDownsampling = effect.outlineDownsampling;
outlineVisibility = effect.outlineVisibility;
outlineIndependent = effect.outlineIndependent;
outlineContourStyle = effect.outlineContourStyle;
outlineMaskMode = effect.outlineMaskMode;
outlineStylized = effect.outlineStylized;
outlinePattern = effect.outlinePattern;
outlinePatternScale = effect.outlinePatternScale;
outlinePatternThreshold = effect.outlinePatternThreshold;
outlinePatternDistortionTexture = effect.outlinePatternDistortionTexture;
outlinePatternDistortionAmount = effect.outlinePatternDistortionAmount;
outlinePatternStopMotionScale = effect.outlinePatternStopMotionScale;
outlineDashed = effect.outlineDashed;
outlineDashWidth = effect.outlineDashWidth;
outlineDashGap = effect.outlineDashGap;
outlineDashSpeed = effect.outlineDashSpeed;
outlineGradientKnee = effect.outlineGradientKnee;
outlineGradientPower = effect.outlineGradientPower;
glow = effect.glow;
glowWidth = effect.glowWidth;
glowQuality = effect.glowQuality;
glowHighPrecision = effect.glowHighPrecision;
glowBlurMethod = effect.glowBlurMethod;
glowDistanceScaleBias = effect.glowDistanceScaleBias;
glowDownsampling = effect.glowDownsampling;
glowHQColor = effect.glowHQColor;
glowDithering = effect.glowDithering;
glowDitheringStyle = effect.glowDitheringStyle;
glowMagicNumber1 = effect.glowMagicNumber1;
glowMagicNumber2 = effect.glowMagicNumber2;
glowAnimationSpeed = effect.glowAnimationSpeed;
glowVisibility = effect.glowVisibility;
glowBlendMode = effect.glowBlendMode;
glowBlendPasses = effect.glowBlendPasses;
glowPasses = GetGlowPassesCopy(effect.glowPasses);
glowMaskMode = effect.glowMaskMode;
innerGlow = effect.innerGlow;
innerGlowWidth = effect.innerGlowWidth;
innerGlowPower = effect.innerGlowPower;
innerGlowColor = effect.innerGlowColor;
innerGlowBlendMode = effect.innerGlowBlendMode;
innerGlowVisibility = effect.innerGlowVisibility;
targetFX = effect.targetFX;
targetFXColor = effect.targetFXColor;
targetFXInitialScale = effect.targetFXInitialScale;
targetFXEndScale = effect.targetFXEndScale;
targetFXScaleToRenderBounds = effect.targetFXScaleToRenderBounds;
targetFXAlignToGround = effect.targetFXAlignToGround;
targetFXGroundMaxDistance = effect.targetFXGroundMaxDistance;
targetFXGroundLayerMask = effect.targetFXGroundLayerMask;
targetFXFadePower = effect.targetFXFadePower;
targetFXRotationSpeed = effect.targetFXRotationSpeed;
targetFXRotationAngle = effect.targetFXRotationAngle;
targetFXStayDuration = effect.targetFXStayDuration;
targetFXTexture = effect.targetFXTexture;
targetFXTransitionDuration = effect.targetFXTransitionDuration;
targetFXVisibility = effect.targetFXVisibility;
targetFXUseEnclosingBounds = effect.targetFXUseEnclosingBounds;
targetFXSquare = effect.targetFXSquare;
targetFXOffset = effect.targetFXOffset;
targetFxCenterOnHitPosition = effect.targetFxCenterOnHitPosition;
targetFxAlignToNormal = effect.targetFxAlignToNormal;
targetFXStyle = effect.targetFXStyle;
targetFXFrameWidth = effect.targetFXFrameWidth;
targetFXCornerLength = effect.targetFXCornerLength;
targetFXFrameMinOpacity = effect.targetFXFrameMinOpacity;
targetFXGroundMinAltitude = effect.targetFXGroundMinAltitude;
iconFX = effect.iconFX;
iconFXAssetType = effect.iconFXAssetType;
iconFXPrefab = effect.iconFXPrefab;
iconFXMesh = effect.iconFXMesh;
iconFXLightColor = effect.iconFXLightColor;
iconFXDarkColor = effect.iconFXDarkColor;
iconFXAnimationOption = effect.iconFXAnimationOption;
iconFXAnimationAmount = effect.iconFXAnimationAmount;
iconFXAnimationSpeed = effect.iconFXAnimationSpeed;
iconFXScaleToRenderBounds = effect.iconFXScaleToRenderBounds;
iconFXScale = effect.iconFXScale;
iconFXOffset = effect.iconFXOffset;
iconFXRotationSpeed = effect.iconFXRotationSpeed;
iconFXStayDuration = effect.iconFXStayDuration;
iconFXTransitionDuration = effect.iconFXTransitionDuration;
seeThrough = effect.seeThrough;
seeThroughOccluderMask = effect.seeThroughOccluderMask;
seeThroughOccluderMaskAccurate = effect.seeThroughOccluderMaskAccurate;
seeThroughOccluderThreshold = effect.seeThroughOccluderThreshold;
seeThroughOccluderCheckInterval = effect.seeThroughOccluderCheckInterval;
seeThroughOccluderCheckIndividualObjects = effect.seeThroughOccluderCheckIndividualObjects;
seeThroughIntensity = effect.seeThroughIntensity;
seeThroughTintAlpha = effect.seeThroughTintAlpha;
seeThroughTintColor = effect.seeThroughTintColor;
seeThroughNoise = effect.seeThroughNoise;
seeThroughBorder = effect.seeThroughBorder;
seeThroughBorderColor = effect.seeThroughBorderColor;
seeThroughBorderWidth = effect.seeThroughBorderWidth;
seeThroughDepthOffset = effect.seeThroughDepthOffset;
seeThroughBorderOnly = effect.seeThroughBorderOnly;
seeThroughMaxDepth = effect.seeThroughMaxDepth;
seeThroughOrdered = effect.seeThroughOrdered;
seeThroughTexture = effect.seeThroughTexture;
seeThroughTextureScale = effect.seeThroughTextureScale;
seeThroughTextureUVSpace = effect.seeThroughTextureUVSpace;
seeThroughChildrenSortingMode = effect.seeThroughChildrenSortingMode;
hitFxInitialIntensity = effect.hitFxInitialIntensity;
hitFxMode = effect.hitFxMode;
hitFXTriggerMode = effect.hitFXTriggerMode;
hitFxFadeOutDuration = effect.hitFxFadeOutDuration;
hitFxColor = effect.hitFxColor;
hitFxRadius = effect.hitFxRadius;
labelEnabled = effect.labelEnabled;
labelText = effect.labelText;
labelTextSize = effect.labelTextSize;
labelColor = effect.labelColor;
labelPrefab = effect.labelPrefab;
labelVerticalOffset = effect.labelVerticalOffset;
lineLength = effect.lineLength;
labelFollowCursor = effect.labelFollowCursor;
labelMode = effect.labelMode;
labelAlignment = effect.labelAlignment;
labelShowInEditorMode = effect.labelShowInEditorMode;
}
GlowPassData[] GetGlowPassesCopy (GlowPassData[] glowPasses) {
if (glowPasses == null) {
return new GlowPassData[0];
}
GlowPassData[] pd = new GlowPassData[glowPasses.Length];
for (int k = 0; k < glowPasses.Length; k++) {
pd[k].alpha = glowPasses[k].alpha;
pd[k].color = glowPasses[k].color;
pd[k].offset = glowPasses[k].offset;
}
return pd;
}
public void OnValidate () {
outlineGradientKnee = Mathf.Max(0f, outlineGradientKnee);
outlineGradientPower = Mathf.Max(0f, outlineGradientPower);
outlineEdgeThreshold = Mathf.Clamp01(outlineEdgeThreshold);
outlineSharpness = Mathf.Max(outlineSharpness, 1f);
outlineDistanceScaleBias = Mathf.Max(1, outlineDistanceScaleBias);
extraCoveragePixels = Mathf.Max(0, extraCoveragePixels);
glowWidth = Mathf.Max(0, glowWidth);
glowAnimationSpeed = Mathf.Max(0, glowAnimationSpeed);
glowDistanceScaleBias = Mathf.Max(1, glowDistanceScaleBias);
outlineDistanceScaleBias = Mathf.Max(1, outlineDistanceScaleBias);
overlayAnimationSpeed = Mathf.Max(0, overlayAnimationSpeed);
innerGlowPower = Mathf.Max(1f, innerGlowPower);
seeThroughDepthOffset = Mathf.Max(0, seeThroughDepthOffset);
seeThroughMaxDepth = Mathf.Max(0, seeThroughMaxDepth);
seeThroughBorderWidth = Mathf.Max(0, seeThroughBorderWidth);
targetFXFadePower = Mathf.Max(0, targetFXFadePower);
cameraDistanceFadeNear = Mathf.Max(0, cameraDistanceFadeNear);
cameraDistanceFadeFar = Mathf.Max(0, cameraDistanceFadeFar);
iconFXScale = Mathf.Max(0, iconFXScale);
iconFXAnimationAmount = Mathf.Max(0, iconFXAnimationAmount);
iconFXAnimationSpeed = Mathf.Max(0, iconFXAnimationSpeed);
outlinePatternScale = Mathf.Max(0, outlinePatternScale);
outlinePatternDistortionAmount = Mathf.Max(0, outlinePatternDistortionAmount);
outlinePatternThreshold = Mathf.Max(0, outlinePatternThreshold);
outlinePatternStopMotionScale = Mathf.Max(1, outlinePatternStopMotionScale);
if (glowPasses == null || glowPasses.Length == 0) {
glowPasses = new GlowPassData[4];
glowPasses[0] = new GlowPassData() { offset = 4, alpha = 0.1f, color = new Color(0.64f, 1f, 0f, 1f) };
glowPasses[1] = new GlowPassData() { offset = 3, alpha = 0.2f, color = new Color(0.64f, 1f, 0f, 1f) };
glowPasses[2] = new GlowPassData() { offset = 2, alpha = 0.3f, color = new Color(0.64f, 1f, 0f, 1f) };
glowPasses[3] = new GlowPassData() { offset = 1, alpha = 0.4f, color = new Color(0.64f, 1f, 0f, 1f) };
}
if (labelPrefab == null) {
labelPrefab = Resources.Load<GameObject>("HighlightPlus/Label");
}
lineLength = Mathf.Max(0, lineLength);
}
}
}

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