Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Engine Dev Log #13 – Implementing Camera and Shadows (Lighting)

A topic by Eren created 2 days ago Views: 17
Viewing posts 1 to 1
(+1)

Hello everyone!

Last time, I wrapped up the basic rendering features by implementing the depth buffer.

Today, building on what I’ve learned so far, I tackled camera setup and shadow (lighting) rendering.

Ground and Cube Vertices

First, I defined the vertex data for a square ground plane and a cube.
You can find the vertex definitions here:

🔗 Ground and Cube Vertices (GitHub Gist)

Calculating Light and Camera Matrices

Next, I calculated the matrices for both the light source and the camera to render the scene properly.
Here’s a snapshot of the data I used:

Light

Camera

Render Passes and Shadow Rendering

With the shader pre-pass and main pass set up, I ran the renderer and was able to produce a scene where the cube casts a shadow onto the ground.

Here’s a short video demo of the result:

🎥 Watch on YouTube

You can also try it out in your browser:

Source Code

Here are the implementations for each graphics backend:

The result may look simple, but building everything from scratch was definitely a challenge — and a fun one at that.

Thanks for following along, and good luck with all your own projects too.
See you in the next update!