Post news Report RSS Stencil shadows

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

Posted by on


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.

Comments
AdiJager
AdiJager

gj!

Reply Good karma Bad karma+2 votes
Quadraxas
Quadraxas

awesome progress, keep it up!

Reply Good karma Bad karma+1 vote
MadMonkey119
MadMonkey119

Very nice looking! Especially for ipod!

Reply Good karma Bad karma+1 vote
MistaED
MistaED

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

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

News
Browse
News
New
Post news
Report
Report
Share
Related Engines
iSDGE
iSDGE MIT
Related Groups
SlinDev
SlinDev Developer