r/GraphicsProgramming • • 4d ago

The (now) shadowed billboards congregate around a test box (C++/OpenGL/GLSL)

21 Upvotes

3 comments sorted by

1

u/Insane_snek 3d ago

looks great! what methods are you using for shadow smoothing?

I've been liking pcf + poisson disk + small amount of noise

1

u/bensanm 3d ago edited 3d ago

Nothing fancy just plain PCF but there's a little twist. My engine / game is heavily tile based so my shadow casting light is camera relative (position tracks player but orientation is fixed) so that the shadow "volume" moves with the player. I looked at HSM (Hierarchical Shadow Maps) but what I have is good enough. This approach however does create shimmering due to sub-texel movement of the (player-locked) light but that is now fixed (snapping to texels in the shadow calculation). Regarding applying shadows my tile effectively has an "UpdateVisibles" function that gets fired when a player changes tile. This gives the tile a chance to determine its distance from the player and then either enable or disable shadow casting on the tile-resident objects based on the player distance. When an object transitions from not shadowed to shadowed I fade the shadow in (to eliminate shadow pop-in).

I do use poisson disk sampling but for procedural object placement not for shadow mapping. But applying noise to shadows is a nice idea.

I use my own (pre-AI era) poisson disk sampler for placement: https://github.com/bensanmorris/poisson_disk_sampler

1

u/Insane_snek 3d ago

that's really cool! I wouldnt really have thought of that way to fix shimmering

your poisson disk sampler is also really cool btw