Open
Conversation
Add per-feature styling capability to OGC3DTilesLayer, enabling color assignment by feature type (e.g. Building, SolitaryVegetationObject). - Detect feature IDs from _FEATURE_ID_0 (3D Tiles 1.1) with _batchid (1.0) fallback - Handle both indexed and non-indexed geometries when building feature groups - Support dynamic style application and removal via layer.style setter - Cache and restore original materials when style is toggled - Clean up tile features on dispose-model events - Add unit tests for feature init, styling, restore, cleanup, and picking - Add 3DTiles-11-styling.html example for interactive feature color picking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix optimizeGeometryGroups to only merge contiguous groups, preventing wrong vertex ranges when features of the same type interleave - Remove incorrect eslint-disable on used Style import - Use separator in material cache key to avoid ambiguous concatenation - Early return in style setter when clearing style (null) - Hoist rebuildTimer to module scope and clear on layer removal - Replace silent catch blocks with console.warn in example - Add indexed-geometry unit test for _initFeatures - Update 3dtiles_loader and OGC3DTilesHelper examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: This branch is based on master prior to the sky/atmosphere rendering merge (66a44d4), which introduced a camera/zoom regression I encountered. The changes in this PR are independent of that feature and should rebase cleanly once the regression is addressed.
Also, you will see in commit messages that code is generated by AI. however, I have made sure I understand the code and I have deliberately kept the code edits limited in scope to ease the work of reviewers.
PR message generated by AI; lightly modified by me
Description
Add per-feature styling capability to
OGC3DTilesLayer, enabling color assignment by feature type (e.g. Building, SolitaryVegetationObject). The original intent was to provide interactive visual rendering for 3DTiles 1.1 but 3D Tiles 1.0 behavior should be preserved.New functionality in
OGC3DTilesLayer:_FEATURE_ID_0(3D Tiles 1.1) with_batchid(1.0) fallbackEXT_structural_metadataproperty tables intoC3DTFeature.userDatalayer.stylesetter, with material cachingdispose-modeleventsBug fix in
optimizeGeometryGroups(ThreeUtils.js):materialIndexwere merged unconditionally, which produced wrong vertex ranges when features of the same type interleave in the buffer (e.g. Building, Vegetation, Building).Tests:
Examples:
3DTiles-11-styling.html: interactive per-type color picker for any tileset URLOGC3DTilesHelper.jsMotivation and Context
There was no built-in way to style individual features in
OGC3DTilesLayerby semantic type. Users working with CityGML-derived 3D Tiles (Buildings, Vegetation, etc.) had no API to assign colors per feature category.This change brings
OGC3DTilesLayercloser to the per-feature styling capabilities already present in the vector layer pipeline, and makes the 3D Tiles 1.1EXT_structural_metadata/EXT_mesh_featuresextensions usable for styling.Tested on Chrome 134 / Windows 11 (WSL2) with 3D Tiles 1.1 tilesets containing
EXT_structural_metadata.Screenshots
screenshot of

3DTiles-11-styling.htmlshowing color pickers and styled features.