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 #9

Open
wants to merge 16 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 0 additions & 18 deletions ShaderIntro/.idea/.idea.ShaderIntro/.idea/contentModel.xml

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

3 changes: 3 additions & 0 deletions ShaderIntro/Assets/@Paul_Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
My Submissions are inside of the Scenes Folder.
Inside the Submission there are also small txt. files
that summarize the shaders purpose.
7 changes: 7 additions & 0 deletions ShaderIntro/Assets/@Paul_Readme.txt.meta

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

8 changes: 8 additions & 0 deletions ShaderIntro/Assets/Environment.meta

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

8 changes: 8 additions & 0 deletions ShaderIntro/Assets/Environment/Mockup_pack.meta

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

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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

8 changes: 8 additions & 0 deletions ShaderIntro/Assets/Environment/Mockup_pack/Grass Shader.meta

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Shader "Unlit/GeoGrass"
{
Properties {
_Color("Colour", Color) = (1,1,1,1)
_Color2("Colour2", Color) = (1,1,1,1)
_Width("Width", Float) = 1
_RandomWidth("Random Width", Float) = 1
_Height("Height", Float) = 1
_RandomHeight("Random Height", Float) = 1
_WindStrength("Wind Strength", Float) = 0.1
[Space]
_TessellationUniform("Tessellation Uniform", Range(1, 64)) = 1
}

SubShader {
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
LOD 300

Cull Off

Pass {
Name "ForwardLit"
Tags {"LightMode" = "UniversalForward"}

HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x gles
#pragma target 4.5

#pragma require geometry

#pragma vertex vert
#pragma geometry geom
#pragma fragment frag
#pragma hull hull
#pragma domain domain

#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
#pragma multi_compile _ _SHADOWS_SOFT

// Defines

#define BLADE_SEGMENTS 1

// Includes

#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
#include "grass_structs.hlsl"
#include "tessellation/CustomTessellation.hlsl"
#include "grass.hlsl"

// Fragment

float4 frag(GeometryOutput input) : SV_Target {
#if SHADOWS_SCREEN
float4 clipPos = TransformWorldToHClip(input.positionWS);
float4 shadowCoord = ComputeScreenPos(clipPos);
#else
float4 shadowCoord = TransformWorldToShadowCoord(input.positionWS);
#endif

Light mainLight = GetMainLight(shadowCoord);

if (mainLight.shadowAttenuation < 0.5)
{
return lerp(_Color, _Color2, input.uv.y) * (mainLight.shadowAttenuation+0.5); // ORIGINAL /W SHADOW
}
else {

return lerp(_Color, _Color2, input.uv.y) * mainLight.shadowAttenuation; // ORIGINAL /W SHADOW
}
//return lerp(_Color, _Color2, input.uv.y);

}

ENDHLSL
}
}
}

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
%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: GeoGrass_mat
m_Shader: {fileID: 4800000, guid: 5cf783d4f868a56498288072246ef3c5, 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:
- _Height: 0.36
- _RandomHeight: 2.08
- _RandomWidth: 0.27
- _TessellationUniform: 7
- _Width: 0
- _WindStrength: 0.04
m_Colors:
- _Color: {r: 0.15641019, g: 0.08226578, b: 0.08117869, a: 1}
- _Color2: {r: 0.16848834, g: 0.16667652, b: 0.16649534, a: 1}

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

Loading