ferdinand list

[id tech 3] Dynamic shadows

A backup of an old sample map |

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.

Editor shot

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 oder on all kinds of shaders.

qer_editorimage textures/null_test/shadow.tga
surfaceparm nonsolid
surfaceparm nolightmap
surfaceparm trans
surfaceparm nomarks
surfaceparm nodlight
sort 12
q3map_cloneshader textures/null_test/a_shadow_light
map textures/null_test/shadow_d.tga
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.

Download §