Files
2026-02-19 19:08:41 +09:00

19 lines
678 B
C

#ifndef MICROFACET_GGX_H
#define MICROFACET_GGX_H
#include "Common.h"
#include "Algorithm/BSDF.h" // create_orthonormal_basis
#include "cglm/struct/vec3.h"
// Trowbridge-Reitz GGX helpers (isotropic)
float ggx_distribution(float n_dot_h, float roughness);
float ggx_g1(float n_dot_v, float roughness);
float ggx_g_smith(float n_dot_v, float n_dot_l, float roughness);
float ggx_visibility(float n_dot_v, float n_dot_l, float roughness);
// GGX VNDF sampling (Heitz 2018) for isotropic GGX.
// Returns a half-vector (H) sampled from the distribution of visible normals.
vec3s ggx_sample_vndf(vec3s n, vec3s v, float roughness, float u1, float u2);
#endif // MICROFACET_GGX_H