-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from dongcheolpark/develop
전장의 안개 처리 완료했습니다.
- Loading branch information
Showing
60 changed files
with
17,053 additions
and
8,546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,5 @@ crashlytics-build.properties | |
|
||
Project_Blind/UserSettings | ||
|
||
Project_Blind/.idea | ||
Project_Blind/.idea | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
Project_Blind/Assets/Resources/Materials/Sight/CombinedShapeLightSharedHidden.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#if !defined(COMBINED_SHAPE_LIGHT_PASS) | ||
#define COMBINED_SHAPE_LIGHT_PASS | ||
|
||
half _HDREmulationScale; | ||
half _UseSceneLighting; | ||
half4 _RendererColor; | ||
|
||
half4 CombinedShapeLightShared(half4 color, half4 mask, half2 lightingUV) | ||
{ | ||
if (color.a == 0.0) | ||
discard; | ||
|
||
color = color * _RendererColor; // This is needed for sprite shape | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_0 | ||
half4 shapeLight0 = SAMPLE_TEXTURE2D(_ShapeLightTexture0, sampler_ShapeLightTexture0, lightingUV); | ||
|
||
if (any(_ShapeLightMaskFilter0)) | ||
{ | ||
half4 processedMask = (1 - _ShapeLightInvertedFilter0) * mask + _ShapeLightInvertedFilter0 * (1 - mask); | ||
shapeLight0 *= dot(processedMask, _ShapeLightMaskFilter0); | ||
} | ||
|
||
half4 shapeLight0Modulate = shapeLight0 * _ShapeLightBlendFactors0.x; | ||
half4 shapeLight0Additive = shapeLight0 * _ShapeLightBlendFactors0.y; | ||
#else | ||
half4 shapeLight0Modulate = 0; | ||
half4 shapeLight0Additive = 0; | ||
#endif | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_1 | ||
half4 shapeLight1 = SAMPLE_TEXTURE2D(_ShapeLightTexture1, sampler_ShapeLightTexture1, lightingUV); | ||
|
||
if (any(_ShapeLightMaskFilter1)) | ||
{ | ||
half4 processedMask = (1 - _ShapeLightInvertedFilter1) * mask + _ShapeLightInvertedFilter1 * (1 - mask); | ||
shapeLight1 *= dot(processedMask, _ShapeLightMaskFilter1); | ||
} | ||
|
||
half4 shapeLight1Modulate = shapeLight1 * _ShapeLightBlendFactors1.x; | ||
half4 shapeLight1Additive = shapeLight1 * _ShapeLightBlendFactors1.y; | ||
#else | ||
half4 shapeLight1Modulate = 0; | ||
half4 shapeLight1Additive = 0; | ||
#endif | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_2 | ||
half4 shapeLight2 = SAMPLE_TEXTURE2D(_ShapeLightTexture2, sampler_ShapeLightTexture2, lightingUV); | ||
|
||
if (any(_ShapeLightMaskFilter2)) | ||
{ | ||
half4 processedMask = (1 - _ShapeLightInvertedFilter2) * mask + _ShapeLightInvertedFilter2 * (1 - mask); | ||
shapeLight2 *= dot(processedMask, _ShapeLightMaskFilter2); | ||
} | ||
|
||
half4 shapeLight2Modulate = shapeLight2 * _ShapeLightBlendFactors2.x; | ||
half4 shapeLight2Additive = shapeLight2 * _ShapeLightBlendFactors2.y; | ||
#else | ||
half4 shapeLight2Modulate = 0; | ||
half4 shapeLight2Additive = 0; | ||
#endif | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_3 | ||
half4 shapeLight3 = SAMPLE_TEXTURE2D(_ShapeLightTexture3, sampler_ShapeLightTexture3, lightingUV); | ||
|
||
if (any(_ShapeLightMaskFilter3)) | ||
{ | ||
half4 processedMask = (1 - _ShapeLightInvertedFilter3) * mask + _ShapeLightInvertedFilter3 * (1 - mask); | ||
shapeLight3 *= dot(processedMask, _ShapeLightMaskFilter3); | ||
} | ||
|
||
half4 shapeLight3Modulate = shapeLight3 * _ShapeLightBlendFactors3.x; | ||
half4 shapeLight3Additive = shapeLight3 * _ShapeLightBlendFactors3.y; | ||
#else | ||
half4 shapeLight3Modulate = 0; | ||
half4 shapeLight3Additive = 0; | ||
#endif | ||
|
||
half4 finalOutput; | ||
#if !USE_SHAPE_LIGHT_TYPE_0 && !USE_SHAPE_LIGHT_TYPE_1 && !USE_SHAPE_LIGHT_TYPE_2 && ! USE_SHAPE_LIGHT_TYPE_3 | ||
finalOutput = color; | ||
#else | ||
half4 finalModulate = shapeLight0Modulate + shapeLight1Modulate + shapeLight2Modulate + shapeLight3Modulate; | ||
half4 finalAdditve = shapeLight0Additive + shapeLight1Additive + shapeLight2Additive + shapeLight3Additive; | ||
finalOutput = _HDREmulationScale * (color * finalModulate + finalAdditve); | ||
|
||
half luminance = max(finalModulate.r, max(finalModulate.g, finalModulate.b)); | ||
finalOutput.a = min(luminance * 2, color.a); | ||
#endif | ||
|
||
finalOutput = finalOutput *_UseSceneLighting + (1 - _UseSceneLighting)*color; | ||
return max(0, finalOutput); | ||
} | ||
#endif |
3 changes: 3 additions & 0 deletions
3
Project_Blind/Assets/Resources/Materials/Sight/CombinedShapeLightSharedHidden.hlsl.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
214 changes: 214 additions & 0 deletions
214
Project_Blind/Assets/Resources/Materials/Sight/HideInShadow.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
Shader "Universal Render Pipeline/2D/HideInShadow" | ||
{ | ||
Properties | ||
{ | ||
_MainTex("Diffuse", 2D) = "white" {} | ||
_MaskTex("Mask", 2D) = "white" {} | ||
_NormalMap("Normal Map", 2D) = "bump" {} | ||
|
||
// Legacy properties. They're here so that materials using this shader can gracefully fallback to the legacy sprite shader. | ||
[HideInInspector] _Color("Tint", Color) = (1,1,1,1) | ||
[HideInInspector] _RendererColor("RendererColor", Color) = (1,1,1,1) | ||
[HideInInspector] _Flip("Flip", Vector) = (1,1,1,1) | ||
[HideInInspector] _AlphaTex("External Alpha", 2D) = "white" {} | ||
[HideInInspector] _EnableExternalAlpha("Enable External Alpha", Float) = 0 | ||
} | ||
|
||
HLSLINCLUDE | ||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" | ||
ENDHLSL | ||
|
||
SubShader | ||
{ | ||
Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" } | ||
|
||
Blend SrcAlpha OneMinusSrcAlpha | ||
Cull Off | ||
ZWrite Off | ||
|
||
Pass | ||
{ | ||
Tags { "LightMode" = "Universal2D" } | ||
HLSLPROGRAM | ||
#pragma vertex CombinedShapeLightVertex | ||
#pragma fragment CombinedShapeLightFragment | ||
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ | ||
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ | ||
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ | ||
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ | ||
|
||
struct Attributes | ||
{ | ||
float3 positionOS : POSITION; | ||
float4 color : COLOR; | ||
float2 uv : TEXCOORD0; | ||
UNITY_VERTEX_INPUT_INSTANCE_ID | ||
}; | ||
|
||
struct Varyings | ||
{ | ||
float4 positionCS : SV_POSITION; | ||
half4 color : COLOR; | ||
float2 uv : TEXCOORD0; | ||
half2 lightingUV : TEXCOORD1; | ||
UNITY_VERTEX_OUTPUT_STEREO | ||
}; | ||
|
||
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" | ||
|
||
TEXTURE2D(_MainTex); | ||
SAMPLER(sampler_MainTex); | ||
TEXTURE2D(_MaskTex); | ||
SAMPLER(sampler_MaskTex); | ||
half4 _MainTex_ST; | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_0 | ||
SHAPE_LIGHT(0) | ||
#endif | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_1 | ||
SHAPE_LIGHT(1) | ||
#endif | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_2 | ||
SHAPE_LIGHT(2) | ||
#endif | ||
|
||
#if USE_SHAPE_LIGHT_TYPE_3 | ||
SHAPE_LIGHT(3) | ||
#endif | ||
|
||
Varyings CombinedShapeLightVertex(Attributes v) | ||
{ | ||
Varyings o = (Varyings)0; | ||
UNITY_SETUP_INSTANCE_ID(v); | ||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); | ||
|
||
o.positionCS = TransformObjectToHClip(v.positionOS); | ||
o.uv = TRANSFORM_TEX(v.uv, _MainTex); | ||
o.lightingUV = ComputeNormalizedDeviceCoordinates(o.positionCS); | ||
o.color = v.color; | ||
return o; | ||
} | ||
|
||
#include "CombinedShapeLightSharedHidden.hlsl" | ||
|
||
half4 CombinedShapeLightFragment(Varyings i) : SV_Target | ||
{ | ||
half4 main = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); | ||
half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv); | ||
|
||
return CombinedShapeLightShared(main, mask, i.lightingUV); | ||
} | ||
ENDHLSL | ||
} | ||
|
||
Pass | ||
{ | ||
Tags { "LightMode" = "NormalsRendering"} | ||
HLSLPROGRAM | ||
#pragma vertex NormalsRenderingVertex | ||
#pragma fragment NormalsRenderingFragment | ||
|
||
struct Attributes | ||
{ | ||
float3 positionOS : POSITION; | ||
float4 color : COLOR; | ||
float2 uv : TEXCOORD0; | ||
float4 tangent : TANGENT; | ||
UNITY_VERTEX_INPUT_INSTANCE_ID | ||
}; | ||
|
||
struct Varyings | ||
{ | ||
float4 positionCS : SV_POSITION; | ||
half4 color : COLOR; | ||
float2 uv : TEXCOORD0; | ||
half3 normalWS : TEXCOORD1; | ||
half3 tangentWS : TEXCOORD2; | ||
half3 bitangentWS : TEXCOORD3; | ||
UNITY_VERTEX_OUTPUT_STEREO | ||
}; | ||
|
||
TEXTURE2D(_MainTex); | ||
SAMPLER(sampler_MainTex); | ||
TEXTURE2D(_NormalMap); | ||
SAMPLER(sampler_NormalMap); | ||
half4 _NormalMap_ST; // Is this the right way to do this? | ||
|
||
Varyings NormalsRenderingVertex(Attributes attributes) | ||
{ | ||
Varyings o = (Varyings)0; | ||
UNITY_SETUP_INSTANCE_ID(attributes); | ||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); | ||
|
||
o.positionCS = TransformObjectToHClip(attributes.positionOS); | ||
o.uv = TRANSFORM_TEX(attributes.uv, _NormalMap); | ||
o.color = attributes.color; | ||
o.normalWS = TransformObjectToWorldDir(float3(0, 0, -1)); | ||
o.tangentWS = TransformObjectToWorldDir(attributes.tangent.xyz); | ||
o.bitangentWS = cross(o.normalWS, o.tangentWS) * attributes.tangent.w; | ||
return o; | ||
} | ||
|
||
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl" | ||
|
||
half4 NormalsRenderingFragment(Varyings i) : SV_Target | ||
{ | ||
half4 mainTex = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); | ||
half3 normalTS = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, i.uv)); | ||
return NormalsRenderingShared(mainTex, normalTS, i.tangentWS.xyz, i.bitangentWS.xyz, i.normalWS.xyz); | ||
} | ||
ENDHLSL | ||
} | ||
Pass | ||
{ | ||
Tags { "LightMode" = "UniversalForward" "Queue"="Transparent" "RenderType"="Transparent"} | ||
|
||
HLSLPROGRAM | ||
#pragma vertex UnlitVertex | ||
#pragma fragment UnlitFragment | ||
|
||
struct Attributes | ||
{ | ||
float3 positionOS : POSITION; | ||
float4 color : COLOR; | ||
float2 uv : TEXCOORD0; | ||
UNITY_VERTEX_INPUT_INSTANCE_ID | ||
}; | ||
|
||
struct Varyings | ||
{ | ||
float4 positionCS : SV_POSITION; | ||
float4 color : COLOR; | ||
float2 uv : TEXCOORD0; | ||
UNITY_VERTEX_OUTPUT_STEREO | ||
}; | ||
|
||
TEXTURE2D(_MainTex); | ||
SAMPLER(sampler_MainTex); | ||
float4 _MainTex_ST; | ||
|
||
Varyings UnlitVertex(Attributes attributes) | ||
{ | ||
Varyings o = (Varyings)0; | ||
UNITY_SETUP_INSTANCE_ID(attributes); | ||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); | ||
|
||
o.positionCS = TransformObjectToHClip(attributes.positionOS); | ||
o.uv = TRANSFORM_TEX(attributes.uv, _MainTex); | ||
o.color = attributes.color; | ||
return o; | ||
} | ||
|
||
float4 UnlitFragment(Varyings i) : SV_Target | ||
{ | ||
float4 mainTex = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); | ||
return mainTex; | ||
} | ||
ENDHLSL | ||
} | ||
} | ||
|
||
Fallback "Sprites/Default" | ||
} |
3 changes: 3 additions & 0 deletions
3
Project_Blind/Assets/Resources/Materials/Sight/HideInShadow.shader.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.