[id tech 3] Dynamic shadows
I stumbled across this old quake3world thread by user $NulL claiming to have achieved an implementation of dynamic shadows in q3. Since the post is from 2005 and links are of course dead, I went on a hunt to see if I could still find it somehow. Thankfully, as it turned out, sst13 happened to have a copy of the file that he could provide!
I went ahead and made a new video of it.
How it works §
The movement of the shadow volume is produced by having it in the same transitioned func_ as the geometry itself.
A shader is used to darken the geomtry hit by the shadow volume. A high sort value of 12 is used to make sure the shadow draws in the correct order on all kinds of shaders.
blendfunc gl_dst_color gl_src_color
From the original post, as stated by $NulL:
The outward facing polygons of the shadow volume darken whats already in the framebuffer.
The inward facing ones brighten it up again.
So when you can see both inward and outward facing polys they cancel each other out, but when only the outward facing poly is visiable the area is shadowed.
(You should never directly see an inward facing polygon)
There are some major limitations though. Being depth pass shadows you dont ever want a player's view to pass into a shadow volume.
There will be a maximum number of shadow polys rendered on top of each other before it fails and the shadow volumes become visable.
Apparently there has been an attempt at creating a smooth shadow version as well that got lost in time:
Right, I got a fading one kinda working. I used a gradiant texture instead of alpha blending it. But I carnt get around the values not being able to cancel each other out, so it looks ok from the side or top but from anywhere else the volumes become too visible.