yum/3ner
A toon shader for Unity's BIRP.
git clone https://git.yummers.dev/yum/3ner
a9217eb
master
1/* Copyright (c)2014 David Hoskins. 2 3Permission is hereby granted, free of charge, to any person obtaining a copy 4of this software and associated documentation files (the "Software"), to deal 5in the Software without restriction, including without limitation the rights 6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7copies of the Software, and to permit persons to whom the Software is 8furnished to do so, subject to the following conditions: 9 10The above copyright notice and this permission notice shall be included in all 11copies or substantial portions of the Software. 12 13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19SOFTWARE.*/ 20 21// Source: 22// https://www.shadertoy.com/view/4djSRW 23 24float2 hash22_fast(float2 p) { 25 float3 p3 = frac(p.xyx * float3(0.1031, 0.1030, 0.0973)); 26 p3 += dot(p3, p3.yzx + 33.33); 27 return frac((p3.xx+p3.yz)*p3.zy); 28} 29 30float3 hash33_fast(float3 p) { 31 p = frac(p * float3(0.1031, 0.1030, 0.0973)); 32 p += dot(p, p.yxz + 33.33); 33 return frac((p.xxy + p.yxx) * p.zyx); 34} 35