Resonance in Space
Martin Nastoupil
Exploring the intersection of acoustics and art, this project innovates on Chladni's 18th-century patterns by extending them into the third dimension. Play the keyboard or make some noise to watch the particles dance.
Code snippet
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
void main() {
vec3 newPos = position;
for (int z = 0; z < 4; z++) {
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
float amp = map(u_data_array[z*16 + y*4 + x], 0.0, 255.0, 1.0, 1.5);
amp = pow(amp, 5.0) - 1.0;
float pw = 4.0;
//Mapping force field to each octant
newPos += (position - vec3(x, y, z)) * amp * pow(1.0 / distance(vec3(x, y, z), position), pw);
newPos += (position - vec3(-x, y, z)) * amp * pow(1.0 / distance(vec3(-x, y, z), position), pw);
newPos += (position - vec3(x, -y, z)) * amp * pow(1.0 / distance(vec3(x, -y, z), position), pw);
newPos += (position - vec3(x, y, -z)) * amp * pow(1.0 / distance(vec3(x, y, -z), position), pw);
newPos += (position - vec3(-x, -y, z))*amp*pow(1.0 / distance(vec3(-x, -y, z), position), pw);
newPos += (position - vec3(x, -y, -z))*amp*pow(1.0 / distance(vec3(x, -y, -z), position), pw);
newPos += (position - vec3(-x, y, -z))*amp*pow(1.0 / distance(vec3(-x, y, -z), position), pw);
newPos += (position - vec3(-x, -y, -z))*amp*pow(1.0 / distance(vec3(-x, -y, -z), position), pw);
}
}
}
vColor = vec4(1.0);
gl_Position = projectionMatrix * modelViewMatrix * vec4( newPos, 1.0);
gl_PointSize = 0.5;
}