diff options
| author | yum <yum.food.vr@gmail.com> | 2026-03-29 15:44:01 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-03-29 15:44:01 -0700 |
| commit | a9217eb6c67282ac2451f1eafcedca04a8c5e564 (patch) | |
| tree | 32eab99906bb3e929163b86c0e451d38ca8d8959 /hashwithoutsine.cginc | |
| parent | 146a9a0f1aee3b69b7a37e3a67b84be1887b2594 (diff) | |
Continue work on glitter
Diffstat (limited to 'hashwithoutsine.cginc')
| -rw-r--r-- | hashwithoutsine.cginc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/hashwithoutsine.cginc b/hashwithoutsine.cginc new file mode 100644 index 0000000..78c6489 --- /dev/null +++ b/hashwithoutsine.cginc @@ -0,0 +1,35 @@ +/* Copyright (c)2014 David Hoskins. + +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.*/ + +// Source: +// https://www.shadertoy.com/view/4djSRW + +float2 hash22_fast(float2 p) { + float3 p3 = frac(p.xyx * float3(0.1031, 0.1030, 0.0973)); + p3 += dot(p3, p3.yzx + 33.33); + return frac((p3.xx+p3.yz)*p3.zy); +} + +float3 hash33_fast(float3 p) { + p = frac(p * float3(0.1031, 0.1030, 0.0973)); + p += dot(p, p.yxz + 33.33); + return frac((p.xxy + p.yxx) * p.zyx); +} + |
