Let’s Make a Custom Level for Duke Nukem 3D! Part 5


Previous parts: 1 2 3 4

Last time we added some badly needed detail to our first room, and learned how to make 3D platforms out of flattened sprites. That’s a crucial ability in an engine which doesn’t support actual polygonal objects. It allows all sorts of verticality and 3D level design that can’t be done in (for example) the unmodified Doom engine. Here’s where we left off:

What jumps out at you? To me, this looks too “flat” in terms of lighting. All surfaces are identically lit. We need to add some lighting and shadows for contrast, to make this room really POP. But how do you do that in this engine? It doesn’t have volumetric lighting like Quake. The answer is that you have to draw shadows as child sectors, then change their shade to make them darker, like so:

Don’t get too attached to the cube, I made it only to demonstrate how shadows work. You will notice below that besides drawing a shadow for it on the ground, I also darkened the shade of the appropriate faces of the cube. This is fine, except there’s no light source coming from that direction to explain the shadow:

I’m gonna delete the cube. Don’t cry for cube. Cube knew what it signed up for. Let’s now look at the room, and where the light should logically be coming from. This will dictate how we draw the shadows for this room.

Hmm! There’s some lights up there. We’ll just have to make the shadows under the assumption light is coming straight down, from those fixtures. Let’s have a look at what an improvement that is now:

Doesn’t that already look a hundred times better? Even so, something’s wrong. Light doesn’t just come sharply down like that, it spreads from light fixtures in a cone. Some of the light should be reaching under those lower two sections of the ceiling. How to achieve that?

We’ll split the right area about where the light will reach to. Then shade the floor and walls in that section to match the brighter middle section. Even just doing that much, here’s the result:

See how it now looks more or less as if some of the light cast down by the ceiling fixtures is reaching into the other area? But it’s still not quite right. The light shouldn’t reach the entire wall under the overhang. We need to use sloped sectors in that wall, and to shade the upper half differently from the lower half.

I made another sector behind there and pulled the floor and ceiling close together. I also changed the textures inside that area for contrast, just so it’d be clear that it’s a new child sector. Now to slope them:

I haven’t closed it up yet, but do you see what I’m up to? I used the 2 key to make that wall have two different textures on the upper and lower halves. But then I assigned them the same texture, but with different shading values. When I close it up, the effect will be to create a slope of light on that wall.

Much nicer, isn’t it? Using tricks like these, we can draw lighting and shadow however we want to create some very beautiful, striking lighting situations. It’s true that creating lighting and shadow is tedious in BUILD by comparison to Quake, but the lighting is much more sharp and defined.

Here’s the other side of the room with the same thing done. Way better, isn’t it? Now it looks properly like the light from the ceiling fixtures is spreading out as it descends, and is partially blocked by the lower ceiling sections. But there’s one finishing touch we can still add…

This game has light cone sprites! However it looks shitty right now. What can we do? By hitting T on the sprite any number of times, we can cycle through different degrees of transparency.

There we go. Now the lighting in this room is finished, at least until we add more objects to it. Because every object you add must also cast shadows appropriately in order to look right. Don’t underestimate how bad lighting can ruin immersion!

Anyway that’s all for this time. Next time we’ll begin making our next room!

Stay Tuned for Part 6!

I post text here, often accompanied by images and sometimes video. People then clap or don't depending on whether they enjoy what I posted.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store