Obj¶
The Obj component loads and displays OBJ (Wavefront) 3D model files.
This is ideal for:
Loading static 3D models from files
Displaying pre-made assets
Loading textured models with MTL files
Importing models from 3D modeling software

Basic Usage¶
A minimal example that loads an OBJ file from a URL:
import os
from vuer import Vuer
from vuer.schemas import DefaultScene, Obj, OrbitControls
app = Vuer(static_root=os.getcwd() + "/../../../assets")
obj_file = "pointclouds/male02/male02.obj"
mtl_file = "pointclouds/male02/male02.mtl"
@app.spawn(start=True)
async def main(sess):
sess.set @ DefaultScene(
Obj(
key="model",
src="http://localhost:8012/static/" + obj_file,
mtl="http://localhost:8012/static/" + mtl_file,
position=[0, 0, 0],
scale=0.01,
),
bgChildren=[
OrbitControls(key="OrbitControls")
],
)
await sess.forever()
Key Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
str |
- |
Unique identifier for the model |
|
str |
- |
URL to the OBJ file |
|
bytes |
- |
Binary OBJ data (alternative to src) |
|
str |
- |
OBJ file content as string (alternative to src) |
|
str |
|
The source of the mtl file. Can be a url or a local file. |
|
list[string] |
|
A list of materials to be used for the obj file. |
Learn More¶
For detailed examples of using Obj, see:
Loading 3D Meshes - Multiple mesh loading methods