Report article RSS Feed Stencil shadows

iSDGE finally features real stencil shadows on iPhones with stencil buffer.

Posted by Slin on Aug 12th, 2010

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.

Post comment Comments
AdiJager Aug 13 2010, 2:50am says:


+2 votes     reply to comment
Quadraxas Aug 13 2010, 8:23pm says:

awesome progress, keep it up!

+1 vote     reply to comment
MadMonkey119 Aug 13 2010, 11:35pm says:

Very nice looking! Especially for ipod!

+1 vote     reply to comment
MistaED Jul 14 2011, 10:18pm says:

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...

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Report Abuse
Report article
Related Engines
Related Groups
SlinDev Developer