dense particles
This commit is contained in:
parent
4d1349f720
commit
ca0613b705
2 changed files with 17 additions and 9 deletions
|
@ -112,12 +112,18 @@ void main()
|
|||
vec3 misc = texture(particles2, texCoordVarying.st).xyz;
|
||||
vec4 target = texture(particles3, texCoordVarying.st).xyzw;
|
||||
|
||||
float thermo = texture2D(u_v4l2cam, texCoordVarying.st).r;
|
||||
float thermo = texture2D(u_v4l2cam, texCoordVarying.st/4).r;
|
||||
|
||||
float depth = texture(u_depth, texCoordVarying.st).x;
|
||||
vec4 ray = texture(u_world, texCoordVarying.st);
|
||||
vec2 subPix = mod(texCoordVarying.st / 4, 1.0);
|
||||
float depth0 = texture(u_depth, texCoordVarying.st/4 - subPix).x;
|
||||
float depth1 = texture(u_depth, texCoordVarying.st/4 - subPix + vec2(1, 1)).x;
|
||||
vec4 ray0 = texture(u_world, texCoordVarying.st/4 - subPix);
|
||||
vec4 ray1 = texture(u_world, texCoordVarying.st/4 - subPix + vec2(1, 1));
|
||||
|
||||
float vValid = (depth != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
||||
float depth = mix(depth0, depth1, length(subPix));
|
||||
vec4 ray = mix(ray0, ray1, length(subPix));
|
||||
|
||||
float vValid = (depth0 != 0 && depth1 != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
||||
|
||||
vec4 posWorld = vec4(1);
|
||||
posWorld.z = -depth * 65535.0; // Remap to float range.
|
||||
|
@ -142,7 +148,7 @@ void main()
|
|||
thermo = misc.x;
|
||||
}
|
||||
else { // wandering
|
||||
age += 0.1;
|
||||
age += 0.02;
|
||||
// age += 0.01;
|
||||
thermo = misc.x;
|
||||
}
|
||||
|
@ -162,14 +168,16 @@ void main()
|
|||
|
||||
if(age < 0.001) { // targetting
|
||||
target.w = 0;
|
||||
if(random3(pos).x > pow(length(texCoordVarying.st - uHottest0.st)/5,16*16)+0) {
|
||||
if(random3(pos).x > pow(length(texCoordVarying.st/4 - uHottest0.st)/5,16*16)+0) {
|
||||
vec3 H = uHottest3d0;
|
||||
H.x *= -1;
|
||||
H.z *= -1;
|
||||
target.xyz = H + random3(pos);
|
||||
target.w = 1;
|
||||
}
|
||||
else if(random3(pos).x > pow(length(texCoordVarying.st - uHottest1.st)/5,16*16)+0) {
|
||||
else if(random3(pos).x > pow(length(texCoordVarying.st/4 - uHottest1.st)/5,16*16)+0) {
|
||||
vec3 H = uHottest3d1;
|
||||
H.x *= -1;
|
||||
H.z *= -1;
|
||||
target.xyz = H + random3(pos);
|
||||
target.w = 1;
|
||||
|
|
|
@ -69,8 +69,8 @@ void ofApp::setupThermal()
|
|||
void ofApp::setupParticles()
|
||||
{
|
||||
// 1,000,000 particles
|
||||
unsigned w = 512;
|
||||
unsigned h = 512;
|
||||
unsigned w = 512*4;
|
||||
unsigned h = 512*4;
|
||||
|
||||
particles.init(w, h, OF_PRIMITIVE_POINTS, false, 4);
|
||||
|
||||
|
|
Loading…
Reference in a new issue