38 lines
1.7 KiB
C
38 lines
1.7 KiB
C
#ifndef BSDF_H
|
|
#define BSDF_H
|
|
|
|
#include "Algorithm/Sobol.h"
|
|
#include "cglm/struct/vec3.h"
|
|
|
|
#define DIELECTRIC_REFLECTIVE_F0 0.04f // Standard dielectric reflectivity coef at incident angle (= 4%)
|
|
#define DIELECTRIC_REFLECTIVE ((vec3s){0.04f, 0.04f, 0.04f})
|
|
#define DIELECTRIC_F0 ((vec3s){0.04f, 0.04f, 0.04f })
|
|
|
|
float power_heuristic(float pdf_a, float pdf_b);
|
|
float roughness_to_blinn_phong_specular_exponent(float roughness);
|
|
float blinn_phong_specular_exponent_to_roughness(float specular_exponent);
|
|
vec3s fresnel_schlick_vec3(vec3s f0, float cos_theta);
|
|
|
|
|
|
vec3s normal_unpack(vec3s normal);
|
|
vec3s normal_ts_to_ws(vec3s normal, vec3s geo_normal, vec3s tangent);
|
|
|
|
|
|
// BSDF sampling functions
|
|
float pdf_cosine_weighted_hemisphere(vec3s normal, vec3s wi);
|
|
float pdf_blinn_phong_lobe(vec3s normal, vec3s wi, vec3s wo, float roughness);
|
|
|
|
vec3s sample_cosine_weighted_hemisphere_z_angular(float angular, uint32_t index, uint16_t d1, uint16_t d2, uint32_t scramble);
|
|
vec3s sample_cosine_weighted_hemisphere_z(uint32_t index, uint16_t d1, uint16_t d2, uint32_t scramble);
|
|
void create_orthonormal_basis(vec3s direction, vec3s* u, vec3s* v);
|
|
vec3s random_cosine_direction_angular(vec3s direction, float angular, uint32_t index, uint16_t d1, uint16_t d2, uint32_t scramble);
|
|
vec3s random_cosine_direction(vec3s direction, uint32_t index, uint16_t d1, uint16_t d2, uint32_t scramble);
|
|
|
|
vec3s random_uniform_cdf_direction(vec3s direction, uint32_t index, uint16_t d1, uint16_t d2, uint32_t scramble);
|
|
vec3s random_uniform_cdf_direction_angular(vec3s direction, uint32_t index, float angular, uint16_t d1, uint16_t d2, uint32_t scramble);
|
|
|
|
|
|
vec3s weight_nee_light(vec3s bsdf, vec3s light, float pdf_bsdf, float pdf_sky);
|
|
|
|
#endif // BSDF_H
|