File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,6 +116,8 @@ vec3 pbrEmissive(vec2 texcoord)
116116 }
117117}
118118
119+ PBRMaterial pbrInitMaterial(PBRMaterial mat);
120+
119121PBRMaterial pbrMaterial(vec2 texcoord)
120122{
121123 PBRMaterial mat;
@@ -130,6 +132,15 @@ PBRMaterial pbrMaterial(vec2 texcoord)
130132 mat.occlusion = pbrOcclusion(texcoord);
131133 mat.emissive = pbrEmissive(texcoord);
132134
135+ mat = pbrInitMaterial(mat);
136+
137+ return mat;
138+ }
139+
140+ #endif // READ_MATERIAL
141+
142+ PBRMaterial pbrInitMaterial(PBRMaterial mat)
143+ {
133144 // Taken directly from GLTF 2 .0 specs
134145 // this can be precalculated instead of evaluating it in the BRDF for every light
135146
@@ -143,8 +154,6 @@ PBRMaterial pbrMaterial(vec2 texcoord)
143154 return mat;
144155}
145156
146- #endif
147-
148157// gives a new value a (roughness^2 )
149158float specularAntiAliasing(vec3 N, float a)
150159{
@@ -176,7 +185,7 @@ float specularAntiAliasing(vec3 N, float a)
176185// and
177186// https://learnopengl.com/PBR/Lighting
178187
179- # define INV_PI 0.3183098861837906715377675267450
188+ # define INV_PI ( 0.3183098861837906715377675267450)
180189
181190// Schlick approximation to Fresnel equation
182191vec3 F_Schlick(float VoH, vec3 F0)
You can’t perform that action at this time.
0 commit comments