# drawTriangles() with Lights & Shadows

**URL:** <https://forum.kirupa.com/t/drawtriangles-with-lights-shadows/297266>\
**Category:** flash\
**Created:** [September 28, 2009, 10:35pm UTC](https://forum.kirupa.com/t/drawtriangles-with-lights-shadows/297266 "2009-09-28T22:35:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![renton79](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@renton79](https://forum.kirupa.com/u/renton79)\
**Post date:** [September 28, 2009, 10:35pm UTC](https://forum.kirupa.com/t/drawtriangles-with-lights-shadows/297266/1 "2009-09-28T22:35:38Z")

</div>

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
