Skip to main content

Module brdf

Module brdf 

Source
Expand description

Complete BRDF (Bidirectional Reflectance Distribution Function) library.

Pure CPU math — no GPU types. All functions use glam::{Vec2, Vec3} and bare f32. Organised into:

  • distribution — microfacet normal-distribution functions (D)
  • geometry — masking/shadowing functions (G)
  • fresnel — Fresnel reflectance functions (F)
  • vec3 — Vec3 helpers used throughout
  • [brdf] — full BRDF evaluators (Cook-Torrance, Lambertian, …)
  • ibl — image-based lighting helpers
  • [lights] — light types and shading loop
  • tonemap — tone-mapping operators
  • [glsl] — GLSL source generation

Re-exports§

pub use tonemap::ToneMapOp;

Modules§

distribution
Microfacet normal-distribution functions.
fresnel
Fresnel reflectance functions.
geometry
Microfacet masking-shadowing functions.
ibl
Image-based lighting helpers.
tonemap
Tone-mapping operators for converting HDR radiance to display-ready LDR.
vec3
Lightweight Vec3 helper functions used throughout the BRDF library.

Structs§

AnisotropicBrdf
Anisotropic GGX BRDF.
AreaLight
Rectangular area light using the Linearly Transformed Cosines (LTC) approach.
BrdfGlsl
Generates GLSL source strings for the BRDF functions in this module.
ClearcoatBrdf
Clearcoat BRDF layer — a thin dielectric coat on top of the base material.
CookTorranceBrdf
Cook-Torrance specular BRDF combined with Lambertian diffuse.
DirectionalLight
Directional (sun-like) light — no position, infinite distance.
LambertianBrdf
Lambertian (perfectly diffuse) BRDF.
OrenNayarBrdf
Oren-Nayar BRDF for rough diffuse surfaces.
PointLight
Omnidirectional point light.
ShadeMaterial
Combined material description used by shade_point.
SimpleRng
Simple xorshift32 PRNG used for Monte Carlo BRDF sampling. Not suitable for cryptography — only for rendering randomness.
SpotLight
Spot light — cone-shaped.

Enums§

Light
Light enum for the shading loop.

Functions§

shade_point
Full shading of a surface point given material, lights, geometry, and an optional IBL environment.