drawTriangles() with Lights & Shadows

Hi Guys,

I have created from scratch a parametric sphere which is drawn on drawTriangles() method. Everything works perfect, but now I would like to add a bit of realism and I thought about putting in light with shadows.

I have googled this subject and to be honest couldn’t find anything what could solve my problem. I am looking for som math formulas how to calculate it.

I was thinking about using pixel bender to write a filter which would change the pixel color according to light position and colour, Is this a good direction?

Maybe anyone of you has any Ideas how should I do it. I would like to be able cast shadows onto object behind aswell and this would be hard with pixel bender I think.

Dave