good?
This commit is contained in:
parent
00ba0ca9aa
commit
71be209a2f
8 changed files with 68 additions and 51 deletions
|
@ -1,9 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<ZONE_B>
|
||||
<XY>61.2245, -28.5714</XY>
|
||||
<XY>61.2245, -16.3265</XY>
|
||||
<scale>1.7965</scale>
|
||||
<device>video3</device>
|
||||
<thermo_delay>4</thermo_delay>
|
||||
<blend_add>1</blend_add>
|
||||
<render_times>3</render_times>
|
||||
<render_times>0</render_times>
|
||||
<trace_times>10</trace_times>
|
||||
</ZONE_B>
|
||||
|
|
|
@ -193,13 +193,7 @@ void main() {
|
|||
else {
|
||||
vec4 pointCloudColor = texture(u_ofcam, st);
|
||||
vec4 energyColor = texture(u_energy, st);
|
||||
vec4 bufColor = texture(u_buffer1, st);
|
||||
float newA = length(bufColor.rgb) / 2;
|
||||
newA = min(1, newA);
|
||||
gl_FragColor = vec4(mix(pointCloudColor.rgb,bufColor.rgb, newA), 1);
|
||||
// gl_FragColor = vec4(mix(pointCloudColor.rgb, bufColor.rgb, min(1, length(bufColor.rgb))), 1.0);
|
||||
gl_FragColor = vec4(mix(pointCloudColor.rgb, energyColor.rgb, energyColor.a), 1.0);
|
||||
// gl_FragColor = vec4(mix(vec3(0), pointCloudColor.rgb, pointCloudColor.a), 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -117,20 +117,12 @@ void main()
|
|||
vec3 remapedColor = mix(remapedColorC, remapedColorW, rate);
|
||||
float alpha = min(1, max(0, 1 - pow(gAge,4)));
|
||||
if(uEnergy > 0) {
|
||||
// alpha = 1;
|
||||
alpha *= 0.1;
|
||||
alpha *= 0.05;
|
||||
}
|
||||
else {
|
||||
alpha *= 0.1;
|
||||
}
|
||||
|
||||
// if(vTemperature < 0.5) {
|
||||
// alpha *= vTemperature * 2;
|
||||
// }
|
||||
// if(vTarget.w >0.5) {
|
||||
// alpha *= 2;
|
||||
// }
|
||||
|
||||
if(gPos.z > -200) {
|
||||
alpha = 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
layout (points) in;
|
||||
layout (line_strip) out;
|
||||
layout (max_vertices = 16) out;
|
||||
layout (max_vertices = 4) out;
|
||||
|
||||
// OF handled uniforms and attributes.
|
||||
uniform mat4 projectionMatrix;
|
||||
|
@ -15,6 +15,7 @@ uniform int uEnergy;
|
|||
|
||||
in vec4 vPosition[];
|
||||
in vec4 vPrevPosition[];
|
||||
in vec4 vOrgPosition[];
|
||||
in vec2 vTexCoord[];
|
||||
flat in int vValid[];
|
||||
|
||||
|
@ -46,14 +47,14 @@ void main()
|
|||
{
|
||||
vec3 vOffset;
|
||||
if(uEnergy > 0) {
|
||||
if(gAge < 0.01) return;
|
||||
if(length(gTarget.xyz) > 1000) return;
|
||||
if(gAge < 0.005) return;
|
||||
// if(length(gTarget.xyz) > 1000) return;
|
||||
vOffset = (vPrevPosition[i].xyz - vPosition[i].xyz);
|
||||
vOffset += normalize(vOffset) * 10;
|
||||
vOffset += normalize(vOffset) * 20;
|
||||
}
|
||||
else {
|
||||
vOffset = (vPrevPosition[i].xyz - vPosition[i].xyz);
|
||||
vOffset += normalize(vOffset) * 2;
|
||||
// vOffset = (vPrevPosition[i].xyz - vPosition[i].xyz);
|
||||
// vOffset = normalize(vOffset) * 2;
|
||||
vOffset = vec3(1,0,0);
|
||||
}
|
||||
// if(length(vOffset) < 4) {
|
||||
|
@ -68,16 +69,13 @@ void main()
|
|||
gl_Position = projectionMatrix * (shiftPos + vec4(0.0, 0.0, 0.0, 0.0) * uSpriteSize);
|
||||
EmitVertex();
|
||||
|
||||
// if(gAge > 0 && gTarget.w > 0) {
|
||||
// for(int j = 0; j < 2; j++) {
|
||||
// gl_Position = projectionMatrix * (vPosition[i] + vec4(0.0, float(j+1), 0.0, 0.0) * uSpriteSize);
|
||||
// EmitVertex();
|
||||
// gl_Position = projectionMatrix * (shiftPos + vec4(0.0, float(j+1), 0.0, 0.0) * uSpriteSize);
|
||||
// EmitVertex();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
EndPrimitive();
|
||||
// gl_Position = projectionMatrix * (vOrgPosition[i] + vec4(0.0, 0.0, 0.0, 0.0) * uSpriteSize);
|
||||
// EmitVertex();
|
||||
// gl_Position = projectionMatrix * (vec4(1,0,0,0) + vOrgPosition[i]);
|
||||
// EmitVertex();
|
||||
}
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ out float vTemperature;
|
|||
out float vAge;
|
||||
out vec4 vPosition;
|
||||
out vec4 vPrevPosition;
|
||||
out vec4 vOrgPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -28,12 +29,14 @@ void main()
|
|||
vec4 vTarget = texture(particles3, vTexCoord);
|
||||
vTemperature = misc.x;
|
||||
vAge = misc.y;
|
||||
if(uEnergy > 0) {
|
||||
vPos = texture(particles0, vTexCoord).xyz;
|
||||
}
|
||||
else {
|
||||
vPos = texture(particles5, vTexCoord).xyz;
|
||||
}
|
||||
vPos = texture(particles0, vTexCoord).xyz;
|
||||
// if(uEnergy > 0) {
|
||||
// vPos = texture(particles0, vTexCoord).xyz;
|
||||
// }
|
||||
// else {
|
||||
// vPos = texture(particles5, vTexCoord).xyz;
|
||||
// }
|
||||
vPosition = modelViewMatrix * vec4(vPos, 1.0);
|
||||
vPrevPosition = modelViewMatrix * vec4(texture(particles4, vTexCoord).xyz, 1.0);
|
||||
vOrgPosition = modelViewMatrix * vec4(texture(particles5, vTexCoord).xyz, 1.0);
|
||||
}
|
||||
|
|
|
@ -166,36 +166,37 @@ void main()
|
|||
thermo = misc.x;
|
||||
}
|
||||
else { // wandering
|
||||
age += 01.02;
|
||||
age += 0.1;
|
||||
thermo = misc.x;
|
||||
}
|
||||
|
||||
if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { // arrived
|
||||
age += 0.01;
|
||||
age += 0.04;
|
||||
}
|
||||
|
||||
// wandering
|
||||
vec3 force = vec3(0,0,0);
|
||||
if(vValid == 1 && target.w == 0) {
|
||||
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001));
|
||||
float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.002);
|
||||
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.0001));
|
||||
float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.0002);
|
||||
force.x += cos(th) * cos(phi);
|
||||
force.y += sin(th) * cos(phi);
|
||||
force.z += sin(phi);
|
||||
force *= 100;
|
||||
}
|
||||
else {
|
||||
// float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.01));
|
||||
// float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.02);
|
||||
// force.x += cos(th) * cos(phi);
|
||||
// force.y += sin(th) * cos(phi);
|
||||
// force.z += sin(phi);
|
||||
// force *= 100;
|
||||
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.01));
|
||||
float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.02);
|
||||
force.x += cos(th) * cos(phi);
|
||||
force.y += sin(th) * cos(phi);
|
||||
force.z += sin(phi);
|
||||
force *= 100;
|
||||
}
|
||||
|
||||
int trapped = 0;
|
||||
if(age < 0.001) { // targetting
|
||||
target.w = 0;
|
||||
if(random3(pos).x > mod(u_time*0.1+random3(pos).y,1) + pow(max(0,length(texCoordVarying.st/fraction - uHottest0.st + random3(pos).xy*5)/50),1)) {
|
||||
if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time)),1) > length(texCoordVarying.st/fraction - uHottest0.st + mod(random3(pos).xy, 8)-vec2(4))/10) {
|
||||
vec2 h = uHottest1.st;
|
||||
vec4 hray = texture(u_world, h);
|
||||
float hdepth = -depth * 65535.0;
|
||||
|
@ -204,8 +205,12 @@ void main()
|
|||
target.xyz = H + random3(pos) * 3;
|
||||
target.w = 1;
|
||||
thermo += random3(pos).y * 0.2 - 0.1;
|
||||
|
||||
if(mod(random3(pos).x,1) > 0.05) {
|
||||
trapped = 1;
|
||||
}
|
||||
}
|
||||
else if(random3(pos).x > mod(u_time*0.1+random3(pos).y,1) + 2*pow(max(0,length(texCoordVarying.st/fraction - uHottest1.st + random3(pos).xy*5)/50),1)) {
|
||||
else if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time)),1) > length(texCoordVarying.st/fraction - uHottest1.st + mod(random3(pos).xy, 8)-vec2(4))/10) {
|
||||
vec2 h = uHottest0.st;
|
||||
vec4 hray = texture(u_world, h);
|
||||
float hdepth = -depth * 65535.0;
|
||||
|
@ -214,9 +219,15 @@ void main()
|
|||
target.xyz = H + random3(pos) * 3;
|
||||
target.w = 1;
|
||||
thermo += random3(pos).y * 0.2 - 0.1;
|
||||
|
||||
if(mod(random3(pos).x,1) > 0.05) {
|
||||
trapped = 1;
|
||||
}
|
||||
}
|
||||
age = 0.001;
|
||||
}
|
||||
|
||||
|
||||
if(target.w > 0) { // go to target
|
||||
float th = atan(-pos.y + target.y, -pos.x + target.x);
|
||||
float phi = atan(-pos.z + target.z, length(target.xy-pos.xy));
|
||||
|
@ -225,7 +236,11 @@ void main()
|
|||
force.x = cos(th) * cos(phi);
|
||||
force.y = sin(th) * cos(phi);
|
||||
force.z = sin(phi);
|
||||
force *= 100 + 200 * simplex3d_fractal(vec3(texCoordVarying, 0.0));
|
||||
force *= 100 + 300 * simplex3d_fractal(vec3(texCoordVarying, 0.0));
|
||||
|
||||
// if(trapped == 1) {
|
||||
// target.w = 0;
|
||||
// }
|
||||
}
|
||||
|
||||
// damping
|
||||
|
@ -236,6 +251,9 @@ void main()
|
|||
|
||||
// move
|
||||
prevPos = pos;
|
||||
// if(length(pos - posWorld.xyz) < 300) {
|
||||
// prevPos = posWorld.xyz;
|
||||
// }
|
||||
pos += elapsed * vel;
|
||||
|
||||
posOut = vec4(pos, 1.0);
|
||||
|
|
|
@ -13,6 +13,9 @@ uniform sampler2DRect u_warm2;
|
|||
uniform sampler2DRect u_cold1;
|
||||
uniform sampler2DRect u_cold2;
|
||||
|
||||
uniform vec3 uHottest0;
|
||||
uniform vec3 uHottest1;
|
||||
|
||||
uniform bool uCalib;
|
||||
uniform vec2 uCalibXY;
|
||||
uniform float uCalibScale;
|
||||
|
@ -166,6 +169,11 @@ void main() {
|
|||
color.rgb = remapedColorW;
|
||||
// color.rg = palette.st;
|
||||
|
||||
vec2 st2 = st * vec2(2);
|
||||
if(length(st2 - uHottest0.st) < 10) {
|
||||
color.rgb = vec3(0);
|
||||
}
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -305,6 +305,9 @@ void ofApp::drawMain()
|
|||
// {
|
||||
// mainShader.setUniformTexture("u_" + gradientNames.at(i), gradients.at(gradientNames.at(i)));
|
||||
// }
|
||||
mainShader.setUniform3f("uHottest0", hotspot0);
|
||||
mainShader.setUniform3f("uHottest1", hotspot1);
|
||||
mainShader.setUniform3f("uBetween", uBetween);
|
||||
mainShader.setUniformTexture("u_warm1", gradients.at("warm1"));
|
||||
mainShader.setUniformTexture("u_warm2", gradients.at("warm2"));
|
||||
mainShader.setUniformTexture("u_cold1", gradients.at("cold1"));
|
||||
|
|
Loading…
Reference in a new issue