Skip to content

Instantly share code, notes, and snippets.

View candycat1992's full-sized avatar
🏠
Working from home

Feng Lele candycat1992

🏠
Working from home
View GitHub Profile
@candycat1992
candycat1992 / StencilSample.shader
Created May 31, 2018 17:11 — forked from mattatz/StencilSample.shader
Example of stencil shader to draw a simple outline for Unity.
Shader "Mattatz/StencilSample" {
Properties {
_Outline ("Outline Length", Range(0.0, 1.0)) = 0.2
_Color ("Color", Color) = (0.8, 0.8, 0.8, 1.0)
_OutlineColor ("Outline Color", Color) = (0.2, 0.2, 0.2, 1.0)
}
Shader "Terrain/Texture Repetition"
{
Properties
{
_Color ("Color Tint", Color) = (1, 1, 1, 1)
_MainTex ("Main Tex", 2D) = "white" {}
_NoiseTex ("Noise Tex", 2D) = "white" {}
_BlendRatio ("Blend Ratio", Range(0, 0.4999)) = 0.2
[KeywordEnum(Normal, Tech1, Tech2)] _SampleMethod ("Sample Method", Float) = 0
}
Shader "Terrain/Blend Textures"
{
Properties
{
_BlockMainTex ("Block Main Tex", 2D) = "white" {}
_BlockNormalTex ("Block Normal Tex", 2D) = "white" {}
_BlendTex ("Blend Tex (RG: Index, B: Blend)", 2D) = "white" {}
_BlockScale ("Block Scale", Range(0, 2)) = 1
}
SubShader
float4 ObjectToTextureSpacePos(a2v_shared v)
{
float4 clipPos = mul(UNITY_MATRIX_VP, mul(unity_ObjectToWorld, v.vertex));
float2 uv = v.texcoord.xy;
#if UNITY_UV_STARTS_AT_TOP
uv.y = 1.0 - uv.y;
#endif
clipPos.xy = (uv - 0.5) * 2.0 * clipPos.w;
return clipPos;
Shader "Hidden/Deferred Point Light Shading"
{
Properties
{
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 0
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull Mode", Float) = 1
}
SubShader
{