Skip to content

Possible fix for the missing shadows #5

@gedeschaines

Description

@gedeschaines

Try inserting the following statements to the RenderEngine class color_at() method after line 125 of the engine.py module:

# Test if to_light ray hits another object before reaching the light.
(dist, hit) = self.find_nearest(to_light, scene)
if hit is None or (dist > (light.position - hit_pos).magnitude()):

and indent the subsequent "Diffuse and Specular shading" code blocks underneath the newly inserted if statement.

ref: "Shadow Rays" slides in https://www.inf.ed.ac.uk/teaching/courses/cg/lectures/slides10.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions