iPhone 3GS and newer have a stencil buffer which can be used since iOS 4. As I wanted a realtime shadow solution for iSDGE, I decided to use this possibility to impement shadow volumes. The silouette detection needed for this was very slow, but I hapily found a way to speed it up a lot. The bottleneck currently is the rendering of the shadow volume, as it changes all the time, which means that it also have to be updated for the gpu all the time.
However, the scene above has around 5k polygons and all of them throw a shadow, which is a result I am already quite happy with and something I wanted to show around, as I didnĀ“t yet see stencil shadows on the iPhone, except some demo created be apple.
gj!
awesome progress, keep it up!
Very nice looking! Especially for ipod!
Hi! This is looking to be a very nice engine indeed! For your issues with shadow volumes, a possible "solution" to the volume creation is to make a very low-res representation on the geometry, and create 2 triangles (a quad) between every edge and split the verts, with the normals completely normalized, doing this as an offline build process. This will ramp up the vert/triangle count by like 3x so this is why it's ideal to just use a low-lod as a base mesh. Then in the GLSL vertex shader you do a dot product from the light onto the normals, and when it is == 0 you transform the vert away from the light to infinity. This will keep your VBO static and on the GPU, with the obvious drawback of the shadow being low-poly...