Skip to content

Book 3.4: Sphere Importance Sampling #1500

Closed
@rupsis

Description

@rupsis

Perhaps I'm just slow, but for Listing 16, the f() function took me a little while to figure out.

double f(const vec3& d) {
    auto cosine_squared = d.z()*d.z();
    return cosine_squared;
}

If I understand correctly, $cos(\theta)^2$ here is $(\cos(0^\circ) *z)^2$ (where Z is from the random_unit_vector)
and since $cos(0^\circ) = 1$ we're left with d.z()*d.z().

The text doesn't make that obvious. Perhaps (and very likely) the issue is me. But if my understanding is correct, maybe some clarification could be useful. A small attempt on my part:

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions