Concepts
Model Loading
Loader selection, fit modes, centering, texture remapping, and when model materials are overridden by CSS.
Model Loading
Models are the object type with the most moving parts, because they combine provider loaders, scene import, material override, and fit logic.
Required attribute
HTML
<div string="3d" string-3d="model" string-3d-model="/models/robot.glb"></div>
Without string-3d-model, the scene runtime does not create the model object.
Loader selection
There are three ways model loading can be decided:
- a direct module setting
modelLoader - a module setting
modelLoaderFactory - a type name from
modelLoaderTypeorstring-3d-model-loader
Fit and centering
string-3d-model-fitcontrols how the imported model is fit to the DOM boxstring-3d-model-scaleapplies an extra scale factorstring-3d-model-centerrecenters the loaded root around its bounding box
Texture remapping
Two attributes affect loader-side texture resolution:
string-3d-model-texture-basestring-3d-model-textures
The second one is expected to be JSON.
Material override rule
If the model element defines material-related CSS such as --material-color or --texture-map, the runtime treats that as an override signal and replaces imported mesh materials with the CSS-driven material pipeline.
Related