Skip to content

Instantly share code, notes, and snippets.

View smokelore's full-sized avatar

Sebastian Monroy smokelore

View GitHub Profile
Shader "CookbookShaders/StandardDiffuse3" {
Properties {
_Color ("Color", Color) = (1, 1, 1, 1)
_AmbientColor ("Ambient Color", Color) = (1, 1, 1, 1)
_MySliderValue ("This is a Slider", Range(0, 10)) = 2.5
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Shader "CookbookShaders/Diffuse" {
Properties {
_Color ("Color", Color) = (1, 1, 1, 1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
Shader "CookbookShaders/TexturedShader"
{
Properties
{
...
// In the properties section we can refer to a texture like this:
_MainTex ("Albedo (RGB)", 2D) = "white" {}]
...
}
Shader "CookbookShaders/ScrollingShader"
{
Properties
{
_MainTint ("Diffuse Tint", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_ScrollXSpeed ("X Scroll Speed", Range(0,10)) = 2
_ScrollYSpeed ("Y Scroll Speed", Range(0,10)) = 2
}
...
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
...
void surf (Input IN, inout SurfaceOutputStandard o)
{
// Create a separate variable to store our UVs
// before we pass them to the tex2D() function
fixed2 scrolledUV = IN.uv_MainTex;
// Create variables that store the individual
// x and y components for the UVs scaled by time
Shader "CookbookShaders/ScrollingShader"
{
Properties
{
_MainTint ("Diffuse Tint", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_ScrollXSpeed ("X Scroll Speed", Range(0,10)) = 2
_ScrollYSpeed ("Y Scroll Speed", Range(0,10)) = 2
}
SubShader
Shader "CookbookShaders/NormalDiffuse" {
Properties
{
_MainTint ("Diffuse Tint", Color) = (1,1,1,1)
// the "bump" keyword tells Unity that the texture will contain a normal map
_NormalTex ("Normal Map", 2D) = "bump" {}
_NormalIntensity ("Normal Intensity", Range(0,1)) = 1
}
SubShader
{
Shader "CookbookShaders/HolographicShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_DotProduct ("Rim Effect", Range(-1, 1)) = 0.25
}
SubShader {
Tags
{
"Queue" = "Transparent"
Shader "CookbookShaders/Transparent"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo (RGB)", 2D) = "white" {}
}
SubShader {
// Transparent (ordering)
Tags