Tags

, , , , , , , , , , , , ,

‘You are not to go out in public,’ I told Arkwood, ‘Not after Tesco’.

He spun an elastic band on his index finger. ‘I needed the toilet, that’s all.’

‘Not on aisle eight! There are bathrooms for that sort of thing!’

Arkwood shrugged, ‘It was the Household Products aisle.’

True. He chose a spot with mops and disinfectant to defecate. How thoughtful.

‘So, no nightclub,’ I insisted, ‘but I have built you a virtual reality nightclub instead.’

My chum put on the Oculus Rift virtual reality headset and listened to the music emanating from the coral cube in the middle of the virtual room.

3D audio means that as Arkwood walks around the cube he can hear the music in his right ear, at the back of his head, in his left ear and then straight in front of him. If he moves away from the cube then the music fades.

My post Oculus spatializer plugin for FMOD gives the lowdown on piping 3D audio through a C++ Microsoft Visual Studio application and into the Rift headset.

But that’s not all. When the song changes we drop the lights to match the pace of the music. My post OpenGL specular lighting on Oculus Rift demonstrates how OpenGL and the Oculus SDK for Windows can implement a Phong lighting model of ambient, diffuse and specular components.

All we need do is pass lower lighting to the fragment shader if the music ain’t rock ‘n’ roll:

if (IsRockMusic) {
	glUniform3f(glGetUniformLocation(Fill->program, "lightColor"), 1.0f, 1.0f, 1.0f);
}
else {
	glUniform3f(glGetUniformLocation(Fill->program, "lightColor"), 0.01f, 0.01f, 0.01f);
}

Here’s a video of Arkwood in the virtual nightclub. Put in your earphones and hear the 3D audio pass by your ears and fade:

When the quiet music comes on and the light drops, technically speaking I should lower the brightness of the white light source rendered near the ceiling. But I chose to keep it bright as it creates a wonderful glowing vibe. Art is art.

‘How was the club?’ I asked my buddy.

‘It was okay. But it’s not like reality at all. I mean, where is the piss poor beer in plastic pints, filthy toilets and the crestfallen rejections from every girl I talk to?’

‘Bring your own toilet,’ I snapped, ‘You did at Tesco.’

Ciao!