-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
EXT_node_lod extension proposal #2228
base: main
Are you sure you want to change the base?
Conversation
Question: at which point a node would stop being visible? Based on the current implementation, I guess the last LOD, the one with smallest coverage, would point to an empty node? Otherwide, I would add a property called "minCoverage" that would define at which point the node should not be rendered at all. minCoverage should be smaller than the smallest coverage of any LOD, or 0 by default Also, How coverage is calculated? I guess it would be based on spheres? in which case maybe it could be useful having a Radius as a hint? |
Yes because I think the implementation would be simple regardless of whether including invisible LOD like the following pseudo code.
Perhaps sphere or box. This LOD extension switches node so to calculate the node sphere/box the implementation needs to traverse descendant nodes. It may be troublesome so adding a hint (as required?) may be good. Or distance based coverage may be good because no calculation is needed. |
My concern is that currently, glTF validator gives warnings on empty nodes, and many tools not aware of the extension might "optimize" the models by removing empty nodes. My feeling is that from one reason or another, glTF discourages empty nodes and preffers explicit and concise definitions.
The whole logic of the extension sits on top of the logic to switch between LODs, and this logic needs to be precisely defined to avoid multiple engines behaving diferently because they did different interpretations. So if you use "coverage"... what it means, coverage of what? the whole geometry? a bounding sphere? if two engines calculate the sphere in a different way, the end result would be that the coverage would be different in both engines, and as a consequence, the two engines would trigger the LOD switch at different times. Tha'ts why I think that if Coverage is used, it should be defined in the extension to guarantee consistency across engines. Distance would be an alternative option. But distance based LODs are sensitive to the screen size, so when rendering very large images would trigger lower LODs to soon, resulting in a loss of quality. If anything I would use Distance divided by screen height, to ensure similar behavior for different image sizes. Again, the extension need to define this to ensure consistest behavior across multiple engines |
Some potential options in my mind are
The goal is to clearly define coverage perhaps with fomula. I first want to discuss distance vs screen coverage. And especially if we choose screen coverage, I want to discuss how it should be consistently calculated next. If screen coverage is preferable, I'm thinking if it's good to add sphere, box, or plane size for calculating screen coverage as required parameter. |
I need a double check because I'm not an expert of 3D CG algebra but perhaps screen coverage ratio can be calculated with this formula? Assuming sphere is in the viewport.
It can be more complex if we allow sphere to have un-unified scale.xyz and to rotate tho. |
Thinking if different radiuses per LOD level should be allowed and where bounding sphere radiuses for LODs should be defined. Radiuses for lower LODs can be defined in elements of
But where for the highest LOD.
|
If glTF vs glXF will end up with self-contained vs scene (composition), defining the extension not in glTF but in glXF might be more straightforward and intuitive (one Level in one glTF file). |
Working repository: https://github.com/takahirox/EXT_node_lod
I would like to propose
EXT_node_lod
extension that allows LODs in glTF.I know already
MSFT_lod
extension exists for LOD. The new extension is less flexible but simpler thanMSFT_lod
so it should be easier for the handlers (implementations) to handle.JSON structure and examples
EXT_node_lod
can be defined at thenode
level.Difficulty of handling
MSFT_lod
While I was writing a handler for
MSFT_lod
I realized thatMSFT_lod
has some difficulties to handle.node
andmaterial
can define LOD. The behavior is unstated in the specification ifmaterial
containing LOD is referred bynode
containing LOD.node
can specify othernode
s so LODnode
can form nest or even infinity loop. And the behavior for them is unstated in the specification.extra
as optional. Unclear how to switch LOD for applications/viewers/engines if it is undefined because they don't know the qualities of LODs.Simplification ideas
I would like to suggest to simplify the LOD specification. It will lose some flexibilities but be simpler to write an implementation. The differences from
MSFT_lod
specification areAdditional notes
EXT_
prefix) rather than a vendor extension.Discussions
I'm still thinking how threshold values should be, screen coverage, distance from camera, or others. In the current PR, I chose screen coverage for now just to follow
MSFT_lod
spec. Probably compatibility is important so we may need to choose the generic one that can be handled easily and consistently across applications/viewers/engines.takahirox/EXT_node_lod#1
Difficulties of handling screen coverage threshold.
Related threads