Skip to content

Instantly share code, notes, and snippets.

View FacoBackup's full-sized avatar
🎯
Focusing

Gustavo Roque FacoBackup

🎯
Focusing
View GitHub Profile
@FacoBackup
FacoBackup / anisotropic_brdf.glsl
Created December 12, 2022 15:09 — forked from romainguy/anisotropic_brdf.glsl
Anisotropic BRDF
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"
@FacoBackup
FacoBackup / GLSL-Noise.md
Created April 15, 2022 23:34 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

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);
}
@FacoBackup
FacoBackup / pbr.glsl
Created January 8, 2022 19:47 — forked from galek/pbr.glsl
PBR GLSL SHADER
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