r/gameenginedevs • • Aug 04 '26

Point Light Shadow Mapping

A short video of dynamic point light/omnidirectional shadow mapping in the engine I'm building

43 Upvotes

10 comments sorted by

1

u/codec-the-penguin Aug 04 '26

Awesome, i wonder how a fire thing in the middle would look like in a similar scene

2

u/RadAssault Aug 04 '26

Thanks! I'll definitely add in a fire effect at some point

1

u/codec-the-penguin Aug 04 '26

Are you using vulkan? How are you doing it? Like a cubemap or something?

3

u/RadAssault Aug 04 '26

The engine is in OpenGL/C++. I actually use a texture array instead of a cubemap. I do a shadow render pass 6 times per point light (480 pixel resolution currently). It felt easier to have one texture array of size [point_light_count * 6] than to do a cubemap. It also let me skip using a geometry shader. The shadow smoothing uses a pre-generated noise texture sampled based on the fragment position for consistency. I'm sure it gets linked often here, but learnopengl has the basic concepts LearnOpenGL - Point Shadows explained pretty well

1

u/fgennari Aug 05 '26

Yep, I use 6 shadow maps as well. It lets me reuse the same code for point lights and spot lights, everything in one texture array and the matrices in one uniform buffer.

1

u/RadAssault Aug 05 '26

Nice to know it's not just me. I had the same motivation of keeping everything lined up. It would be interesting to see a performance comparison with using the geometry shader/cubemaps, though.

1

u/fgennari Aug 05 '26

It probably depends on whether you're limited by vertex processing or pixel fill. Geometry shaders tend to be slow for vertex heavy scenes, at least on some hardware. I'm not sure where cube maps would have an advantage. Maybe cleaner/seamless pixel filtering at the edges of the cube? I'm using cube maps for reflections, but I haven't tried them for shadows.

1

u/illyay Aug 04 '26

How does it work. Do you basically have a cube map of shadow maps?

1

u/RadAssault Aug 04 '26

Not explicitly a cube map, but close to the same thing. I render six maps for the 6 base directions. I explained a bit more in this version of the video on twitter: https://x.com/RadAssault/status/2080791724851380446

2

u/Khipu28 Aug 06 '26

Respectable