[orx-dnk3] Add feature architecture and post processing effects
This commit is contained in:
@@ -11,6 +11,15 @@ val phraseHash22 = """vec2 hash22(vec2 p) {
|
||||
|
||||
val phraseHash21 = "float hash21(vec2 p) { return fract(1e4 * sin(17.0 * p.x + p.y * 0.1) * (0.1 + abs(sin(p.y * 13.0 + p.x)))); }"
|
||||
|
||||
val phraseHash33 = """
|
||||
#define MOD3 vec3(.1031,.11369,.13787)
|
||||
vec3 hash33(vec3 p3) {
|
||||
p3 = fract(p3 * MOD3);
|
||||
p3 += dot(p3, p3.yxz+19.19);
|
||||
return -1.0 + 2.0 * fract(vec3((p3.x + p3.y)*p3.z, (p3.x+p3.z)*p3.y, (p3.y+p3.z)*p3.x));
|
||||
}
|
||||
"""
|
||||
|
||||
val phraseValueNoise21 = """
|
||||
|
||||
float noise(vec2 x) {
|
||||
|
||||
7
orx-noise/src/main/kotlin/phrases/Simplex.kt
Normal file
7
orx-noise/src/main/kotlin/phrases/Simplex.kt
Normal file
@@ -0,0 +1,7 @@
|
||||
@file:ShaderPhrases([])
|
||||
package org.openrndr.extra.noise.phrases
|
||||
|
||||
import org.openrndr.extra.shaderphrases.annotations.ShaderPhrases
|
||||
import org.openrndr.extra.shaderphrases.phraseResource
|
||||
|
||||
val phraseSimplex3 by phraseResource("/org/openrndr/extra/noise/phrases/gl3/simplex-3.frag")
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma import org.openrndr.extra.noise.phrases.NoisePhrasesKt.phraseHash33;
|
||||
|
||||
float simplex31(vec3 p) {
|
||||
const float K1 = 0.333333333;
|
||||
const float K2 = 0.166666667;
|
||||
|
||||
vec3 i = floor(p + (p.x + p.y + p.z) * K1);
|
||||
vec3 d0 = p - (i - (i.x + i.y + i.z) * K2);
|
||||
|
||||
// thx nikita: https://www.shadertoy.com/view/XsX3zB
|
||||
vec3 e = step(vec3(0.0), d0 - d0.yzx);
|
||||
vec3 i1 = e * (1.0 - e.zxy);
|
||||
vec3 i2 = 1.0 - e.zxy * (1.0 - e);
|
||||
|
||||
vec3 d1 = d0 - (i1 - 1.0 * K2);
|
||||
vec3 d2 = d0 - (i2 - 2.0 * K2);
|
||||
vec3 d3 = d0 - (1.0 - 3.0 * K2);
|
||||
|
||||
vec4 h = max(0.6 - vec4(dot(d0, d0), dot(d1, d1), dot(d2, d2), dot(d3, d3)), 0.0);
|
||||
vec4 n = h * h * h * h * vec4(dot(d0, hash33(i)), dot(d1, hash33(i + i1)), dot(d2, hash33(i + i2)), dot(d3, hash33(i + 1.0)));
|
||||
return dot(vec4(31.316), n);
|
||||
}
|
||||
Reference in New Issue
Block a user