Closed semagnum closed 1 year ago
Might need an extra input - an origin of light (lamp object, 3D cursor, camera?). Otherwise, the direction must be based on existing light sources. May not be arbitrary or deterministic.
Could do a convex hull. Given grease pencil points and the user selects a given lamp or hull:
light_source_points = a convex hull of points surrounding the lamp (where it could emit from)
draw a line from each light source point to each grease pencil point
At a given factor (0.0 is at the light source, 1.0 is at the grease pencil surface):
cut_points = list of points given by "slicing" through lines
hull = convex hull from cut_points
return hull as the shadow card
Can use this code online as a template for finding the "slice":
function midpoint(lat1, long1, lat2, long2, per) {
return [lat1 + (lat2 - lat1) * per, long1 + (long2 - long1) * per];
}
I would like to draw areas that I'd like to block light: