CPU or GPU shadow extrusion?

We can extrude the shadow volume with vertex program/shader. But if you want it completely done on GPU. There are a few choices:

  1. Extrude every edge, three per triangle, that’s fill-rate intensive.
  2. For every edge, check if it is silhoulette edge. then extrude the vertices only on silhoulette edge. But still a lot geometry, and you can’t access other vertices in vertex shader, so you should store a lot of extra things in you vertex data.

When using CPU to do it, we won’t worry about that. But which way is faster. If there is a lot of polygons. Detecting silhoulette on CPU is quite an expensive task.

Your vertex shaders aren’t usually the limiting factor; that being said, with today’s proliferation of different hardware configurations, you might want to implement both pathways and allow the user to switch it.

Or, if you’re feeling really lucky, you do some per-frame timing and dynamically switch between them as the amount of scene geometry changes :slight_smile: