float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| float D_GGX_Anisotropic(float at, float ab, float ToH, float BoH, float NoH) { | |
| // Burley 2012, "Physically-Based Shading at Disney" | |
| float a2 = at * ab; | |
| vec3 d = vec3(ab * ToH, at * BoH, a2 * NoH); | |
| return saturateMediump(a2 * sq(a2 / dot(d, d)) * (1.0 / PI)); | |
| } | |
| float V_SmithGGXCorrelated_Anisotropic(float at, float ab, float ToV, float BoV, | |
| float ToL, float BoL, float NoV, float NoL) { | |
| // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| in vec2 v_texcoord; // texture coords | |
| in vec3 v_normal; // normal | |
| in vec3 v_binormal; // binormal (for TBN basis calc) | |
| in vec3 v_pos; // pixel view space position | |
| out vec4 color; | |
| layout(std140) uniform Transforms | |
| { | |
| mat4x4 world_matrix; // object's world position |