CarmenSandiego/Assets/Shaders/ScreenUV.shader
2025-05-23 04:06:11 -04:00

60 lines
1.4 KiB
Plaintext

Shader "Custom/ScreenUV"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Roughness ("Roughness", Range(0,1)) = 1.0
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
Pass {
Cull Front
CGPROGRAM
#include "UnityCG.cginc"
#pragma vertex vert
#pragma fragment frag
sampler2D _MainTex;
half _Roughness;
half _Metallic;
fixed4 _Color;
struct Data
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct V2F
{
float4 position : SV_POSITION;
float4 screenPosition : TEXCOORD0;
};
V2F vert(Data v)
{
V2F o;
o.position = UnityObjectToClipPos(v.vertex);
o.screenPosition = ComputeScreenPos(o.position);
return o;
}
fixed4 frag(V2F i) : SV_TARGET
{
float2 textureCoordinate = i.screenPosition.xy / i.screenPosition.w;
fixed4 colour = tex2D(_MainTex, textureCoordinate);
colour *= _Color;
return colour;
}
ENDCG
}
}
FallBack "Diffuse"
}