Files
beyond/Assets/ThirdParty/ENVIRO/Allsky/Overcast/Overcast Low/PlaneSky.shader
2026-01-19 22:21:06 +01:00

80 lines
2.2 KiB
Plaintext

Shader "Custom/URP/FakeSky_NoClip"
{
Properties
{
[MainTexture] _BaseMap ("Texture (Panorama)", 2D) = "white" {}
[MainColor] _Color ("Color Tint", Color) = (1,1,1,1)
_Intensity ("Brightness / Emission", Float) = 1.0
}
SubShader
{
Tags
{
"RenderPipeline"="UniversalRenderPipeline"
"RenderType"="Background"
"Queue"="Background"
"PreviewType"="Skybox"
}
Pass
{
Name "Unlit"
Tags { "LightMode"="UniversalForward" }
Cull Off
ZWrite Off
// Wa¿ne: ZTest LEqual w po³¹czeniu z trikiem w Vertex shaderze
ZTest LEqual
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
float2 uv : TEXCOORD0;
};
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
float4 _Color;
float _Intensity;
CBUFFER_END
Varyings vert (Attributes v)
{
Varyings o;
o.positionHCS = TransformObjectToHClip(v.positionOS.xyz);
// --- MAGICZNA LINIJKA ---
// To sprawia, ¿e obiekt jest renderowany na maksymalnej g³êbokoœci (jak Skybox).
// Dziêki temu Far Clip Plane kamery go nie utnie, nawet jak jest ogromny.
o.positionHCS.z = o.positionHCS.w;
// ------------------------
o.uv = TRANSFORM_TEX(v.uv, _BaseMap);
return o;
}
half4 frag (Varyings i) : SV_Target
{
half4 texColor = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv);
return texColor * _Color * _Intensity;
}
ENDHLSL
}
}
}