Skip to content

Book 3: Cosine calculated incorrectly  #932

@spkersten

Description

@spkersten

Here it seems the wrong vector is normalised:

scattered = ray(rec.p, unit_vector(scatter_direction), r_in.time());
alb = albedo->value(rec.u, rec.v, rec.p);
pdf = dot(rec.normal, scattered.direction()) / pi;

In creating a ray, scatter_direction is normalised while ray.direction (by convention) doesn't need to be normalised, while in calculating the cosine for the PDF value, scatter_direction is not normalised but it should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions