Textures & Materials

How to upload a texture and apply it to a standard material. This example uses a PNG image.

Transport

In the browser, use a canvas with id vulfram-canvas.

Key steps

1. Load the image into bytes.

2. Send it with uploadBuffer using image-data.

3. Create the texture with source: { type: 'buffer', bufferId }.

4. Attach the texture to the standard material (baseTexId).

Browser tip

Place stone.png in static/textures to access it at /textures/stone.png.

The live demo on this page uses an embedded texture so it works out of the box.

Full example

ts
Live demo canvas