I did a routine a long time ago to produce a shadow of a set of contiguous 3dfaces. It traces a ray in 3d from the single source point through the points defining the 3dface vertices to the object 3dface. However it creates a set of one-to-one 3dfaces in the object 3dface plane. ideally it would further trace a closed polyline circumnavigating the 3dface set and filling that closed polyline, thus creating a more life-like shadow. as it is it fills each face. Any ideas?
Like maybe, oh,
1) Search for an outer-most 3dface point
2) Starting there examine the 2 adjacent lines of the 3dface and choosing one
Start of loop:
3) Search for the set of 3dfaces a point-of-which shares the subject point
4) Find ∠ A
5) Maximize ∠ A
6) Find the next point
Loop
Sketch to follow..............................
Quick random thoughts:
What is "A" in point 4 and 5? Area?
If I understand you correct, your algorithm would result in a circular shadow for a donut iow the "hole" would miss.
I would expect this to be a well known problem with known solution(s).
Another algorithm might be to accumulate faces, IOW you find shadowface A and shadowface B to share an egde (line), then merge B into A.
It might make sense to first transform the shadow faces from 3D into 2D. IIRC there is at least one 2D library that does things like accumulate all faces.
If your shadowing object is non-convex or if you have everal shadowing objects, the shadow faces may overlap.
If you dont draw the shadow faces opaque (bad looks), then you must make certain that overlaps will not be darkened twice.
Bye bye,
Wolfram.