Surfaces module

Geometric surfaces in the scene which can be intersected by rays.

Files

file bbh.cpp
Class BBH, BBHNode, and #BBHBuildRecord.
file quad.cpp
Class Quad.
file sphere.cpp
Class Sphere.

Classes

class Sphere
A sphere centered at the origin with radius m_radius.
struct HitInfo
Contains information about a ray intersection hit point.
struct EmitterRecord
Data record for conveniently querying and sampling emitters.
class Surface
This is the abstract superclass for all surfaces.
class XformedSurfaceWithMaterial
A convenience subclass of Surface for simple surfaces with a Transform and a Material.
class SurfaceGroup
A collection of Surfaces grouped together.
struct BBH
An axis-aligned bounding box hierarchy acceleration structure.
struct BBHNode
A node of an axis-aligned bounding box hierarchy.
class Quad
A quad spanning from -m_size / 2 to m_size / 2 in the (x,y)-plane at z=0.

Functions

auto intersect(const Ray3f& ray, HitInfo& hit) const -> bool override
Ray-Surface intersection test.
void build() override
Construct the BBH (must be called before intersect)
auto intersect(const Ray3f& ray, HitInfo& hit) const -> bool override
Intersect a ray against all surfaces registered with the Accelerator.
auto intersect(const Ray3f& ray, HitInfo& hit) const -> bool override
Ray-Surface intersection test.
auto local_bounds() const -> Box3f override
Return the surface's local-space AABB.
auto sample(EmitterRecord& rec, const Vec2f& rv) const -> Color3f override
Sample a direction from rec.o towards this surface.
auto pdf(const Vec3f& o, const Vec3f& v) const -> float override
Return the probability density of the sample generated by sample.
auto intersect(const Ray3f& ray, HitInfo& hit) const -> bool override
Ray-Surface intersection test.
auto local_bounds() const -> Box3f override
Return the surface's local-space AABB.

Function documentation

bool intersect(const Ray3f& ray, HitInfo& hit) const override

Ray-Surface intersection test.

Parameters
ray A 3-dimensional ray data structure with minimum/maximum extent information
hit A detailed intersection record, which will be filled by the intersection query
Returns true if an intersection was found

Intersect a ray against this surface and return detailed intersection information.

void build() override

Construct the BBH (must be called before intersect)

bool intersect(const Ray3f& ray, HitInfo& hit) const override

Intersect a ray against all surfaces registered with the Accelerator.

bool intersect(const Ray3f& ray, HitInfo& hit) const override

Ray-Surface intersection test.

Parameters
ray A 3-dimensional ray data structure with minimum/maximum extent information
hit A detailed intersection record, which will be filled by the intersection query
Returns true if an intersection was found

Intersect a ray against this surface and return detailed intersection information.

Box3f local_bounds() const override

Return the surface's local-space AABB.

Color3f sample(EmitterRecord& rec, const Vec2f& rv) const override

Sample a direction from rec.o towards this surface.

Parameters
rec An emitter query record. Only rec.o is used as input, the remaining fields are used as output.
rv Two uniformly distributed random variables on [0,1)
Returns The surface color value divided by the probability density of the sample. A zero value means that sampling failed.

Store result in rec, and return important weight (i.e. the color of the Surface divided by the probability density of the sample with respect to solid angle).

float pdf(const Vec3f& o, const Vec3f& v) const override

Return the probability density of the sample generated by sample.

bool intersect(const Ray3f& ray, HitInfo& hit) const override

Ray-Surface intersection test.

Parameters
ray A 3-dimensional ray data structure with minimum/maximum extent information
hit A detailed intersection record, which will be filled by the intersection query
Returns true if an intersection was found

Intersect a ray against this surface and return detailed intersection information.

Box3f local_bounds() const override

Return the surface's local-space AABB.