Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day1 ToonShader #17

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,851 changes: 1,851 additions & 0 deletions ShaderIntro/Assets/Scenes/Lando_Magunia.unity

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions ShaderIntro/Assets/Scenes/Lando_Magunia.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
4 changes: 4 additions & 0 deletions ShaderIntro/Assets/Shaders/Day1.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions ShaderIntro/Assets/Shaders/Day1/Shader Graphs_ToonShader.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Shader Graphs_ToonShader
m_Shader: {fileID: -6465566751694194690, guid: 82b1da0b366e47748ba4aedd162e5c73,
type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _SampleTexture2D_B85ED2D7_Texture_1:
m_Texture: {fileID: 2800000, guid: 3b0b7c1f4ac9f6b499e27cf84e722ff4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Vector1_11F5E4AE: 5
- Vector1_BE5C04C8: 0.5
- Vector1_E49DD003: 0.6
- Vector1_F24DE81: 0.8
m_Colors:
- Color_4058401C: {r: 0.734247, g: 0.9433962, b: 0.75885284, a: 0}
- Color_A1685245: {r: 0.20754719, g: 0.016642937, b: 0.016642937, a: 0}
- Color_E1F8AF81: {r: 0.8018868, g: 0.6679238, b: 0.3290762, a: 0}
- Vector2_4D65531D: {r: -5, g: 1, b: 0, a: 0}
- Vector3_212474BD: {r: -0.97, g: 1.13, b: -0.63, a: 0}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

368 changes: 368 additions & 0 deletions ShaderIntro/Assets/Shaders/Day1/ToonShader.shadergraph

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions ShaderIntro/Assets/Shaders/Day1/ToonShader.shadergraph.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions ShaderIntro/Assets/Shaders/Day2/Shader Graphs_lava-acid.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Shader Graphs_lava-acid
m_Shader: {fileID: -6465566751694194690, guid: bf6cb5f66cc6b3c4080e29a6d71f2ffb,
type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Floats:
- Vector1_147C77FD: 200
- Vector1_69BA6C91: 30
- Vector1_6E7C8A1F: 10
- Vector1_B391947A: 1
- Vector1_E9B0C111: 3
m_Colors:
- Color_45E50424: {r: 0.31132078, g: 0.31132078, b: 0.31132078, a: 0}
- Color_59375AF3: {r: 1, g: 0, b: 0.2252388, a: 0}
- Vector2_E38057EF: {r: 3.4, g: 0.41, b: 1, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 90 additions & 0 deletions ShaderIntro/Assets/Shaders/Day2/ShaderTemplateMaterial.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ShaderTemplateMaterial
m_Shader: {fileID: 4800000, guid: 36917f14bf71dd64584f1852966d3ee1, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _Cull: 2
- _Cutoff: 0.5
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _Value: 1
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
--- !u!114 &6058991248647064433
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions ShaderIntro/Assets/Shaders/Day2/ToonShader.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ToonShader
m_Shader: {fileID: 4800000, guid: 6aa23477d78ec9a4296b735113a45fda, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: []
m_Colors: []
8 changes: 8 additions & 0 deletions ShaderIntro/Assets/Shaders/Day2/ToonShader.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions ShaderIntro/Assets/Shaders/Day2/ToonShader.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Shader "Unlit/ToonShader"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_SunDirection("Sun Direction", Vector) = (0,1,0,0)
_LightThreshold("Light Threshold", Float) = 0
_BrightColor("Bright Color", Color) = (1, 1, 1)
_DarkColor("Dark Color", Color) = (0, 0, 0)
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100

Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
//#pragma multi_compile_fog

#include "UnityCG.cginc"

struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 uv : TEXCOORD0;
};

struct v2f //Vertex to fragment
{
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
float4 vertex : SV_POSITION;
};

sampler2D _MainTex;
float4 _MainTex_ST;
float _SunDirection;
float _LightThreshold;

float3 _BrightColor;
float3 _DarkColor;
//for each vertex
v2f vert (appdata v) //Vertex shader
{
v2f o;//output
o.vertex = UnityObjectToClipPos(v.vertex);
o.normal = mul(UNITY_MATRIX_M, v.normal);
o.uv = v.uv;
return o;
}
//GPU IS DOING THINGS WITH THE DATA
//for each pixel
fixed4 frag (v2f i) : SV_Target //fixed4 = float4
{
float3 normal = normalize(v2f.normal);
_SunDirection = normalize(_SunDirection);
float dotProduct = dot(normal, _SunDirection);

float finalColor
if (dotProduct > _LightThreshold) {
finalColor = _BrightColor;
}
else {
finalColor = _DarkColor;
}
float3 texColor = tex2D(_MainTex, i.uv);
float3 col = texColor * finalColor;
return float4 (col, 1);
}
ENDCG
}
}
}
9 changes: 9 additions & 0 deletions ShaderIntro/Assets/Shaders/Day2/ToonShader.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading