Missing `#ifdef` in `bumpFragment.fx`?

Recently, I’ve experienced a shader error in the bump shader, which complained about undeclared TBN variable. I’ve looked into the source code and found this fragment:

Apparently, TBN is used in this snippet, which requires BUMP to be defined and also vBumpUV is used, which also requires BUMP to be defined. Shouldn’t this #ifdef be #if defined(BUMP) && defined(PARALLAX) then?

Technically you are right. But the system will not define PARALLAX without defining BUMP:
Babylon.js/pbrBaseMaterial.ts at 009654f32f0d76332f240e82c0237123350113a2 · BabylonJS/Babylon.js (github.com)

@rassie I would be highly interested in a repro if you have it :slight_smile:

@sebavan it’s very rare that I see that in my project, so I can’t promise that, but I’ll try.

1 Like