[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

*To*: linuxgames@sunsite.dk*Subject*: shadow of sphere on a curved surface*From*: Abhir Joshi <abhir@vsnl.net>*Date*: Thu, 27 Nov 2003 17:25:45 +0530*Delivered-to*: archiver@seul.org*Delivered-to*: mailing list linuxgames@sunsite.dk*Delivery-date*: Thu, 27 Nov 2003 06:52:38 -0500*Mailing-list*: contact linuxgames-help@sunsite.dk; run by ezmlm*Reply-to*: linuxgames@sunsite.dk*User-agent*: Mutt/1.2.5i

I am aware of a technique of creating the shadow of an object on a plane by using the equation of the plane to modify the modelview matrix in OpenGL. Using this I got the shadow of a sphere on a plane. Now I want to cast the shadow of one sphere on another sphere, i.e a curved surface. A couple of years ago I had derived formulae for doing such a thing using brute force approach. I used to check each and every point in the scenario as follows- Consider p as point to be tested whether in shadow (umbra) or not. The light source is extended and bigger than the sphere. For the point p, find the nearest point N on the axis of the conical shadow of the sphere. Next, find the distance between p and N. Let's call it D. Now find the radius of cross section of the shadow cone at N. Let's call the radius as r. Now if r < D, the point is not in umbra. If it is otherwise, it is in umbra. The above approach worked perfectly since all the spheres were drawn with latitude and longitude points, not polygons. Now with OpenGL, I have thought of a number of options. Consider the curved surface is drawn as polygons. For a particular polygon, find the plane in which it lies. Then project the sphere onto this plane and then clip everything outside the polygon. (I don't know how to do this clipping. Can anyone explain? ) This procedure seems to be extremely expensive since the whole sphere will be projected on every plane corresponding every polygon on the curved surface. All these calculations have to be done in realtime. What can be other better ways of doing this? -- Abhir Joshi http://education.vsnl.com/abhir/

- Next by Author:
**peer-peer syncronization** - Previous by thread:
**Re: peer-peer syncronization** - Next by thread:
**Space sim in the works** - Index(es):