Skip to content

Public API

Internal API

# LinearAlgebra.IMethod.

Render scene.

source


# Trace.MAX_BxDFConstant.

Maximum allowed number of BxDF components in BSDF.

source


# Trace.PRIMESConstant.

First 1023 prime numbers (omitting 2). Used in radical_inverse function.

source


# Trace.BSDFType.

Evaluate BSDF function given incident and outgoind directions.

source


# Trace.DirectionalLightType.

Directional light does not take medium interface, since only reasonable interface for it is vacuum, otherwise all the light would've been absorbed by the medium, since the light is infinitely far away.

source


# Trace.FilmTileMethod.

Bounds should start from 1 not 0.

source


# Trace.LambertianReflectionType.

Lambertian Reflection models a perfect diffuse surface that scatters incident illumination equally in all directions.

source


# Trace.LambertianReflectionMethod.

Reflection distribution is constant and divides reflectance spectrum equally over the hemisphere.

source


# Trace.LambertianTransmissionType.

Lambertian Transmission models perfect transmission.

source


# Trace.MatteMaterialMethod.

Compute scattering function.

source


# Trace.MixTextureType.

texture_1 & texture_2 may be of any single texture type, but mix should be a texture that returns floating-point value that is used to interpolate between the first two.

source


# Trace.OrenNayarType.

Describes rough surfaces by V-shaped microfacets described by a spherical Gaussian distribution with parameter σ –- the standard deviation of the microfacet angle.

source


# Trace.SpecularReflectionMethod.

Return value of the distribution function for the given pair of directions. For specular reflection, no scattering is returned, since for arbitrary directions δ-funcion returns no scattering.

source


# Trace.SpecularTransmissionMethod.

Return value of the distribution function for the given pair of directions. For specular transmission, no scattering is returned, since for arbitrary directions δ-funcion returns no scattering.

source


# Trace.TransformMapping3DType.

3D mapping that takes world space coordinate of the point and applies a linear transformation to it. This will often be a transformation that takes the point back to the primitive's object space.

Because a linear mapping is used, the differential change in texture coordinates can be found by applying the same transformation to the partial derivatives of the position.

source


# Trace.TrowbridgeReitzDistributionType.

Microfacet distribution function based on Gaussian distribution of microfacet slopes. Distribution has higher tails, it falls off to zero more slowly for directions far from the surface normal.

source


# Trace.UVMapping2DType.

Simplest mapping uses (u, v) coordinates from the SurfaceInteraction to compute texture coordinates and can be offset and scaled with user-supplied values in each dimension.

source


# Trace.DMethod.

Distribution function, which gives the differential area of microfacets with the surface normal w.

source


# Trace.add_sample!Method.

Add sample contribution to the film tile.

  • point::Point2f: should start from 1 not 0. And is relative to the film, not the film tile.

source


# Trace.blackbody!Method.

Compute emitted radiance by blackbody at the given temperature for the wavelengths.

Args

  • Le::Vector{Float32}: Preallocated output vector for computed radiance.

  • λ::Vector{Float32}: Wavelengths for which to compute radiance. Their values should be in nm.

  • T::Float32: Temperature in Kelvin at which to compute radiance.

source


# Trace.blackbodyMethod.

Allocating version of blackbody! function.

source


# Trace.blackbody_normalized!Method.

Compute normalized SPD for a blackbody, with maximum value of the SPD at any wavelength is 1.

Args

  • Le::Vector{Float32}: Preallocated output vector for computed radiance.

  • λ::Vector{Float32}: Wavelengths for which to compute radiance. Their values should be in nm.

  • T::Float32: Temperature in Kelvin at which to compute radiance.

source


# Trace.compute_differentials!Method.

Compute partial derivatives needed for computing sampling rates for things like texture antialiasing.

source


# Trace.compute_pdfMethod.

Compute PDF value for the given directions. In comparison, sample_f computes PDF value for the incident directions it chooses given the outgoing direction, while this returns a value of PDF for the given pair of directions.

source


# Trace.compute_scattering!Method.

If an intersection was found, it is necessary to determine, how the surface's material scatters light. compute_scattering! method evaluates texture functions to determine surface properties and then initializing a representation of the BSDF at the point.

source


# Trace.cos_θMethod.

The shading coordinate system gives a frame for expressing directions in spherical coordinates (θ, ϕ). The angle θ is measured from the given direction to the z-axis and ϕ is the angle formed with the x-axis after projection of the direction onto xy-plane.

Since normal is (0, 0, 1) → cos_θ = n · w = (0, 0, 1) ⋅ w = w.z.

source


# Trace.face_forwardMethod.

Flip normal n so that it lies in the same hemisphere as v.

source


# Trace.fresnel_conductorMethod.

General Fresnel reflection formula with complex index of refraction η^ = η + ik, where some incident light is potentially absorbed by the material and turned into heat. k - is referred to as the absorption coefficient.

source


# Trace.fresnel_dielectricMethod.

Compute Fresnel reflection formula for dielectric materials and unpolarized light. Which describes the amount of light reflected from a surface.

  • cos_θi::Float32: Cosine of the incident angle w.r.t. normal.

  • ηi::Float32: index of refraction for the incident media.

  • ηt::Float32: index of refraction for the transmitted media.

source


# Trace.generate_rayMethod.

Compute the ray corresponding to a given sample. It is IMPORTANT that the direction vector of ray is normalized. Other parts of the system assume it to be so.

Returns generated ray & floating point that affects how much the radiance, arriving at the film plane along generated ray, contributes to the final image. Simple camera models can return 1, but cameras with simulated physical lenses set this value to indicate how much light carries through the lenses, based on their optical properties.

source


# Trace.generate_ray_differentialMethod.

Same as generate_ray, but also computes rays for pixels shifted one pixel in x & y directions on the film plane. Useful for anti-aliasing textures.

source


# Trace.get_physical_extensionMethod.

Extent of the film in the scene. This is needed for realistic cameras.

source


# Trace.get_pixelMethod.

Point in (x, y) format.

source


# Trace.get_pixelMethod.

Point in (x, y) format.

source


# Trace.get_sample_boundsMethod.

Range of integer pixels that the Sampler is responsible for generating samples for.

source


# Trace.intersect_pMethod.

dir_is_negative: 1 – false, 2 – true

source


# Trace.leMethod.

Emmited light if ray hit an area light source. By default light sources have no area.

source


# Trace.mapMethod.

Given surface interaction si at the shading point, return (s, t) texture coordinates and estimated changes in (s, t) w.r.t. pixel x & y coordinates.

Paramters:

  • m::UVMapping2D: UVMapping with offset & scale parameters.

  • si::SurfaceInteraction: SurfaceInteraction at the shading point.

Returns:

`Tuple{Point2f, Vec2f, Vec2f}`:
    Texture coordinates at the shading point, estimated changes
    in `(s, t)` w.r.t. pixel `x` & `y` coordinates.

source


# Trace.maximum_extentMethod.

Return index of the longest axis. Useful for deciding which axis to subdivide, when building ray-tracing acceleration structures.

1 - x, 2 - y, 3 - z.

source


# Trace.offsetMethod.

Get offset of a point from the minimum point of the bounds.

source


# Trace.powerMethod.

Total power emitted by the light source over the entire sphere of directions.

source


# Trace.powerMethod.

The total power emitted by the directional light is related to the spatial extent of the scene and equals the amount of power arriving at the inscribed by bounding sphere disk: I * π * r^2.

source


# Trace.reflectMethod.

Reflect wo about n.

source


# Trace.refractMethod.

Compute refracted direction wt given an incident direction wi, surface normal n in the same hemisphere as wi and η, the ratio of indices of refraction in the incident transmitted media respectively.

Returned boolean indicates whether a valid refracted ray was returned or is it the case of total internal reflection.

source


# Trace.roughness_to_αMethod.

Map [0, 1] scalar to BRDF's roughness, where values close to zero correspond to near-perfect specular reflection, rather than by specifying α values directly.

source


# Trace.sample_fMethod.

Compute incident ray direction for a given outgoing direction and a given mode of light scattering corresponding to perfect specular reflection or refraction.

source


# Trace.sample_fMethod.

Compute the direction of incident light wi, given an outgoing direction wo and return the value of BxDF for the pair of directions.

Note all BxDFs that implement this method, have to implement compute_pdf as well.

source


# Trace.sample_fMethod.

Compute the direction of incident light wi, given an outgoing direction wo and return the value of BxDF for the pair of directions. sample parameter isn't needed for the δ-distribution.

source


# Trace.sample_fMethod.

Compute the direction of incident light wi, given an outgoing direction wo and return the value of BxDF for the pair of directions.

source


# Trace.sample_fMethod.

Compute the direction of incident light wi, given an outgoing direction wo and return the value of BxDF for the pair of directions. sample parameter isn't needed for the δ-distribution.

source


# Trace.sample_liMethod.

Compute radiance arriving at ref.p interaction point at ref.time time due to that light, assuming there are no occluding objects between them.

Args

  • p::PointLight: Light which illuminates the interaction point ref.

  • ref::Interaction: Interaction point for which to compute radiance.

  • u::Point2f: Sampling point that is ignored for PointLight, since it has no area.

Returns

Tuple{S, Vec3f, Float32, VisibilityTester} where S <: Spectrum:

- `S`: Computed radiance.
- `Vec3f`: Incident direction to the light source `wi`.
- `Float32`: Probability density for the light sample that was taken.
    For `PointLight` it is always `1`.
- `VisibilityTester`: Initialized visibility tester that holds the
    shadow ray that must be traced to verify that
    there are no occluding objects between the light and reference point.

source


# Trace.start_pixelMethod.

Other samplers are required to explicitly call this, in their respective implementations.

source


# Trace.test_clippingMethod.

Test if hit point exceeds clipping parameters of the sphere.

source


# Trace.to_gridMethod.

Calculate indices of a point p in grid constrained by bounds.

Computed indices are in [0, resolution), which is the correct input for hash.

source


# Trace.world_to_localMethod.

Given the orthonormal vectors s, t, n in world space, the matrix M that transforms vectors in world space to local reflection space is: sx, sy, sz tx, ty, tz nx, ny, nz

Since it is an orthonormal matrix, its inverse is its transpose.

source


# Trace.ρMethod.

Directional-hemisphirical reflectance value is constant.

source


# Trace.ρMethod.

Hemispherical-hemisphirical reflectance value is constant.

source


# Trace.∂pMethod.

Compute partial derivatives of intersection point in parametric form.

source