Hi! I am looking for roadmap what is going on with ModelExperimental? Why is it being implemented and what are the main goals / advantages with it? Could anyone know if there is blog entries etc. about this?
Hi @v12424124_34,
Thank you for reaching out! At a high level, ModelExperimental
seems to be based on the Model
class, which defines a 3D Model in CesiumJS that is based on a glTF
. ModelExperimental
seems to be optimized for machines with newer architecture and likely exhibits performance increases in certain areas. In addition, it uses part of our 3D Tiles spec that has not yet been finalized. Maybe @sean_lilley can provide some more context here?
Best,
Sam
Hi @v12424124_34,
ModelExperimental is a rewrite of Model built for 3D Tiles Next and custom shaders. It’s under active development and will stabilize in a few months, at which point it will be renamed to Model and replace the old code.
You can find the roadmap here: 3D Tiles Next CesiumJS Roadmap · Issue #9520 · CesiumGS/cesium · GitHub
Thank you for the answers!
Couple of thoughts:
- Is there anything especially webgpu related in this major r&d step?
- Is current ModelExperimental exchangeable with old the Model? So is it backwards compatible, I guess?
Good questions!
- Nothing WebGPU related in ModelExperimental, though WebGPU is on our radar for CesiumJS.
- ModelExperimental will be mostly backwards compatible with Model, but the exact breaking changes haven’t been decided yet. We will possibly drop support for glTF 1.0.
So ModelExperimental is back to Model in the latest releases? Or renamed?
Whats the best way to construct one from a base64 gltf string (from a czml)?
ModelExperimental is now renamed to Model.
Try converting the base64 string to a data uri and passing it to Model.fromGltf. I haven’t tried this myself, but it may just work.
Thanks, any recollection what version it was renamed?
The cmzl.model in not a Model object?
Something like?
const blob = b64toBlob(czml[i]?.model?.gltf);
const uri = URL.createObjectURL(blob);
const m1 = ModelExperimental.fromGltf({
url: czml[i].model.gltf,
customShader: fresnelCustomShader,
color: czml[i].model.color,
modelMatrix: czml[i].modelMatrix,
});
It was renamed in 1.97.
Does that code snippet work for you?
And is it the same game for Model3DTileContent.fromGltf?
I wouldn’t ask if it worked… : ) Some old discussion here Add 3D model using Blob object
The Blob
object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream
so its methods can be used for processing the data.
Not sure about the encoding
Hi @ka_sc, here is a rough Sandcastle which I think demonstrates what you were wanting to do. It is modified from the CZML Model Data URL Sandcastle, and constructs a Model from the base64 gltf string in a CZML.
The CZML model.gltf was constructed like this:
const blob = new Blob([JSON.stringify(gltf)], { type: "application/json" });
const dataUrl = URL.createObjectURL(blob);
And then it is used to construct the Model like this:
const model = viewer.scene.primitives.add(
Cesium.Model.fromGltf({
url: czml[1].model.gltf,
modelMatrix: modelMatrix,
})
);
Does that fit what you were trying to do?
Great, would the second work work with custom shaders?
I start form czml and want to give the gltf in there its own Model and shader
Couple of shader errors Cesium Sandcastle
RuntimeError: Fragment shader failed to compile. Compile log: WARNING: 0:2: ‘GL_OES_standard_derivatives’ : extension is not supported
ERROR: 0:10: ‘gl_FragColor’ : undeclared identifier
ERROR: 0:10: ‘assign’ : l-value required (can’t modify a const)
ERROR: 0:10: ‘=’ : dimension mismatch
ERROR: 0:10: ‘assign’ : cannot convert from ‘highp 4-component vector of float’ to ‘const highp float’
ERROR: 0:19: ‘{’ : syntax error
without that it works Cesium Sandcastle
Is gl_FragColor meant to be material.diffuse? cesium/README.md at main · CesiumGS/cesium · GitHub