Skip to content

Instantly share code, notes, and snippets.

@Delt06
Created February 18, 2024 17:05
Show Gist options
  • Save Delt06/50c2f298e02a6afdfb696bc0bb12f532 to your computer and use it in GitHub Desktop.
Save Delt06/50c2f298e02a6afdfb696bc0bb12f532 to your computer and use it in GitHub Desktop.
Sample Toon RP Skybox Shader
Shader "Skybox/Sample Toon RP Skybox"
{
Properties
{
_GroundColor ("Ground Color", Color) = (0, 0, 0, 1)
_SkyColor ("Sky Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Background" "Queue"="Background" }
Pass
{
ZWrite Off
Cull Off
HLSLPROGRAM
#pragma vertex VS
#pragma fragment PS
#include "Packages/com.deltation.toon-rp/ShaderLibrary/Common.hlsl"
struct appdata
{
float4 positionOS : POSITION;
float3 uv : TEXCOORD0;
};
struct v2f
{
float4 positionCS : SV_POSITION;
float3 uv : TEXCOORD0;
};
CBUFFER_START(UnityPerMaterial)
float4 _GroundColor;
float4 _SkyColor;
CBUFFER_END
v2f VS(const appdata IN)
{
v2f OUT;
OUT.positionCS = TransformObjectToHClip(IN.positionOS);
OUT.uv = IN.uv;
return OUT;
}
float4 PS(const v2f IN) : SV_Target
{
float3 normal = normalize(IN.uv);
return lerp(_GroundColor, _SkyColor, normal.y * 0.5 + 0.5);
}
ENDHLSL
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment