Comments (11)
@javagl master
branch supports now glTF 2.0. Hosted online version was also updated.
from gltf-sample-models.
It's probably not a "good" model, unless good==simple
, but I started creating a "SimpleSparseAccessors" model.
EDIT: Updated based on KhronosGroup/glTF-Validator#18 - The model now passes 2.0 validation
The embedded version is here:
{
"accessors" : [ {
"bufferView" : 0,
"byteOffset" : 0,
"componentType" : 5123,
"count" : 36,
"type" : "SCALAR",
"max" : [ 13 ],
"min" : [ 0 ]
}, {
"bufferView" : 1,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 14,
"type" : "VEC3",
"max" : [ 6.0, 4.0, 0.0 ],
"min" : [ 0.0, 0.0, 0.0 ],
"sparse" : {
"count" : 3,
"indices" : {
"bufferView" : 2,
"byteOffset" : 0,
"componentType" : 5123
},
"values" : {
"bufferView" : 3,
"byteOffset" : 0
}
}
} ],
"asset" : {
"version" : "2.0"
},
"buffers" : [ {
"uri" : "data:application/gltf-buffer;base64,AAAIAAcAAAABAAgAAQAJAAgAAQACAAkAAgAKAAkAAgADAAoAAwALAAoAAwAEAAsABAAMAAsABAAFAAwABQANAAwABQAGAA0AAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAQAAAAAAAAAAAAABAQAAAAAAAAAAAAACAQAAAAAAAAAAAAACgQAAAAAAAAAAAAADAQAAAAAAAAAAAAAAAAAAAgD8AAAAAAACAPwAAgD8AAAAAAAAAQAAAgD8AAAAAAABAQAAAgD8AAAAAAACAQAAAgD8AAAAAAACgQAAAgD8AAAAAAADAQAAAgD8AAAAACAAKAAwAAAAAAIA/AAAAQAAAAAAAAEBAAABAQAAAAAAAAKBAAACAQAAAAAA=",
"byteLength" : 284
} ],
"bufferViews" : [ {
"buffer" : 0,
"byteOffset" : 0,
"byteLength" : 72,
"target" : 34963
}, {
"buffer" : 0,
"byteOffset" : 72,
"byteLength" : 168
}, {
"buffer" : 0,
"byteOffset" : 240,
"byteLength" : 6
}, {
"buffer" : 0,
"byteOffset" : 248,
"byteLength" : 36
} ],
"meshes" : [ {
"primitives" : [ {
"attributes" : {
"POSITION" : 1
},
"indices" : 0
} ]
} ],
"nodes" : [ {
"mesh" : 0
} ],
"scenes" : [ {
"nodes" : [ 0 ]
} ]
}
Rendering it should look as in this screenshot:
As soon as it can be validated and the kinks are ironed out, I'd add it as a PR, together with a description.
from gltf-sample-models.
@javagl
Validator supports sparse accessors. Unrelated crash has been fixed.
from gltf-sample-models.
OT: @lexaknyazev You mentioned this once, and I wanted to validate it yesterday, but the dev
branch was gone, and I saw KhronosGroup/glTF-Validator#17 , so just deferred this for now. Did you use the .snapshot
?
from gltf-sample-models.
I think there may be a mistake in the sample:
In the screenshot above, note that the values
array (right column) contains zeros for all of the x
positions. The original bufferView has non-zero x
positions for these indices, and so after the sparse values are applied to the accessor, y
is right but x
is reset to zero. In three.js (work-in-progress implementation) I see this:
from gltf-sample-models.
Work in progress for three.js: donmccurdy/three.js@3b504ef
from gltf-sample-models.
@donmccurdy Adding a quick debug output for me gives
Sparse:
[( 1.00000, 2.00000, 0.00000),
( 3.00000, 3.00000, 0.00000),
( 5.00000, 4.00000, 0.00000)]
which seem to be the right values.
A quick standalone test that only decodes the given buffer and prints the relevant values...
public static void main(String[] args)
{
String s = "AAAIAAcAAAABAAgAAQAJAAgAAQACAAkAAgAKAAkAAgADAAoAAwALAAoAAwAEAAsABAAMAAsABAAFAAwABQANAAwABQAGAA0AAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAQAAAAAAAAAAAAABAQAAAAAAAAAAAAACAQAAAAAAAAAAAAACgQAAAAAAAAAAAAADAQAAAAAAAAAAAAAAAAAAAgD8AAAAAAACAPwAAgD8AAAAAAAAAQAAAgD8AAAAAAABAQAAAgD8AAAAAAACAQAAAgD8AAAAAAACgQAAAgD8AAAAAAADAQAAAgD8AAAAACAAKAAwAAAAAAIA/AAAAQAAAAAAAAEBAAABAQAAAAAAAAKBAAACAQAAAAAA=";
byte data[] = Base64.getDecoder().decode(s);
ByteBuffer bb = ByteBuffer.wrap(data).order(ByteOrder.nativeOrder());
bb.position(248);
FloatBuffer fb = bb.asFloatBuffer();
for (int i=0; i<fb.limit(); i++)
{
System.out.println("At "+i+" have "+fb.get(i));
}
}
also seems to be right.
Note that before the EDIT in the above post, the model contained values that might cause the effect that you observe. I'm not sure where the difference might come from, but will have another look ASAP.
from gltf-sample-models.
Oops, you're right β I had an old version of the file. Looks good now:
from gltf-sample-models.
I implemented sparse accessors today in my viewer, this model was critical! Thanks!
The documentation for sparse accessors is a bit, well, sparse. Probably needs some pretty diagrams. It took me days reading and re-reading (off and on) the document and I couldn't understand it, once my brain clicked it was only half an hour to implement.
from gltf-sample-models.
@CentaurMare This model did get merged into the sample models repo. The README file has some diagrams. Are more/better diagrams needed?
Since this issue is in the samples repo and not the main glTF repo, I'm tempted to say this should be closed, would you agree? If more official documentation/diagrams are needed, issues or pull requests could be filed to the appropriate place(s) for that.
from gltf-sample-models.
@emackey, yes, this can be closed. Better diagrams and/or wording are definitely needed in the spec, I will attempt to write something up and file against the spec.
from gltf-sample-models.
Related Issues (20)
- RecursiveSkeletons is not a valid glTF file HOT 2
- Errors in Fox model
- BoxTextured and BoxTexturedNonPowerOfTwo have different texture brightness HOT 8
- Buggy model doesn't follow the 4 bytes alignment requirement of the spec for indices HOT 2
- Blender GLTF fails the gLTF validation HOT 2
- Normal texture TestMap_blur.png does not conform to the glTF 2.0 spec HOT 4
- Please rename default branch from 'master' to 'main' per Khronos policy HOT 3
- Missing license for VertexColorTest HOT 1
- Missing license for BoxVertexColors HOT 1
- Many models missing AO channel HOT 9
- stainedGlassLamp/glTF-JPG-PNG alpha is 0.5 HOT 4
- π₯π₯π₯convert obj 3d model to gltf model on server side HOT 1
- Sponza gltf materials wrong? HOT 1
- It would be great if someone can convert these PBR research models into glTF HOT 5
- Mask / Stencil shader HOT 1
- InterpolationTest oddities HOT 4
- InterpolationTest translation animations loop badly HOT 7
- Iridescence test model? HOT 6
- Anisotropy test model? HOT 6
- Directory structure issues HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gltf-sample-models.