I think that Blender might do what I have in mind, but I am not a Blender and Python guru, so I am looking for directions.
I need to determine if a point in space is obscured by an object, i.e. does it cast the shadow over it (there is one source of light, the sun). This has to be done for:
- many different objects of different shapes but of similar size: they are fairly simple with just a few surfaces (e.g. a collection of cubes of slightly different sizes and orientations). Each is stored in one OBJ, so there are many OBJs. The analysis should be done one by one.
- a collection of many points that need to be tested, each has different 3D coordinates. For each point it should be determined if a shadow is cast over it or not, so the result is binary.
- for a different position of the sun (e.g. 100-200), to mimic the variable position of the sun during the day and throughout the year.
I am interested in two things: how to automate this, and is there a function in Blender that determines if a point is obscured or not.
What I have so far is shown below. For the simplicity of the approach let's assume that all points that need to be tested have the same Z coordinate (i.e. they are planar).
for each OBJ:
+Load the OBJ
+Place a plane at the Z value of the points to be tested
for each position of the sun:
+Render the image so only the plane with the extent of the shadow is visible
(option Cast Only, and the camera is orthogonal and has a top view.)
+Export the image
+Import the image with an image processing library in Python
for each point to be tested is a shadow cast over it:
+Find the pixel in the image that corresponds to
the position of the point
if the pixel value at that point is dark:
it is obscured
if not:
it is not obscured
Is there a better method for this? Please note that the points might have different Z coordinates, so my method is not optimal (it would require multiple planes).


point_loc = mathutils.Vector((x,y,z))where x,y,z are coords of point to be tested.sun_loc = sun.locationwhere sun is bpy.data.objects['YOUR_SUN_NAME']. Then ray is(sun_loc - point_loc)and ray origin ispoint_loc– Jaroslav Jerryno Novotny Dec 25 '14 at 22:37matrix_world.to_euler()but it will (should) yield the same result. Values of up will change everytime you call rotate() on it, it actually changes the vector forever. I am grasping at straws now, if you could post relevant parts of the code somewhere it would help – Jaroslav Jerryno Novotny Jan 01 '15 at 22:07