This commit is contained in:
micuat 2020-11-06 17:27:22 +01:00
parent 2cf5b8ef6b
commit 0d830919dc
3 changed files with 35 additions and 21 deletions

View file

@ -4,6 +4,7 @@ precision mediump float;
uniform sampler2DRect u_depth; uniform sampler2DRect u_depth;
uniform sampler2DRect u_color; uniform sampler2DRect u_color;
uniform sampler2DRect u_ir;
uniform sampler2DRect u_ofcam; uniform sampler2DRect u_ofcam;
uniform sampler2DRect u_energy; uniform sampler2DRect u_energy;
uniform sampler2DRect u_v4l2cam; uniform sampler2DRect u_v4l2cam;
@ -163,6 +164,7 @@ void main() {
#else #else
// Main Buffer // Main Buffer
if (u_calib) { if (u_calib) {
if (false) {
vec4 depth = texture(u_depth, st); vec4 depth = texture(u_depth, st);
depth.r *= 100; depth.r *= 100;
depth.a = 0; depth.a = 0;
@ -172,7 +174,17 @@ void main() {
gl_FragColor = depth + v4l2; gl_FragColor = depth + v4l2;
float fader = sin(u_time * 3.1415 / 10); float fader = sin(u_time * 3.1415 / 10);
fader = fader * 0.5 + 0.5; fader = fader * 0.5 + 0.5;
gl_FragColor = mix(vec4(v4l2.rgb,1), vec4(texture(u_color, st + vec2(300, 0)).rgb, 1), fader); // 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 { else {
vec4 pointCloudColor = texture(u_ofcam, st); vec4 pointCloudColor = texture(u_ofcam, st);

View file

@ -204,7 +204,7 @@ void main()
} }
else if (target.w > 0) { // targeted else if (target.w > 0) { // targeted
// if(target.w >= 1) // if(target.w >= 1)
age += 0.002; age += 0.01;
if(target.w < 1) { if(target.w < 1) {
if(mod(random3(pos).x,1) > 0.05) { 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 if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { // arrived
age += 0.04; age += 0.05;
} }
// wandering // wandering

View file

@ -9,19 +9,19 @@ void ofApp::setupKinect()
ofLogNotice(__FUNCTION__) << "Found " << ofxAzureKinect::Device::getInstalledCount() << " installed devices."; ofLogNotice(__FUNCTION__) << "Found " << ofxAzureKinect::Device::getInstalledCount() << " installed devices.";
auto kinectSettings = ofxAzureKinect::DeviceSettings(); auto kinectSettings = ofxAzureKinect::DeviceSettings();
kinectSettings.updateIr = false; kinectSettings.updateIr = true;
kinectSettings.updateColor = true; kinectSettings.updateColor = true;
kinectSettings.colorResolution = K4A_COLOR_RESOLUTION_1080P; kinectSettings.colorResolution = K4A_COLOR_RESOLUTION_1080P;
kinectSettings.updateVbo = false; kinectSettings.updateVbo = false;
auto deviceSettings = ofxAzureKinect::DeviceSettings(); // auto deviceSettings = ofxAzureKinect::DeviceSettings();
deviceSettings.syncImages = false; // deviceSettings.syncImages = false;
deviceSettings.depthMode = K4A_DEPTH_MODE_NFOV_UNBINNED; // deviceSettings.depthMode = K4A_DEPTH_MODE_NFOV_UNBINNED;
deviceSettings.updateIr = false; // deviceSettings.updateIr = true;
deviceSettings.updateColor = false; // deviceSettings.updateColor = false;
//deviceSettings.colorResolution = K4A_COLOR_RESOLUTION_1080P; // //deviceSettings.colorResolution = K4A_COLOR_RESOLUTION_1080P;
deviceSettings.updateWorld = true; // deviceSettings.updateWorld = true;
deviceSettings.updateVbo = false; // deviceSettings.updateVbo = false;
auto bodyTrackingSettings = ofxAzureKinect::BodyTrackingSettings(); auto bodyTrackingSettings = ofxAzureKinect::BodyTrackingSettings();
//bodyTrackingSettings.processingMode = K4ABT_TRACKER_PROCESSING_MODE_CPU; //bodyTrackingSettings.processingMode = K4ABT_TRACKER_PROCESSING_MODE_CPU;
bodyTrackingSettings.updateBodies = true; bodyTrackingSettings.updateBodies = true;
@ -369,8 +369,10 @@ void ofApp::drawMain()
ofDisableDepthTest(); ofDisableDepthTest();
auto tex = kinectDevice.getDepthTex(); auto tex = kinectDevice.getDepthTex();
auto ctex = kinectDevice.getColorTex(); auto ctex = kinectDevice.getColorTex();
auto itex = kinectDevice.getIrTex();
boundShader.setUniformTexture("u_depth", tex); boundShader.setUniformTexture("u_depth", tex);
boundShader.setUniformTexture("u_color", ctex); boundShader.setUniformTexture("u_color", ctex);
boundShader.setUniformTexture("u_ir", itex);
boundShader.setUniformTexture("u_ofcam", fbos.at("ofcam")); boundShader.setUniformTexture("u_ofcam", fbos.at("ofcam"));
boundShader.setUniformTexture("u_energy", fbos.at("energy")); boundShader.setUniformTexture("u_energy", fbos.at("energy"));
boundShader.setUniformTexture("u_v4l2cam", v4l2Buffer.at(v4l2BufferCount)); boundShader.setUniformTexture("u_v4l2cam", v4l2Buffer.at(v4l2BufferCount));