Spoticar

Adam Slíva

Revolutionize your racing experience with Spoticar! Imagine tracks evolving to your Spotify beats. Cars dance to your tunes, powered by audio from song combined with mic. Boosts surge when the bass drops. Take control from the navigation bar, conducting your playlist as cars race. It’s music and motion colliding in an adrenaline-fueled journey!

Spoticar_TEASER.mp4

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;

}