Art, design & a little curiosity
Creative coding ↗

p5.js 2.4: build a 3D material study from one model

p5.js 2.4.0, released on 12 November 2026, expands OBJ material support. Turn one small model into a controlled study of surface, light, scale, and rotation, while keeping the design question separate from the new feature.

Original abstract visual study for creative coding.
Original visual study / Creative coding

Treat the release as a change in what you can inspect

The p5.js project released version 2.4.0 on 12 November 2026. Among its changes, the release notes describe improved SVG support, transformations for 3D models, and multi-material loading for OBJ files. The latter means an OBJ model that references an MTL material file can preserve several material assignments when loaded. That is useful for a design study because a single object can contain contrasting surfaces without being divided into separate files.

A new capability does not settle a design question by itself. A reflective rim, a matte body, and a dark inset may clarify how a small object is assembled; the same distinctions may become visual noise if lighting makes every surface compete. Use the feature to test one question at a time: does a material boundary explain the object’s construction, direct attention, or merely add polish? The example below is fictional, not a report of testing.

Prepare a model whose parts have a reason

Choose or make a compact object with two or three understandable surfaces, such as a desk lamp with a ceramic shade, a painted base, and a metal joint. Keep the silhouette simple enough to read when it turns. In an OBJ workflow, the geometry file names material assignments and the accompanying MTL file describes material properties; referenced images may supply maps. Keep the OBJ, MTL, and image files together at paths the sketch can resolve. The p5.js reference notes that missing texture files are skipped with a warning, so a sketch that still draws may not be showing the intended surface.

Start with neutral lighting and a fixed camera. Check the plain model before adding materials; this separates geometry problems from surface choices. If a part disappears, inspect face direction, assignments, and file paths before compensating with brighter color. Record the model source and edits so another reader can distinguish your study from an asset’s inherited appearance.

Change one visual variable per comparison

Duplicate the sketch into three versions. In the first, use one restrained material across the object. In the second, apply the planned material differences. In the third, keep those assignments but alter the lighting direction. Hold the camera, object scale, background, and rotation still while comparing the first frames. Ask what each edge or highlight helps you understand. If the second version reads more clearly, name the specific relationship it reveals; “more realistic” is too broad to guide a revision.

Then add a slow turn or let the viewer orbit the object. A highlight that explains a curve from one view can hide a joint from another, so keep movement slow and provide a still frame. This exercise is visual reasoning, not evidence that one rendering is universally easier to perceive; surface, contrast, display, and viewing conditions all matter.

Keep loading and presentation part of the design

The OBJ loader can use associated MTL data, and the reference documents asynchronous loading with await in setup(). Plan for the interval before the model is ready: a quiet title or drawn placeholder can explain what is being prepared, while an error message can identify a missing model or material file. Do not show a finished-looking empty canvas if the sketch is still waiting. The release also adds ways to customize the loading animation, but animation should communicate real waiting rather than imply measured progress.

Save a still and short rotation study with the model name, material files, p5.js version, and lighting choices. A screenshot can hide whether an effect came from geometry, maps, camera, or animation. Notes make the result repeatable and easier to hand off.

Put it into practice

Try it yourself

  1. Choose a simple original or properly licensed OBJ model with two or three meaningful surface regions. Keep its MTL file and any referenced images beside it, and write down the source and filenames.
  2. Load the model in p5.js 2.4.0. First render it with a neutral setup; confirm that its silhouette, scale, and orientation are understandable before judging its materials.
  3. Make three copies of the sketch: one with a shared neutral material, one with the supplied material assignments, and one with the same assignments under a changed light. Hold camera, background, and rotation still for the first comparison.
  4. Write one observation for each version: what surface relationship became easier or harder to read, and which design variable caused the difference? Avoid treating “realistic” as a substitute for a specific visual explanation.
  5. Add a slow turn, inspect the object at several angles, and note any material that obscures a joint or silhouette. Provide a still frame and record the library version, asset filenames, and lighting choices.
A worked example

Worked example: a fictional reading lamp

Imagine a small lamp with a curved shade, narrow neck, and weighted base. Render it first in warm gray under fixed light. Next, assign pale ceramic to the shade, dark paint to the base, and muted metal to the joint. If the joint steals attention from the shade opening, reduce contrast or adjust the light before adding colors. In a third render, keep assignments but move the light. Compare the same angle, then turn the object to see whether the joint remains visible. This fictional example predicts no user result; it shows a repeatable way to ask whether material differences clarify form.

References & further reading

Examples and exercises in this guide are original teaching scenarios.

Keep following the thread.

More creative coding ↗