Skip to content

Commit

Permalink
merian-nodes: ggx start implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
LDAP committed Aug 26, 2024
1 parent f6a2970 commit 9b8e123
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/merian-shaders/bsdf_ggx.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _MERIAN_SHADERS_BSDF_GGX_H_
#define _MERIAN_SHADERS_BSDF_GGX_H_

#include "merian-shaders/common.glsl"

// Smiths shadow masking term
float smith_g1(const float roughness, const float wodotn) {
const float alpha_sq = pow(roughness, 4);
return 2.0 * wodotn / (wodotn + sqrt(alpha_sq + (1.0 - alpha_sq) * MERIAN_SQUARE(wodotn)));
}

#endif // _MERIAN_SHADERS_BSDF_GGX_H_
6 changes: 6 additions & 0 deletions include/merian-shaders/fresnel.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef _MERIAN_SHADERS_FRESNEL_H_
#define _MERIAN_SHADERS_FRESNEL_H_

#define fresnel_schlick(minuswi_dot_h, F0) ((F0) + (1. - (F0)) * pow(max(1. - (minuswi_dot_h), 0), 5.))

#endif // _MERIAN_SHADERS_FRESNEL_H_

0 comments on commit 9b8e123

Please sign in to comment.