From 0d830919dc2934262cd6685ce247389341741fdc Mon Sep 17 00:00:00 2001 From: micuat Date: Fri, 6 Nov 2020 17:27:22 +0100 Subject: [PATCH] param --- zoneb/bin/data/shaders/bound.frag | 32 ++++++++++++++------ zoneb/bin/data/shaders/particles/update.frag | 4 +-- zoneb/src/ofApp.cpp | 20 ++++++------ 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/zoneb/bin/data/shaders/bound.frag b/zoneb/bin/data/shaders/bound.frag index becac65..23244c9 100644 --- a/zoneb/bin/data/shaders/bound.frag +++ b/zoneb/bin/data/shaders/bound.frag @@ -4,6 +4,7 @@ precision mediump float; uniform sampler2DRect u_depth; uniform sampler2DRect u_color; +uniform sampler2DRect u_ir; uniform sampler2DRect u_ofcam; uniform sampler2DRect u_energy; uniform sampler2DRect u_v4l2cam; @@ -163,16 +164,27 @@ void main() { #else // Main Buffer if (u_calib) { - vec4 depth = texture(u_depth, st); - depth.r *= 100; - depth.a = 0; - // vec4 v4l2 = texture(u_v4l2cam, st); - vec4 v4l2 = texture(u_v4l2cam, (st + vec2(300, 0)) / vec2(3.7,3.5) + vec2(4, 86)); - v4l2 = texture(u_gradient, vec2(v4l2.r * 3425, 0)); - gl_FragColor = depth + v4l2; - float fader = sin(u_time * 3.1415 / 10); - fader = fader * 0.5 + 0.5; - gl_FragColor = mix(vec4(v4l2.rgb,1), vec4(texture(u_color, st + vec2(300, 0)).rgb, 1), fader); + if (false) { + vec4 depth = texture(u_depth, st); + depth.r *= 100; + depth.a = 0; + // vec4 v4l2 = texture(u_v4l2cam, st); + vec4 v4l2 = texture(u_v4l2cam, (st + vec2(300, 0)) / vec2(3.7,3.5) + vec2(4, 86)); + v4l2 = texture(u_gradient, vec2(v4l2.r * 3425, 0)); + gl_FragColor = depth + v4l2; + float fader = sin(u_time * 3.1415 / 10); + fader = fader * 0.5 + 0.5; + // vec4 cc = vec4(texture(u_ir, st/4+vec2(100,200)).rgb * 2, 1); + vec4 cc = vec4(texture(u_color, st + vec2(300, 0)).rgb, 1); + gl_FragColor = mix(vec4(v4l2.rgb,1), cc, fader); + } + else { + vec4 depth = texture(u_depth, st); + depth.r *= 100; + depth.a = 0; + vec4 v4l2 = texture(u_v4l2cam, st); + gl_FragColor = depth + v4l2; + } } else { vec4 pointCloudColor = texture(u_ofcam, st); diff --git a/zoneb/bin/data/shaders/particles/update.frag b/zoneb/bin/data/shaders/particles/update.frag index 9410b90..359a860 100755 --- a/zoneb/bin/data/shaders/particles/update.frag +++ b/zoneb/bin/data/shaders/particles/update.frag @@ -204,7 +204,7 @@ void main() } else if (target.w > 0) { // targeted // if(target.w >= 1) - age += 0.002; + age += 0.01; if(target.w < 1) { if(mod(random3(pos).x,1) > 0.05) { @@ -223,7 +223,7 @@ void main() } if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { // arrived - age += 0.04; + age += 0.05; } // wandering diff --git a/zoneb/src/ofApp.cpp b/zoneb/src/ofApp.cpp index 31c6108..aa7bf9e 100644 --- a/zoneb/src/ofApp.cpp +++ b/zoneb/src/ofApp.cpp @@ -9,19 +9,19 @@ void ofApp::setupKinect() ofLogNotice(__FUNCTION__) << "Found " << ofxAzureKinect::Device::getInstalledCount() << " installed devices."; auto kinectSettings = ofxAzureKinect::DeviceSettings(); - kinectSettings.updateIr = false; + kinectSettings.updateIr = true; kinectSettings.updateColor = true; kinectSettings.colorResolution = K4A_COLOR_RESOLUTION_1080P; kinectSettings.updateVbo = false; - auto deviceSettings = ofxAzureKinect::DeviceSettings(); - deviceSettings.syncImages = false; - deviceSettings.depthMode = K4A_DEPTH_MODE_NFOV_UNBINNED; - deviceSettings.updateIr = false; - deviceSettings.updateColor = false; - //deviceSettings.colorResolution = K4A_COLOR_RESOLUTION_1080P; - deviceSettings.updateWorld = true; - deviceSettings.updateVbo = false; + // auto deviceSettings = ofxAzureKinect::DeviceSettings(); + // deviceSettings.syncImages = false; + // deviceSettings.depthMode = K4A_DEPTH_MODE_NFOV_UNBINNED; + // deviceSettings.updateIr = true; + // deviceSettings.updateColor = false; + // //deviceSettings.colorResolution = K4A_COLOR_RESOLUTION_1080P; + // deviceSettings.updateWorld = true; + // deviceSettings.updateVbo = false; auto bodyTrackingSettings = ofxAzureKinect::BodyTrackingSettings(); //bodyTrackingSettings.processingMode = K4ABT_TRACKER_PROCESSING_MODE_CPU; bodyTrackingSettings.updateBodies = true; @@ -369,8 +369,10 @@ void ofApp::drawMain() ofDisableDepthTest(); auto tex = kinectDevice.getDepthTex(); auto ctex = kinectDevice.getColorTex(); + auto itex = kinectDevice.getIrTex(); boundShader.setUniformTexture("u_depth", tex); boundShader.setUniformTexture("u_color", ctex); + boundShader.setUniformTexture("u_ir", itex); boundShader.setUniformTexture("u_ofcam", fbos.at("ofcam")); boundShader.setUniformTexture("u_energy", fbos.at("energy")); boundShader.setUniformTexture("u_v4l2cam", v4l2Buffer.at(v4l2BufferCount));