smoothing
This commit is contained in:
parent
54d63f5088
commit
47434c39db
3 changed files with 50 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
|||
<XY>54.0816, 3.06123</XY>
|
||||
<scale>1.724</scale>
|
||||
<device>video1</device>
|
||||
<thermo_delay>8</thermo_delay>
|
||||
<thermo_delay>6</thermo_delay>
|
||||
<blend_add>1</blend_add>
|
||||
<render_times>0</render_times>
|
||||
<trace_times>21</trace_times>
|
||||
|
|
|
@ -133,14 +133,55 @@ void main()
|
|||
vec4 ray11 = texture(u_world, basePix + vec2(1, 1));
|
||||
|
||||
float depth0 = mix(depth00, depth10, subPix.x);
|
||||
if(depth00 == 0) depth0 = depth10;
|
||||
if(depth10 == 0) depth0 = depth00;
|
||||
float depth1 = mix(depth01, depth11, subPix.x);
|
||||
if(depth01 == 0) depth1 = depth11;
|
||||
if(depth11 == 0) depth1 = depth01;
|
||||
vec4 ray0 = mix(ray00, ray10, subPix.x);
|
||||
vec4 ray1 = mix(ray01, ray11, subPix.x);
|
||||
|
||||
float depth = mix(depth0, depth1, subPix.y);
|
||||
if(depth00 == 0 && depth10 == 0) depth = depth1;
|
||||
if(depth01 == 0 && depth11 == 0) depth = depth0;
|
||||
vec4 ray = mix(ray0, ray1, subPix.y);
|
||||
|
||||
float vValid = (depth00 != 0 && depth01 != 0 && depth10 != 0 && depth11 != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
||||
int validCount = 0;
|
||||
// validCount += (depth00 != 0) ? 1 : 0;
|
||||
// validCount += (depth01 != 0) ? 1 : 0;
|
||||
// validCount += (depth10 != 0) ? 1 : 0;
|
||||
// validCount += (depth11 != 0) ? 1 : 0;
|
||||
// float vValid = (validCount > 1) ? 1 : 0;
|
||||
// if(subPix.x < 0.5 && subPix.y < 0.5) {
|
||||
// if(depth00 != 0) validCount += 1;
|
||||
// }
|
||||
// else if (subPix.x >= 0.5 && subPix.y < 0.5) {
|
||||
// if(depth10 != 0) validCount += 1;
|
||||
// }
|
||||
// else if(subPix.x < 0.5 && subPix.y >= 0.5) {
|
||||
// if(depth01 != 0) validCount += 1;
|
||||
// }
|
||||
// else if (subPix.x >= 0.5 && subPix.y >= 0.5) {
|
||||
// if(depth11 != 0) validCount += 1;
|
||||
// }
|
||||
// float vValid = (validCount > 0) ? 1 : 0;
|
||||
|
||||
float validity = 0;
|
||||
if(depth00 != 0) {
|
||||
validity += sqrt(2) - length(subPix - vec2(0, 0));
|
||||
}
|
||||
if(depth10 != 0) {
|
||||
validity += sqrt(2) - length(subPix - vec2(1, 0));
|
||||
}
|
||||
if(depth01 != 0) {
|
||||
validity += sqrt(2) - length(subPix - vec2(0, 1));
|
||||
}
|
||||
if(depth11 != 0) {
|
||||
validity += sqrt(2) - length(subPix - vec2(1, 1));
|
||||
}
|
||||
|
||||
float vValid = (validity > 1) ? 1 : 0;
|
||||
// float vValid = (depth00 != 0 && depth01 != 0 && depth10 != 0 && depth11 != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
||||
|
||||
vec4 posWorld = vec4(1);
|
||||
posWorld.z = -depth * 65535.0; // Remap to float range.
|
||||
|
@ -173,7 +214,11 @@ void main()
|
|||
thermo = misc.x;
|
||||
}
|
||||
else { // wandering
|
||||
age += 10.1;
|
||||
age += 0.04;
|
||||
vec3 rand = random3(vec3(texCoordVarying.st, 0));
|
||||
if(mod(subPix.x + rand.x, 0.5) > 0.1 || mod(subPix.y + rand.y, 0.5) > 0.1) {
|
||||
age += 10.1;
|
||||
}
|
||||
thermo = misc.x;
|
||||
}
|
||||
|
||||
|
@ -189,7 +234,7 @@ void main()
|
|||
force.x += cos(th) * cos(phi);
|
||||
force.y += sin(th) * cos(phi);
|
||||
force.z += sin(phi);
|
||||
force *= 100;
|
||||
force *= 300;
|
||||
}
|
||||
else {
|
||||
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.01));
|
||||
|
|
|
@ -131,7 +131,7 @@ void ofApp::setupGui()
|
|||
{
|
||||
gui.setup("ZONE B", "settings.xml"); // most of the time you don't need a name
|
||||
gui.add(registrationXY.setup("XY", {-9, -9}, {-100, -100}, {100, 100}));
|
||||
gui.add(registrationScale.setup("scale", 2.0, 0.1, 3));
|
||||
gui.add(registrationScale.setup("scale", 2.0, 1.5, 2));
|
||||
gui.add(v4l2Delay.setup("thermo delay", 0, 0, 59));
|
||||
gui.add(captureDeviceName.setup("device", "video3"));
|
||||
gui.add(blendAdd.setup("blend add", false));
|
||||
|
|
Loading…
Reference in a new issue