From d6edcc5e06fb48d7d8089a863530c355335b3f07 Mon Sep 17 00:00:00 2001 From: micuat Date: Tue, 20 Oct 2020 20:58:44 +0200 Subject: [PATCH] coldest, but not enabled --- zoneb/bin/data/shaders/particles/update.frag | 26 +++++++++++++++++--- zoneb/src/ofApp.cpp | 13 ++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/zoneb/bin/data/shaders/particles/update.frag b/zoneb/bin/data/shaders/particles/update.frag index 11a9b95..c81aa92 100755 --- a/zoneb/bin/data/shaders/particles/update.frag +++ b/zoneb/bin/data/shaders/particles/update.frag @@ -19,6 +19,8 @@ uniform float elapsed; uniform vec3 uHottest0; uniform vec3 uHottest1; +uniform vec3 uColdest0; +uniform vec3 uColdest1; in vec2 texCoordVarying; @@ -161,7 +163,7 @@ void main() if(age < 0.001) { target.w = 0; - if(random3(pos).x > pow(length(texCoordVarying.st - uHottest0.st)/20,16)+0) { + if(random3(pos).x > pow(length(texCoordVarying.st - uHottest0.st)/5,16*16)+0) { vec2 h = uHottest1.st; vec4 hray = texture(u_world, h); float hdepth = -depth * 65535.0; @@ -170,7 +172,7 @@ void main() target.xyz = H + random3(pos); target.w = 1; } - else if(random3(pos).x > pow(length(texCoordVarying.st - uHottest1.st)/20,16)+0) { + else if(random3(pos).x > pow(length(texCoordVarying.st - uHottest1.st)/5,16*16)+0) { vec2 h = uHottest0.st; vec4 hray = texture(u_world, h); float hdepth = -depth * 65535.0; @@ -179,6 +181,24 @@ void main() target.xyz = H + random3(pos); target.w = 1; } + // else if(random3(pos).x > pow(length(texCoordVarying.st - uColdest0.st)/20,16)+0) { + // vec2 h = uColdest1.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); + // target.w = 1; + // } + // else if(random3(pos).x > pow(length(texCoordVarying.st - uColdest1.st)/20,16)+0) { + // vec2 h = uColdest0.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); + // target.w = 1; + // } } if(target.w > 0) { @@ -189,7 +209,7 @@ void main() force.x = cos(th) * cos(phi); force.y = sin(th) * cos(phi); force.z = sin(phi); - force *= 350; + force *= 200 + 200 * simplex3d_fractal(vec3(texCoordVarying, 0.0)); // force += (target.xyz - pos) * 0.35; } diff --git a/zoneb/src/ofApp.cpp b/zoneb/src/ofApp.cpp index 8f9a64c..c137ee3 100644 --- a/zoneb/src/ofApp.cpp +++ b/zoneb/src/ofApp.cpp @@ -213,6 +213,19 @@ void ofApp::onParticlesUpdate(ofxShader &shader) { shader.setUniform3f("uHottest1", hotspots.at(0).at(1)); } + + if (hotspots.size() > 0 && hotspots.at(0).size() > 0) + { + shader.setUniform3f("uColdest0", hotspots.at(0).back()); + } + if (hotspots.size() > 1 && hotspots.at(1).size() > 0) + { + shader.setUniform3f("uColdest1", hotspots.at(1).back()); + } + else if (hotspots.size() > 0 && hotspots.at(0).size() > 1) + { + shader.setUniform3f("uColdest1", hotspots.at(0).at(hotspots.at(0).size() - 2)); + } } void ofApp::onParticlesDraw(ofxShader &shader)