2026-04-24 버그수정 및 대사에 맞춘 캐릭터 동작

This commit is contained in:
2026-04-24 19:41:08 +09:00
parent 752b891a48
commit 9963eba810
273 changed files with 19320 additions and 206 deletions

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,27 @@
#ifndef CUSTOM_VERTEX_TRANSFORM_INCLUDED
#define CUSTOM_VERTEX_TRANSFORM_INCLUDED
int _HP_VertexTransformMode;
float4 ComputeVertexPosition(float4 vertex) {
// Add custom vertex transforms here based on _HP_VertexTransformMode
// Mode 0: default transform
// Mode 1+: add your custom transforms below
UNITY_BRANCH
switch (_HP_VertexTransformMode) {
case 1:
// Example: custom transform 1
// vertex.xyz += ...
break;
case 2:
// Example: custom transform 2
// vertex.xyz += ...
break;
default:
// Default transform
break;
}
return UnityObjectToClipPos(vertex);
}
#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,129 @@
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
[HideInInspector] _Pixelation("Pixelation", Int) = 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;
int _Pixelation;
#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;
if (_Pixelation > 1) {
float2 pixel_uv = uv * _HPSourceRT_TexelSize.zw;
pixel_uv = (floor(pixel_uv / _Pixelation) + 0.5) * _Pixelation;
uv = pixel_uv * _HPSourceRT_TexelSize.xy;
}
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,177 @@
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
_Pixelation("Pixelation", 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;
int _Pixelation;
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 (_Pixelation > 1) {
float2 pixel_uv = uv * _HPSourceRT_TexelSize.zw;
pixel_uv = (floor(pixel_uv / _Pixelation) + 0.5) * _Pixelation;
uv = pixel_uv * _HPSourceRT_TexelSize.xy;
}
#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,116 @@
Shader "HighlightPlus/Geometry/Focus"
{
Properties
{
_FocusColor ("Focus Color", Color) = (0,0,0,0.5)
_FocusDesaturation ("Focus Desaturation", Range(0,1)) = 0
}
SubShader
{
ZTest Always
ZWrite Off
Cull Off
Pass // 0: Dim only (no blur)
{
Stencil {
Ref 8
Comp NotEqual
ReadMask 8
}
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
fixed4 _FocusColor;
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 _FocusColor;
}
ENDCG
}
Pass // 1: Blur/desaturation composite
{
Stencil {
Ref 8
Comp NotEqual
ReadMask 8
}
CGPROGRAM
#pragma vertex vertBlur
#pragma fragment fragBlur
#include "UnityCG.cginc"
fixed4 _FocusColor;
fixed _FocusDesaturation;
UNITY_DECLARE_SCREENSPACE_TEXTURE(_FocusBlurTex);
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 pos : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vertBlur (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 = float4(v.vertex.xy, 0, 0.5);
return o;
}
fixed4 fragBlur (v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float2 uv = i.pos.xy / _ScreenParams.xy;
fixed4 blurred = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_FocusBlurTex, uv);
fixed luminance = dot(blurred.rgb, fixed3(0.299, 0.587, 0.114));
blurred.rgb = lerp(blurred.rgb, luminance, _FocusDesaturation);
fixed3 result = blurred.rgb * (1.0 - _FocusColor.a) + _FocusColor.rgb * _FocusColor.a;
return fixed4(result, 1.0);
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 71ef79d073c2e43078d0e8f03e16f07e
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
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 [_MaskStencilRef]
Comp always
Pass replace
WriteMask [_MaskWriteMask]
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 [_MaskStencilRef]
Comp always
Pass replace
WriteMask [_MaskWriteMask]
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,195 @@
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
float z_dir = lerp(z, 2.0, _ConstantWidth);
o.pos.xy += offset * z * _OutlineWidth + outlineDirection.xy * z_dir;
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
float z_dir = lerp(z, 2.0, _ConstantWidth);
o.pos.xy += offset * z * _OutlineWidth + outlineDirection.xy * z_dir;
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,280 @@
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)
_OverlayBlendDst("Overlay Blend Dst", Int) = 10
}
SubShader
{
Tags { "Queue"="Transparent+121" "RenderType"="Transparent" "DisableBatching"="True" }
// Overlay
Pass
{
Name "Overlay"
Stencil {
Ref 4
ReadMask 4
Comp NotEqual
Pass keep
}
Blend SrcAlpha [_OverlayBlendDst]
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_TRIPLANAR_LOCAL 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;
#elif HP_TEXTURE_TRIPLANAR_LOCAL
float3 lnorm : TEXCOORD2;
float3 lpos : TEXCOORD4;
#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);
#elif HP_TEXTURE_TRIPLANAR_LOCAL
o.lpos = v.vertex.xyz;
o.lnorm = 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_TRIPLANAR_LOCAL
half3 triblend = saturate(pow(i.lnorm, 4));
triblend /= max(dot(triblend, half3(1,1,1)), 0.0001);
float3 tpos = i.lpos;
float2 uvX = tpos.zy;
float2 uvY = tpos.xz;
float2 uvZ = tpos.xy;
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,184 @@
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
_SeeThroughFadeRange("Fade Range", 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;
float _SeeThroughFadeRange;
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);
float dd = i.depth - sceneDepth;
if (dd - _SeeThroughDepthOffset < 0) discard;
float fadeMul = 1.0;
if (_SeeThroughMaxDepth > 0) {
if (_SeeThroughFadeRange <= 0) {
if (dd > _SeeThroughMaxDepth) discard;
} else {
fadeMul = saturate((_SeeThroughMaxDepth - dd) / _SeeThroughFadeRange);
}
}
#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);
#if HP_DEPTH_OFFSET
col.a *= fadeMul;
#endif
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,138 @@
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
_SeeThroughFadeRange("Fade Range", 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 _SeeThroughFadeRange;
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);
float dd = i.depth - sceneDepth;
if (dd - _SeeThroughDepthOffset < 0) discard;
float fadeMul = 1.0;
if (_SeeThroughMaxDepth > 0) {
if (_SeeThroughFadeRange <= 0) {
if (dd > _SeeThroughMaxDepth) discard;
} else {
fadeMul = saturate((_SeeThroughMaxDepth - dd) / _SeeThroughFadeRange);
}
}
#endif
#if HP_ALPHACLIP
fixed4 col = tex2D(_MainTex, i.uv);
clip(col.a - _CutOff);
#endif
fixed4 res = _SeeThroughBorderColor;
#if HP_DEPTH_OFFSET
res.a *= fadeMul;
#endif
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,75 @@
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
{
Name "Highlight Plus UI Mask"
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,7 @@
fileFormatVersion: 2
guid: 933a5612c43104c29af0a700ea5fa149
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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:

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:

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: