Skip to content

Commit dac67f9

Browse files
authored
Merge pull request #8494 from AnalyticalGraphicsInc/fix-mac-front-facing
Fix lighting on Mac/Intel
2 parents e5cc188 + f064b35 commit dac67f9

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Change Log
1212
* Fixed `OrientedBoundingBox.fromRectangle` for rectangles with width greater than 180 degrees. [#8475](https://github.com/AnalyticalGraphicsInc/cesium/pull/8475)
1313
* Fixed globe picking so that it returns the closest intersecting triangle instead of the first intersecting triangle. [#8390](https://github.com/AnalyticalGraphicsInc/cesium/pull/8390)
1414
* Fixed horizon culling issues with large root tiles. [#8487](https://github.com/AnalyticalGraphicsInc/cesium/pull/8487)
15+
* Fixed a lighting bug affecting Macs with Intel integrated graphics where glTF 2.0 PBR models with double sided materials would have flipped normals. [#8494](https://github.com/AnalyticalGraphicsInc/cesium/pull/8494)
1516

1617
##### Additions :tada:
1718
* Added `Globe.backFaceCulling` to support viewing terrain from below the surface. [#8470](https://github.com/AnalyticalGraphicsInc/cesium/pull/8470)

Source/Scene/processModelMaterialsCommon.js

+1
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ import ModelUtility from './ModelUtility.js';
543543
if (hasNormals) {
544544
fragmentShader += ' vec3 normal = normalize(v_normal);\n';
545545
if (khrMaterialsCommon.doubleSided) {
546+
// !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/AnalyticalGraphicsInc/cesium/pull/8494.
546547
fragmentShader += ' if (gl_FrontFacing == false)\n';
547548
fragmentShader += ' {\n';
548549
fragmentShader += ' normal = -normal;\n';

Source/Scene/processPbrMaterials.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ import ModelUtility from './ModelUtility.js';
602602
fragmentShader += ' vec3 n = ng;\n';
603603
}
604604
if (material.doubleSided) {
605-
fragmentShader += ' if (!gl_FrontFacing)\n';
605+
// !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/AnalyticalGraphicsInc/cesium/pull/8494.
606+
fragmentShader += ' if (gl_FrontFacing == false)\n';
606607
fragmentShader += ' {\n';
607608
fragmentShader += ' n = -n;\n';
608609
fragmentShader += ' }\n';

0 commit comments

Comments
 (0)