From 4be07729f0effd1e530ac11dc31b442cd7c30969 Mon Sep 17 00:00:00 2001 From: micuat Date: Sun, 1 Nov 2020 19:19:56 +0100 Subject: [PATCH] param --- zoneb/bin/data/shaders/bound.frag | 2 +- zoneb/bin/data/shaders/particles/draw.frag | 2 +- zoneb/bin/data/shaders/particles/draw.geom | 1 - zoneb/bin/data/shaders/particles/draw.vert | 2 - zoneb/bin/data/shaders/particles/update.frag | 47 +++++++++++--------- zoneb/src/main.cpp | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/zoneb/bin/data/shaders/bound.frag b/zoneb/bin/data/shaders/bound.frag index a610300..4051935 100644 --- a/zoneb/bin/data/shaders/bound.frag +++ b/zoneb/bin/data/shaders/bound.frag @@ -113,7 +113,7 @@ void main() { offset[8] = pixel * vec2( 1.0,1.0); vec2 st = v_texcoord; - // st.y = 1.0 - st.y; + st.x = 1200.0 - st.x; // horizontal flip #ifdef BUFFER_0 diff --git a/zoneb/bin/data/shaders/particles/draw.frag b/zoneb/bin/data/shaders/particles/draw.frag index b78e2db..8038694 100755 --- a/zoneb/bin/data/shaders/particles/draw.frag +++ b/zoneb/bin/data/shaders/particles/draw.frag @@ -120,7 +120,7 @@ void main() alpha *= 0.05; } else { - alpha *= 0.1; + alpha *= 0.15; } if(gPos.z > -200) { diff --git a/zoneb/bin/data/shaders/particles/draw.geom b/zoneb/bin/data/shaders/particles/draw.geom index a8b9129..2186c1f 100644 --- a/zoneb/bin/data/shaders/particles/draw.geom +++ b/zoneb/bin/data/shaders/particles/draw.geom @@ -15,7 +15,6 @@ uniform int uEnergy; in vec4 vPosition[]; in vec4 vPrevPosition[]; -in vec4 vOrgPosition[]; in vec2 vTexCoord[]; flat in int vValid[]; diff --git a/zoneb/bin/data/shaders/particles/draw.vert b/zoneb/bin/data/shaders/particles/draw.vert index 3e463cd..576000f 100755 --- a/zoneb/bin/data/shaders/particles/draw.vert +++ b/zoneb/bin/data/shaders/particles/draw.vert @@ -19,7 +19,6 @@ out float vTemperature; out float vAge; out vec4 vPosition; out vec4 vPrevPosition; -out vec4 vOrgPosition; void main() { @@ -31,5 +30,4 @@ void main() vPos = texture(particles0, vTexCoord).xyz; vPosition = modelViewMatrix * vec4(vPos, 1.0); vPrevPosition = modelViewMatrix * vec4(texture(particles4, vTexCoord).xyz, 1.0); - vOrgPosition = modelViewMatrix * vec4(texture(particles5, vTexCoord).xyz, 1.0); } diff --git a/zoneb/bin/data/shaders/particles/update.frag b/zoneb/bin/data/shaders/particles/update.frag index a3c3e0a..8e3f091 100755 --- a/zoneb/bin/data/shaders/particles/update.frag +++ b/zoneb/bin/data/shaders/particles/update.frag @@ -162,7 +162,14 @@ void main() age = 0; } else if (target.w > 0) { // targeted + // if(target.w >= 1) age += 0.005; + + if(target.w < 1) { + if(mod(random3(pos).x,1) > 0.05) { + target.w += 0.1; + } + } thermo = misc.x; } else { // wandering @@ -195,52 +202,48 @@ void main() int trapped = 0; if(age < 0.001) { // targetting - target.w = 0; - if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time)),1) > length((texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time,0,0)),simplex3d(pos*0.005+vec3(0,u_time,0))*16)) - uHottest0.st + mod(random3(pos).xy, 8)-vec2(4))/10) { + // target.w = 0; + if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time/8)),1) > length((texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time/8,0,0)),simplex3d(pos*0.005+vec3(0,u_time/8,0))*16)) - uHottest0.st + mod(random3(pos).xy, 8)-vec2(4))/10) { vec2 h = uHottest1.st; vec4 hray = texture(u_world, h); float hdepth = -depth * 65535.0; if(hdepth == 0) hdepth = -0.01 * 65535.0; vec3 H = vec3(hray.xy * hdepth, hdepth); target.xyz = H + random3(pos) * 3; - target.w = 1; + target.w += 0.1; thermo += random3(pos).y * 0.2 - 0.1; - if(mod(random3(pos).x,1) > 0.05) { - trapped = 1; - } + // if(mod(random3(pos).x,1) > 0.05) { + // target.w = 2; + // } } - else if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time)),1) > length(texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time,0,0)),simplex3d(pos*0.005+vec3(0,u_time,0))*16) - uHottest1.st + mod(random3(pos).xy, 8)-vec2(4))/10) { + else if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time/8)),1) > length(texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time/8,0,0)),simplex3d(pos*0.005+vec3(0,u_time/8,0))*16) - uHottest1.st + mod(random3(pos).xy, 8)-vec2(4))/10) { vec2 h = uHottest0.st; vec4 hray = texture(u_world, h); float hdepth = -depth * 65535.0; if(hdepth == 0) hdepth = -0.01 * 65535.0; vec3 H = vec3(hray.xy * hdepth, hdepth); target.xyz = H + random3(pos) * 3; - target.w = 1; + target.w += 0.1; thermo += random3(pos).y * 0.2 - 0.1; - if(mod(random3(pos).x,1) > 0.05) { - trapped = 1; - } + // if(mod(random3(pos).x,1) > 0.05) { + // target.w = 2; + // } } age = 0.001; } - if(target.w > 0) { // go to target + if(target.w >= 1) { // go to target float th = atan(-pos.y + target.y, -pos.x + target.x); float phi = atan(-pos.z + target.z, length(target.xy-pos.xy)); - th += 3.1415 * 1 * simplex3d_fractal(vec3(pos.xyz * 0.01) + vec3(u_time, 0, 0)); - phi += 3.1415 * 1 * simplex3d_fractal(pos.xyz * 0.01); + th += 3.1415 * 1 * simplex3d_fractal(vec3(pos.xyz * 0.001) + vec3(0, 0, u_time)); + phi += 3.1415 * 1 * simplex3d_fractal(pos.xyz * 0.002); force.x = cos(th) * cos(phi); force.y = sin(th) * cos(phi); force.z = sin(phi); - force *= 100 + 300 * simplex3d_fractal(vec3(texCoordVarying, 0.0)); - - // if(trapped == 1) { - // target.w = 0; - // } + force *= 50 + 500 * abs(simplex3d_fractal(vec3(texCoordVarying, 0.0))); } // damping @@ -251,9 +254,9 @@ void main() // move prevPos = pos; - // if(length(pos - posWorld.xyz) < 300) { - // prevPos = posWorld.xyz; - // } + if(length(pos - posWorld.xyz) < 30) { + prevPos = posWorld.xyz; + } pos += elapsed * vel; posOut = vec4(pos, 1.0); diff --git a/zoneb/src/main.cpp b/zoneb/src/main.cpp index c94f387..3261001 100644 --- a/zoneb/src/main.cpp +++ b/zoneb/src/main.cpp @@ -15,7 +15,7 @@ int main( ){ #else ofGLWindowSettings settings; settings.setGLVersion(3, 2); // Programmable pipeline - settings.setSize(1920, 1200); + settings.setSize(1200, 1920); #endif ofCreateWindow(settings); ofRunApp(new ofApp());