OpenGL ambient lighting on Oculus Rift

Electric Soup

Arkwood’s eyes were burnt out. Two smoldering holes in the front of his skull. Not quite.

‘But your virtual room is a health hazard,’ he said, slipping off the Oculus Rift virtual reality headset, ‘can’t you turn the lights down low?’

Yes. You only had to ask. I will dim the ambient light in the room.

Basic OpenGL lighting requires more than ambient light though. For example, as Learn OpenGL points out, the Phong lighting model incorporates diffuse and specular lighting too. But for now, let’s get started with just the ambient part.

Here’s the fragment shader for our virtual room, with the ambient light set to pure white:

And with an ambient strength of 1.0, the ambient light is having no effect on the overall textured colour of the room.

Note that the ambient light and strength are defined in the shader – we could pass these values…

View original post 206 more words

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s