Scene.get_illumination_inputs¶
- Scene.get_illumination_inputs(trace_rays, return_intersects=False)[source]¶
This method returns the required inputs for an illumination function to compute the illumination for each ray.
This is done by performing a single bounce ray trace against all objects in the scene. First, the rays as provided are traced into the scene, returning the first intersect with anything in
target_objs
. Then, if the ray actually struck something, we trace from the intersect point toward thelight_obj
to see if the place we struck was shadowed or not. Presuming it was not shadowed, the geometry of the single bounce ray trace is encoded into a numpy structured array with dtypeILLUM_DTYPE
which can then be passed to the classes from theillumination
module to compute the intensity for each ray.If requested, this method also returns the results of the initial intersect (before the shadow bounce) as a structured numpy array with dtype
INTERSECT_DTYPE
which can be useful for determining if a ray didn’t see anything because it was shadowed or because it didn’t strike anything. Both returns will be shape (n,) where n is the number of rays traced.- Parameters:
trace_rays (Rays) – The rays we are to compute the illumination inputs for
return_intersects (bool) – A flag specifying whether the results of the initial trace should also be returned
- Returns:
A numpy array with shape (n,) and data type
ILLUM_DTYPE
and optionally a numpy array with shape (n,) and data typeINTERSECT_DTYPE
- Return type:
ndarray | Tuple[ndarray, ndarray]