Skip to content

Commit

Permalink
Added vertex light support
Browse files Browse the repository at this point in the history
Shader now also respects lights set to "Not Important".
  • Loading branch information
morerokk committed Nov 18, 2019
1 parent 44bde76 commit 3622c20
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Shader "NoeNoe/NoeNoe Toon Shader/Advanced/NoeNoe Toon Vertex Offset" {
#include "UnityStandardBRDF.cginc"
#include "AutoLight.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile _ VERTEXLIGHT_ON
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
#pragma shader_feature_local _ALPHATEST_ON
Expand Down Expand Up @@ -184,6 +185,7 @@ Shader "NoeNoe/NoeNoe Toon Shader/Advanced/NoeNoe Toon Vertex Offset" {
#include "AutoLight.cginc"
#pragma fragmentoption ARB_precision_hint_fastest
//#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile _ VERTEXLIGHT_ON
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
#pragma shader_feature_local _ALPHATEST_ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Shader "NoeNoe/NoeNoe Toon Shader/Advanced/NoeNoe Toon Eye Tracking" {
#include "UnityStandardBRDF.cginc"
#include "AutoLight.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile _ VERTEXLIGHT_ON
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
#pragma shader_feature_local _ALPHATEST_ON
Expand Down
2 changes: 2 additions & 0 deletions NoeNoe Shaders/NoeNoe Toon Shader/NoeNoe Toon Outline.shader
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Shader "NoeNoe/NoeNoe Toon Shader/NoeNoe Toon Outline" {
#include "UnityStandardBRDF.cginc"
#include "AutoLight.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile _ VERTEXLIGHT_ON
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
#pragma shader_feature_local _ALPHATEST_ON
Expand Down Expand Up @@ -159,6 +160,7 @@ Shader "NoeNoe/NoeNoe Toon Shader/NoeNoe Toon Outline" {
#include "AutoLight.cginc"
#pragma fragmentoption ARB_precision_hint_fastest
//#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile _ VERTEXLIGHT_ON
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
#pragma shader_feature_local _ALPHATEST_ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Shader "NoeNoe/NoeNoe Toon Shader/NoeNoe Toon Transparent" {
#include "UnityStandardBRDF.cginc"
#include "AutoLight.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile _ VERTEXLIGHT_ON
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
#pragma shader_feature_local _ALPHATEST_ON
Expand Down
1 change: 1 addition & 0 deletions NoeNoe Shaders/NoeNoe Toon Shader/NoeNoe Toon.shader
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Shader "NoeNoe/NoeNoe Toon Shader/NoeNoe Toon" {
#include "UnityStandardBRDF.cginc"
#include "AutoLight.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile _ VERTEXLIGHT_ON
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
#pragma shader_feature_local _ALPHATEST_ON
Expand Down
10 changes: 10 additions & 0 deletions NoeNoe Shaders/NoeNoe Toon Shader/NoeNoeToonEdits.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
#else
// Regular toon lighting, sample ambient SH, add LightColor0 to a lesser extent
float3 FlatLighting = FlatLightSH(float3(0,0,0)) + (_LightColor0.rgb * attenuation * _Exposure);

// In ForwardBase, add vertex lights
#if defined(VERTEXLIGHT_ON) && defined(UNITY_PASS_FORWARDBASE)
FlatLighting += Shade4PointLights(
unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
unity_LightColor[0].rgb, unity_LightColor[1].rgb,
unity_LightColor[2].rgb, unity_LightColor[3].rgb,
unity_4LightAtten0, i.posWorld, normalDirection
) * _Exposure;
#endif
#endif

float3 MappedTexture = (_MainTex_var.rgb*mainColor.rgb);
Expand Down

0 comments on commit 3622c20

Please sign in to comment.