Skip to content

Commit

Permalink
Merge pull request #29 from noxwyll/patch-1
Browse files Browse the repository at this point in the history
Added Speed Variable 
IMPORTANT: This shader is deprecated, I'm accepting this pull request for now, but will be replacing the rainbow shader with an updated variant in the future, built ontop of the latest toon shader and with a few new rainbow settings.
  • Loading branch information
cubedparadox authored Jan 12, 2018
2 parents 3a46d71 + 047c2b3 commit eb84564
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Shader "CubedParadox/Flat Lit Toon Rainbow" {
_ColorMask ("ColorMask", 2D) = "black" {}
_Saturation ("Saturation", Float ) = 0
_Value ("Value", Float ) = 0
_Speed ("Speed", Float ) = 0
}
SubShader {
Tags {
Expand Down Expand Up @@ -62,6 +63,8 @@ Shader "CubedParadox/Flat Lit Toon Rainbow" {
uniform sampler2D _ColorMask; uniform float4 _ColorMask_ST;
uniform float _Saturation;
uniform float _Value;
uniform float _Speed;

struct VertexInput {
float4 vertex : POSITION;
float2 texcoord0 : TEXCOORD0;
Expand All @@ -88,7 +91,7 @@ Shader "CubedParadox/Flat Lit Toon Rainbow" {
////// Lighting:
float attenuation = LIGHT_ATTENUATION(i);
float4 _MainTex_var = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex));
float4 node_1939 = _Time + _TimeEditor;
float4 node_1939 = _Time * _Speed + _TimeEditor;
float4 _ColorMask_var = tex2D(_ColorMask,TRANSFORM_TEX(i.uv0, _ColorMask));
float3 finalColor = (lerp((_MainTex_var.rgb*(lerp(float3(1,1,1),saturate(3.0*abs(1.0-2.0*frac(node_1939.r+float3(0.0,-1.0/3.0,1.0/3.0)))-1),_Saturation)*_Value)),_MainTex_var.rgb,_ColorMask_var.r)*saturate((Function_node_3693( float3(0,1,0) )+CubemapReflections( normalize((_WorldSpaceCameraPos-objPos.rgb)) )+(_LightColor0.rgb*attenuation))));
fixed4 finalRGBA = fixed4(finalColor,1);
Expand Down Expand Up @@ -132,6 +135,8 @@ Shader "CubedParadox/Flat Lit Toon Rainbow" {
uniform sampler2D _ColorMask; uniform float4 _ColorMask_ST;
uniform float _Saturation;
uniform float _Value;
uniform float _Speed;

struct VertexInput {
float4 vertex : POSITION;
float2 texcoord0 : TEXCOORD0;
Expand All @@ -158,7 +163,7 @@ Shader "CubedParadox/Flat Lit Toon Rainbow" {
////// Lighting:
float attenuation = LIGHT_ATTENUATION(i);
float4 _MainTex_var = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex));
float4 node_1939 = _Time + _TimeEditor;
float4 node_1939 = _Time * _Speed + _TimeEditor;
float4 _ColorMask_var = tex2D(_ColorMask,TRANSFORM_TEX(i.uv0, _ColorMask));
float3 finalColor = (lerp((_MainTex_var.rgb*(lerp(float3(1,1,1),saturate(3.0*abs(1.0-2.0*frac(node_1939.r+float3(0.0,-1.0/3.0,1.0/3.0)))-1),_Saturation)*_Value)),_MainTex_var.rgb,_ColorMask_var.r)*saturate((Function_node_3693( float3(0,1,0) )+CubemapReflections( normalize((_WorldSpaceCameraPos-objPos.rgb)) )+(_LightColor0.rgb*attenuation))));
fixed4 finalRGBA = fixed4(finalColor * 1,0);
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Nicholas Benge

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 0 additions & 3 deletions Media/Flat_Lit_Toon_Inspector.png

This file was deleted.

3 changes: 3 additions & 0 deletions Media/Flat_Lit_Toon__Inspector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ Cubed's Unity Shaders
============

A compilation of custom shaders for Unity3D.
You can download the latest version of this package to import **here**: [CubedsShaders.unitypackage](https://github.com/cubedparadox/Cubeds-Unity-Shaders/raw/master/Packages/CubedsShaders.unitypackage)
Currently built for Unity 5.6.3p1
You can get the latest release [here](https://github.com/cubedparadox/Cubeds-Unity-Shaders/releases)
Currently built for Unity 5.6.3p1
Installation: Add it to your unity assets (drag and drop in the package, or go to "Assets/Import Package/Custom Package" at the top and from there you can find it in your shaders drop down list automatically.

## Shaders
* Flat Lit Toon
![alt text](Media/Flat_Lit_Toon.png) ![alt text](Media/Flat_Lit_Toon_Inspector.png)
![alt text](Media/Flat_Lit_Toon.png) ![alt text](Media/Flat_Lit_Toon__Inspector.png)
* Looks like a unlit shader under good neutral lighting, but actually responds to full ambient and realtime lighting color, intensity and shadow. Single Pass with geometry shader outline
* Unlit Shadowed
![alt text](Media/Unlit_Shadowed_thumb.png)
Expand All @@ -31,5 +32,3 @@ Project contains the following assets:

### Tip Jar
<a href="https://digitaltipjar.com/cubedparadox?_external=true"><img alt="Tip Jar" style="border-width: 0; background-color: grey;" src="Media/tipbutton.png" /></a>

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.

0 comments on commit eb84564

Please sign in to comment.