Files
Colosseum/Assets/_Game/Shaders/Outline.shader
dal4segno 60275c6cd9 feat: 보스 가림 시 플레이어 외곽선 표시
- PlayerOcclusionOutline: 보스(Enemy 레이어)가 플레이어를 가릴 때 외곽선 활성화
- Outline.shader: URP 법선 확장 외곽선 셰이더 (Fresnel 기반 알파)
- 외곽선용 별도 SkinnedMeshRenderer를 자식 GameObject에 생성
- ObstacleTransparencyController: Enemy 레이어 장애물 숨김 제외
- PlayerCamera: PlayerOcclusionOutline 초기화 연동

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-04 10:51:10 +09:00

75 lines
2.0 KiB
Plaintext

Shader "Hidden/Colosseum/Outline"
{
Properties
{
_OutlineWidth("Width", Range(0.001, 0.1)) = 0.02
_OutlineColor("Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags
{
"RenderType" = "Transparent"
"Queue" = "Overlay"
"RenderPipeline" = "UniversalPipeline"
}
ZWrite Off
ZTest Always
Cull Front
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
CBUFFER_START(UnityPerMaterial)
float _OutlineWidth;
float4 _OutlineColor;
CBUFFER_END
struct Attributes
{
float3 positionOS : POSITION;
float3 normalOS : NORMAL;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float outlineAlpha : TEXCOORD0;
};
Varyings vert(Attributes input)
{
Varyings output;
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
float3 positionWS = TransformObjectToWorld(input.positionOS);
float3 viewDir = normalize(GetWorldSpaceViewDir(positionWS));
float NdotV = dot(normalWS, viewDir);
output.outlineAlpha = saturate(1.0 + NdotV);
positionWS += normalWS * _OutlineWidth * output.outlineAlpha;
output.positionCS = TransformWorldToHClip(positionWS);
return output;
}
half4 frag(Varyings input) : SV_Target
{
float alpha = _OutlineColor.a * pow(input.outlineAlpha, 3.0);
return half4(_OutlineColor.rgb, alpha);
}
ENDHLSL
}
}
FallBack Off
}