cx20
March 2, 2019, 3:41pm
1
I tried to display the following models with Babylon JS Sandbox (v4.0.0-alpha.29).
However, it seems that nothing is displayed on the screen.
https://sandbox.babylonjs.com/?assetUrl=https://rawcdn.githack.com/KhronosGroup/glTF-Sample-Models/ec880043ae0cead374d7e3a965cc8323c51b06e1/2.0/Triangle/glTF/Triangle.gltf
I do not remember the exact version, but I think that it was able to be displayed about a month ago.
Leon
March 2, 2019, 3:45pm
3
cx20
March 2, 2019, 4:14pm
4
cx20
March 2, 2019, 4:31pm
5
cx20
March 2, 2019, 5:36pm
6
@bghgary I think the fix between alpha.26 and 27 is affected.
The reason for this is that Triangle.gltf will be displayed when you restore the modification part.
cx20
March 2, 2019, 5:53pm
7
Load nothing instead of error if scene is undefined
The model which can not be displayed seemed to be a model without default scene.
There is no default scene in Triangle.gltf which is the minimum sample of glTF Tutorial.
Is it the intended behavior that Triangle.gltf does not appear on the BabylonJS Sandbox?
Previous: [Basic glTF Structure](gltfTutorial_002_BasicGltfStructure.md) | [Table of Contents](README.md) | Next: [Scenes and Nodes](gltfTutorial_004_ScenesNodes.md)
# A Minimal glTF File
The following is a minimal but complete glTF asset, containing a single, indexed triangle. You can copy and paste it into a `gltf` file, and every glTF-based application should be able to load and render it. This section will explain the basic concepts of glTF based on this example.
```javascript
{
"scene": 0,
"scenes" : [
{
"nodes" : [ 0 ]
}
],
"nodes" : [
{
"mesh" : 0
}
This file has been truncated. show original
Yes. This is the expected behavior. It was incorrect before. See https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#scenes
When scene
is undefined, runtime is not required to render anything at load time.
cx20
March 3, 2019, 4:58am
9
I understood that it was the expected behavior.
However, it is a little doubtful whether it is appropriate behavior.
I have found similar discussions in the past.
Handling multiple scenes without a default scene #815
opened 06:59PM - 14 Jan 17 UTC
closed 11:57AM - 15 Jun 17 UTC
specification
2.0
resolved
The [1.0 specification says about scenes](https://github.com/KhronosGroup/glTF/t… ree/master/specification/1.0#scenes) :
> The glTF asset contains one or more scenes, the set of visual objects to render. Scenes are defined in a dictionary object `scenes`. An additional property, `scene` (note singular), identifies which of the scenes in the dictionary is to be displayed at load time.
Hereby, [the `glTF.scene` property is not required](https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#gltfscene)
Several loaders and viewers are assuming that the `glTF.scene` property is present. Moreover, it is not clear what should happen when there are *multiple* `scenes`, but no default `scene`.
Should viewers then load and display *all* scenes? Or only the first scene? Or an arbitrary one?
(This question has some analogies to the `cameras`: There is no default `camera`, and viewers seem to be free to pick any camera for the initial rendering).
---
Pull request where this issue originated from: https://github.com/KhronosGroup/glTF-Sample-Models/pull/18#issuecomment-271922646
Related issues: https://github.com/KhronosGroup/glTF/issues/39 , https://github.com/KhronosGroup/glTF/issues/150 , and maybe others...
I think the following behavior is desirable as a viewer.
if there’s no scene
, then scenes[0]
is selected.
Otherwise, I think that features should be provided that can be selected from multiple scenes.
Towards the end of the thread, it ended with the language I quoted in the spec. If you feel strongly about the spec, please submit an issue to the glTF GitHub.
I made this change because of glTF: files with no scenes give "/scene: Failed to find index (0)" · Issue #5900 · BabylonJS/Babylon.js · GitHub , but I can modify the code such that:
/scene
is not defined and /scenes
is empty, then load nothing
/scene
is not defined and /scenes
is not empty, then load the first scene.
That will satisfy both issue 5900 and this issue.
1 Like
cx20
March 4, 2019, 6:03pm
11
Thank you for considering.
/scene is not defined and /scenes is empty, then load nothing
/scene is not defined and /scenes is not empty, then load the first scene.
I think that behavior is user-friendly as a viewer.
cx20
March 4, 2019, 10:47pm
13
Thank you for fixing. I confirmed that it has been fixed by alpha30.
BTW, I think that it is another problem, but when trying to display Triangle.gltf it seems that a shader error is output to the console. Could you confirm it?
https://sandbox.babylonjs.com/?assetUrl=https://rawcdn.githack.com/KhronosGroup/glTF-Sample-Models/ec880043ae0cead374d7e3a965cc8323c51b06e1/2.0/Triangle/glTF/Triangle.gltf
1 Like
Update pbrBRDFFunctions.fx · BabylonJS/Babylon.js@e8a329c · GitHub fixes it. it will be in the next nightly, thanks for reporting it.
1 Like
cx20
March 5, 2019, 3:24pm
16
Thank you for your fixing. I confirmed that the shader error was resolved in the updated version of alpha30.