Angular-based Level of Detail (LOD) implementation#82
Open
ericleib wants to merge 14 commits intoangular-threejs:mainfrom
Open
Angular-based Level of Detail (LOD) implementation#82ericleib wants to merge 14 commits intoangular-threejs:mainfrom
ericleib wants to merge 14 commits intoangular-threejs:mainfrom
Conversation
✅ Deploy Preview for angularthreedemo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for angularthreesoba ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
nartc
reviewed
Mar 16, 2026
Member
|
See this issue in the deploy preview |
Contributor
Author
|
@nartc I've made some improvements to the API if that's ok with you.
|
nartc
reviewed
Mar 17, 2026
Member
nartc
left a comment
There was a problem hiding this comment.
The separate inputs are fine. However,
<ngt-mesh *lodLevel="100" [hysteresis]="0.1" />won't work. the hysteresis here will be interpreted as a binding to ngt-mesh instead of the NgtsLODLevel directive here.
You have 2 options:
- go back to an object input
lodLevel = input(defaultLodLevelOptions, { transform: mergeInputs(defaultLodLevelOptions) }); // mergeInputs is from ngxtension. This will type the lodLevel input correctly in a way that you can do `*lodLevel` without an empty {}- alias the hysteresis input with
lodLevelHysteresisand usage with*lodLevelbecomes:
<ngt-mesh *lodLevel="100; hysteresis: 0.1" />
<!-- this becomes -->
<ng-template [lodLevel]="100" [lodLevelHysteresis]="0.1">
<ngt-mesh />
</ng-template>Co-authored-by: Chau Tran <25516557+nartc@users.noreply.github.com>
Contributor
Author
|
Thank you, great catch! I was fooled as Angular did not complain about the |
nartc
approved these changes
Mar 18, 2026
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.
Implements Level of Detail (LOD) rendering. Automatically switches between different detail levels of child objects based on camera distance.
Unlike
NgtsDetailed, this is an implementation based on Angular and angular-three APIs rather than Three's LOD class.The component adds and remove objects from the scene graph rather than hiding them with
visible = false.This solves a number of issues such as avoid raycasting over hidden objects.
Usage:
The
[lodLevel]directive (NgtsLODLevel) supports the following options:distance0hysteresis0This directive may also be used with the following syntax: