Skip to content

Commit

Permalink
another
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Valigursky committed Feb 26, 2025
1 parent b7cd47b commit 89e7937
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/scene/shader-lib/programs/lit-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ class LitShader {
}

if (options.useMetalness) fDefines.set('LIT_METALNESS', '');
if (options.enableGGXSpecular) fDefines.set('LIT_GGX_SPECULAR', '');

// FRAGMENT SHADER INPUTS: UNIFORMS

Expand Down Expand Up @@ -660,9 +661,11 @@ class LitShader {
#ifdef LIT_SHEEN
#include "lightSheenPS"
#endif
`);
if (options.enableGGXSpecular) func.append('uniform float material_anisotropy;');
#ifdef LIT_GGX_SPECULAR
uniform float material_anisotropy;
#endif
`);

if (this.lighting) {
func.append(chunks.lightDiffuseLambertPS);
Expand All @@ -675,7 +678,13 @@ class LitShader {
if (options.useSpecular) {

if (this.lighting) {
func.append(options.enableGGXSpecular ? chunks.lightSpecularAnisoGGXPS : chunks.lightSpecularBlinnPS);
func.append(`
#ifdef LIT_GGX_SPECULAR
#include "lightSpecularAnisoGGXPS"
#else
#include "lightSpecularBlinnPS"
#endif
`);
}

if (!options.fresnelModel && !this.reflections && !options.diffuseMapEnabled) {
Expand Down

0 comments on commit 89e7937

Please sign in to comment.