shader-techniques
from pluginagentmarketplace/custom-plugin-game-developer
Game developer roadmap plugin with engine-specific patterns and optimization
3 stars0 forksUpdated Jan 5, 2026
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-game-developer --skill shader-techniquesSKILL.md
Shader Techniques
Shader Pipeline Overview
┌─────────────────────────────────────────────────────────────┐
│ RENDERING PIPELINE │
├─────────────────────────────────────────────────────────────┤
│ CPU (Game Logic) │
│ ↓ │
│ VERTEX SHADER │
│ ├─ Transform vertices to clip space │
│ ├─ Calculate normals, tangents │
│ └─ Pass data to fragment shader │
│ ↓ │
│ RASTERIZATION (Fixed function) │
│ ├─ Triangle setup │
│ ├─ Pixel coverage │
│ └─ Interpolation │
│ ↓ │
│ FRAGMENT/PIXEL SHADER │
│ ├─ Sample textures │
│ ├─ Calculate lighting │
│ └─ Output final color │
│ ↓ │
│ OUTPUT (Framebuffer) │
└─────────────────────────────────────────────────────────────┘
Basic Shader Structure
// ✅ Production-Ready: Basic Surface Shader (Unity HLSL)
Shader "Custom/BasicSurface"
{
Properties
{
_MainTex ("Albedo", 2D) = "white" {}
_Color ("Color Tint", Color) = (1,1,1,1)
_Metallic ("Metallic", Range(0,1)) = 0.0
_Smoothness ("Smoothness", Range(0,1)) = 0.5
_NormalMap ("Normal Map", 2D) = "bump" {}
_NormalStrength ("Normal Strength", Range(0,2)) = 1.0
}
SubShader
{
Tags { "RenderType"="Opaque" "Queue"="Geometry" }
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
sampler2D _MainTex;
sampler2D _NormalMap;
half4 _Color;
half _Metallic;
half _Smoothness;
half _NormalStrength;
struct Input
{
float2 uv_MainTex;
float2 uv_NormalMap;
};
void surf(Input IN, inout SurfaceOutputStandard o)
{
// Albedo
half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Normal mapping
half3 normal = UnpackNormal(tex2D(_NormalMap, IN.uv_NormalMap));
normal.xy *= _NormalStrength;
o.Normal = normalize(normal);
// PBR properties
o.Metallic = _Metallic;
o.Smoothness = _Smoothness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Advanced Effects
Toon/Cel Shading
// ✅ Production-Ready: Toon Shader
Shader "Custom/Toon"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_RampTex ("Ramp Texture", 2D) = "white" {}
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineWidth ("Outline Width", Range(0, 0.1)) = 0.02
}
SubShader
{
Tags { "RenderType"="Opaque" }
// Outline Pass
Pass
{
Cull Front
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 pos : SV_POSITION;
};
float _OutlineWidth;
float4 _OutlineColor;
v2f vert(appdata v)
{
v2f o;
// Expand vertices along normals
float3 scaled = v.vertex.xyz + v.normal * _OutlineWidth;
o.pos = UnityObjectToClipPos(float4(scaled, 1.0));
return o;
}
half4 frag(v2f i) : SV_Target
{
return _OutlineColor;
}
ENDCG
}
// Main Toon Pass
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
sampler2D _MainTex;
sampler2D _RampTex;
float4 _Color;
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 uv : TEXCOORD0;
};
struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float3 worldNormal : TEXCOORD1;
};
v2f vert(appdata v)
{
v2f o;
...
Repository Stats
Stars3
Forks0
LicenseOther