Hey Guys,
Today I want to demo the second product that I ever made in Three.js.
This was a more in-depth project that was just about learning and just having some fun. This was way back in the day. I learned a lot about shaders. I call it the Space-Sound Continuum.
What I have is a few songs, and I have Javascript using the web-audio API to analyze frequency. Let’s see if I can jump over really quickly for this code… if it will open the right folder here, yeah…
(highlights directory on left)
So this is the directory for the game and we have a lot of shaders here on the side, a stereo effect for virtual reality. It creates a left frame and a right frame and then using the two it creates depth in kind of an illusionary perception.
(chooses script from the directory)
So let’s see here for the script and look really quickly at this. I have five different frequency counts and they are averaged out and interpolated in real-time. That was pretty cool at the time.
(chooses skyboxes)
And then about skyboxes, I don’t know if you know about them very much, but essentially you have an original image. See, this is basically wrapped up into a cube and it’s seamless. So it looks like it goes on into infinity. That’s how they make video game spaces in the background.
I’ve done some work in my earthquake visualizer, the skybox in that is not actually perfect. I don’t really mind that so much. Maybe one day I’ll go back and edit it, but these are just personal projects to show you some cool stuff that you can do with Javascript.
(switches to Home screen)
So let’s jump over to the game. I hope that it works well with the screen recording software, (inaudible) but I know without it it’s very smooth. There was originally going to be an upload song functionality, but I got busy, so this doesn’t actually work here.
(selects first track)
But let’s just jump over to this, and you see you have your virtual reality option and you have your standard desktop/laptop with a keyboard. Let’s try it out.
(demo)
So you can see that…let me drop the sound quick here…you can see that the actual properties of the game are mapped in real-time to audio of different frequencies. So we have lots of shaders doing fluorescence and anastrophic filtering and glow passes and all sorts of things here, and I use an octree for collision detection.
These little white spheres are actually health. So when you hit one of these spikey balls that use some custom shaders that I wrote, you end up getting knocked and your health goes down. Your health is actually illustrated through the light, so the more you get hit, the darker it gets and at a certain point if it’s too dark, you basically are Game Over and you get redirected, bounced back out to the Home page there, which is the song selector.
So let’s just play this for a little bit. You can always fast-forward in the video and check back in.
(plays game)
Ooof, ooof! So with the (inaudible) recording software, it actually kind-of ah, is a bit slower because there is a lot going on on this computer for that. But ah, as you can see there’s a bit of a flash, if I can snag…oh, so close!
There we go. Got one. That’s a little health. Bring it back. BOOM! Sounded, (inaudible) it back here. Hold-on! BOOM! Oh, I got this! I think I can beat this right now, actually.
(game running, music playing)
Boom! Alright, and now I’m just going to lose here, so you can see what happens. Ah, boom! I have really low health right now, look at this. Let me go out of this tunnel to show you how I do this. So you have your skybox, you have your tunnel, and then there’s some alpha mapping going on to do the transparencies. And then I just insert these balls at one end, and then when they get to a certain coordinate at the end, I just remove them from the scene.
So let’s go back in and kinda lose the game so you can see how it bounces back. GAME OVER guys. Game over.
(back to Home screen)
So I hope that was really cool. I’m going to make this public for freeware. So people can just have some fun with Three.js and learn a little bit about shaders and how you can do collision detection and things like that. I know that when you first start out it takes a long time to learn these things, but then once you have a couple of personal projects under your belt or just professional projects as well, the mastery really steps it up.
So I will likely have to edit these songs, unfortunately, guys. I’ll probably have to use some sort of copyright-free music. It may not be that great. It’ll take me some time to change that out and find that because I can’t actually release this with the songs included for copyright issues. I’ll be doing that and then putting a link to this. Later on, I’ll go back to the Facebook video and add in a link.
So enjoy guys! Bye.