I'm a gameplay programmer
focused on developing
engaging and unique experiences!

My Resume Learn more

Specular Lighting & Point Lights

One of the biggest aspects of lighting that tell us about the surface we're looking at is specularity. Specular lighting is light that we see when it is reflected rather than scattered by an object. This creates highlights on the object that make it appear glossy or smooth depending on the highlight's appearance.

With directional lighting simulating a constant source of light like the sun, point lights simulate closer lights like light bulbs and fireplaces. Adding these to the graphics pipeline can give artists and designers lots of options in defining how an environment looks

We'll be looking at both of these lighting techniques to see how they can really improve the look of a scene.

Specular Lighting

As specular lighting is light we see that is reflected from an object, we would need to simulate all possible light sources to see if we could see their reflections. As usual, this type of accuracy is quite costly, so instead we can approximate this effect using Phong shading.

Phong Shading

Phong shading is a technique used to simulate specular lighting by calculating the angle between the camera and the reflected light. This angle is used to determine how we draw highlights based on whether they are less than 90 degrees. However, this results in a hard cutoff in specularity, which is accounted for in Blinn-Phong shading

Blinn-Phong Shading

Blinn-Phong shading builds off of Phong shading by instead calculating the angle between the surface normal and a half vector between the incoming light and the camera. This angle accounts for reflected lights that would be ignored by Phong Shading, which results in a softer specular highlight.

Specular Lighting Result

If we implement Blinn-Phong shading correctly, we should see a specular highlight like the animation below!

Notice how the specular lighting changes as the directional light changes. We can even see the highlight change as we move the camera instead of the directional light.

Both of these occur because they are vectors used to calculate the half vector in Blinn-Phong lighting.

Gloss

Did you notice how just a shiny white circle on an object can make it appear like it's made out of plastic?

We can adjust some parameters on our Blinn-Phong shader to make our sphere appear rougher.

Point Light

With diffuse and specular lighting implemented, we can really show off how much a point light adds to the scene! Point lights behave almost the exact same as directional lights, but they have their own positions and attenuation. Their position is used to determine what direction they are coming in from and attenuation is used to decrease the intensity of the light the further they get from objects. Both of these give point lights the sense that they are objects in the world instead of a global light source like directional lights. In reality, the sun is also a massive point light with completely unnoticeable attenuation due to the scale it outputs light

Point Light Result

If we get point lighting implemented in our graphics system, it'll look like the animation below:

Notice how the colors on objects brighten and dim based on the distance the point light is away and its attenuation. Something to note is that point lights don't have to be a white sphere in the world. That's just a simple way to see where the point light is located!

No Comments Yet.

Leave a comment