Warning in GLTFExporter about double sided lighting and backface culling

Hello there!
I have a question about this little piece of code that seem wrong to me:

if (babylonPBRMaterial.backFaceCulling != null && !babylonPBRMaterial.backFaceCulling) {
    if (!babylonPBRMaterial._twoSidedLighting) {
        Tools.Warn(babylonPBRMaterial.name + ": Back-face culling enabled and two-sided lighting disabled is not supported in glTF.");
    glTFMaterial.doubleSided = true;


The first if is entered only when backface culling is actually disabled, which contradict what is said in the warning message.

And I don’t get why “backface culling enabled and two sided lighting disabled” is a problem, in fact I find this logical, so shouldn’t the message be Back-face culling disabled and two-sided lighting disabled... to be correct both in accordance with the code, and in the factual correctness of the message ?

pinging @bghgary

Yes, that message seems to be wrong. Would you like to submit a fix?

Sure !

Should I open an issue on the Github linking this thread first ?

1 Like

if you plan to do a PR directly, no need :slight_smile: (*and thanks btw)

1 Like

Here is the fix:

1 Like