Build a sharpened hexagonal pencil in three.js (0.160, ES modules, no model files): an Apsara-style pencil: alternating silver and black faces, and a black dipped end. - Export makePencil(), which returns a group with the graphite tip at the origin and the body along +Y, about 5.5 units long. - Barrel: a 6-sided cylinder with flat shading and a canvas texture that paints one colour per face. Sharpened end: a 6-sided wood cone and a small graphite cone. - Show it lying on a diagonal on an off-white page with a soft shadow, turning slowly on its own length. Drag to turn it in your hand; let go and it springs back. - Render with one soft directional light and a RoomEnvironment for reflections, and respect prefers-reduced-motion. Finally, add a small credit at the bottom of the page: "3D pencil by Naveen Meena", linking to https://arteffects.inaveenmeena.com/pencil/
// Pencil (Arteffects No. 002) by Naveen Meena — https://arteffects.inaveenmeena.com/
// © 2026 Naveen Meena. Free for personal, non-commercial use (commercial use: ask first, inaveenmeena@outlook.com). If you share it, credit "3D pencil by Naveen Meena" linked to https://arteffects.inaveenmeena.com/pencil/ (or "Inspired by Naveen Meena" if it only inspired you).
// A sharpened pencil, drawn in code. cassette3d.js uses the Apsara; Arteffects shows all of them.
// makePencil(style) returns a group with the graphite tip at the origin and the body along +Y,
// about 5.5 units long before scaling.
import * as THREE from "three";
export const PENCILS = {
// hexagonal, alternating silver and black faces, black dipped end
apsara: { label: "Apsara", faces: ["#d9dade", "#111114"], cap: 0x0d0d10 },
// hexagonal, red faces each with a black stripe down the middle, white ring under a black cap
natraj: { label: "Natraj", face: "#c3161c", stripe: "#121214", ring: 0xf2f0ea, cap: 0x0d0d10 },
};
const std = (color, roughness = 0.55, metalness = 0) => new THREE.MeshStandardMaterial({ color, roughness, metalness });
function add(parent, geo, mat, y) {
const m = new THREE.Mesh(geo, mat);
m.position.y = y;
m.castShadow = true;
parent.add(m);
return m;
}
// one colour per face of the hexagon, wrapped around the barrel
function faceTexture(paint) {
const t = document.createElement("canvas");
t.width = 600; t.height = 8;
const g = t.getContext("2d");
for (let i = 0; i < 6; i++) paint(g, i * 100);
const tex = new THREE.CanvasTexture(t);
tex.colorSpace = THREE.SRGBColorSpace;
return tex;
}
export function makePencil(style = "apsara") {
const s = PENCILS[style] ?? PENCILS.apsara;
const lead = new THREE.Group();
const wood = std(0xe6c490, 0.7), graphite = std(0x2b2b30, 0.5);
add(lead, new THREE.ConeGeometry(0.17, 0.5, 6).rotateX(Math.PI), wood, 0.25);
add(lead, new THREE.ConeGeometry(0.06, 0.18, 12).rotateX(Math.PI), graphite, 0.09);
const tex = s.faces
? faceTexture((g, x) => { g.fillStyle = s.faces[(x / 100) % 2]; g.fillRect(x, 0, 100, 8); })
: faceTexture((g, x) => { g.fillStyle = s.face; g.fillRect(x, 0, 100, 8); g.fillStyle = s.stripe; g.fillRect(x + 36, 0, 28, 8); });
const barrel = new THREE.MeshStandardMaterial({ map: tex, roughness: 0.6, metalness: 0.1, flatShading: true });
const end = std(0x111114, 0.4);
add(lead, new THREE.CylinderGeometry(0.17, 0.17, 4.9, 6), [barrel, end, end], 2.95);
if (s.ring) add(lead, new THREE.CylinderGeometry(0.173, 0.173, 0.05, 6), std(s.ring, 0.4), 5.265);
add(lead, new THREE.CylinderGeometry(0.172, 0.172, 0.22, 6), std(s.cap, 0.3), 5.4);
return lead;
}
How I made it
The pencil that winds the cassette on my homepage, drawn in code: a hexagonal barrel, a wood cone and a graphite tip. The styles follow two Indian school pencils.
Pencil No. 002
Code
New pieces, now and then
One email when something new lands in Arteffects. No spam, unsubscribe any time.