Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for PointCloudShading.normalShading parameter #12066

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change Log

- Fixed the PointCloudShading.normalShading parameter. Now it disables shading using normals if point cloud contains normals, but the parameter is set to false. [#12066]

### 1.123 - 2024-11-01

#### @cesium/engine
Expand Down
14 changes: 13 additions & 1 deletion packages/engine/Source/Scene/Model/MaterialPipelineStage.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,21 @@ MaterialPipelineStage.process = function (
VertexAttributeSemantic.NORMAL,
);

//Disable normals if PointCloud has them, but the parameter is set
//to false in PointCloudShading.normalShading.
let hasNormalsDisabling = false;
if (defined(model.pointCloudShading)) {
hasNormalsDisabling = !model.pointCloudShading.normalShading;
}

// Classification models will be rendered as unlit.
const lightingOptions = renderResources.lightingOptions;
if (material.unlit || !hasNormals || hasClassification) {
if (
material.unlit ||
!hasNormals ||
hasClassification ||
hasNormalsDisabling
) {
lightingOptions.lightingModel = LightingModel.UNLIT;
} else {
lightingOptions.lightingModel = LightingModel.PBR;
Expand Down