Kekouan

Q2Model, Part 9

2023-04-28

Lights, Shadows

During all of this, I did occasionally think about Forsaken) which came out a year after Quake 2. It was also a "Six Degree of Freedom" game like Descent, but they went all in on the lighting system.

A screenshot of Forsaken, from the Forsaken Remastered project

It's atmospheric, it's slightly green tinged, wonderful.

I think you'll agree that you need to have lights for things to be

So I started working on adding lights into my project.

What I had at this point, after swapping out the skybox textures for something more Quake 2 like:

Q2Model, rendering the Dragon Ogre model, at full brightness

There is no specific or directional lighting being applied, the model is as bright as the texture is in all locations.

Q2Model, rendering the Dragon Ogre model, with lighting effects

Now I've placed a light above the model, slightly behind. You can see that parts of the model that would be obscured are now much darker. The model itself doesn't cast a shadow, so the room/walls remains unchanged.

Same model, but with some lights that are not just white

Added some delightful coloured lights. Not entirely sure what happened with that back wall texture though.

3D Model with coloured lights

Here's where I start attempting to make the room/walls also receive lighting. Not quite there yet, but it didn't take long:

Room with proper lighting, including more coloured lights

Decided to see what it would look with a different model:

3D Model of a puffin with a fish

At this point I had added support for 4 kinds of lights

It's probably easiest to start with the last two. A point light is a light source that radiates in all directions. See also this blog post on Pluralsight, where I have taken these images from.

Point light source, radiating in all directions

Candles, Incadescent Bulbs, are what this would invoke. Generally there is no spot where the light does not radiate, unlike their physical counterparts. You typically get to set a colour (or temperature), the intensity of the light, and how quickly it attenunates or "drops off" as the distance increases.

Spot lights are, unsurprisingly, what they say on the tin. Spot light source, a conical light pattern

Spot lights have a direction of the cone, the angle of the cone, and how much it falls off from the center of the cone in addition to the distance.

Sunlight or directional lighting is the sort of light you'd get from the Sun, it's directional, but goes on forever (+/- attentuation values).

Directional light

Ambient Light is just a sort of "global illumination":

3D Model displaying ambient light, even the the parts that are in "shadow" are illuminated

This is useful to add lighting so everything isn't completely dark if not lit.