Skip to content
EASEL.js

Create geometry and materials

Use a primitive such as BoxGeometry for a quick start, or construct a Geometry from named Attribute channels. Positions, normals, UVs, colors, and optional indices are regular typed-array data; there is no GPU buffer upload lifecycle.

const geometry = new EASEL.Geometry();
geometry.setAttribute(
"position",
new EASEL.Attribute(
[
-0.5, -0.5, 0,
0.5, -0.5, 0,
0, 0.5, 0,
],
3,
),
);

Choose a material based on the CPU shading path:

  • BasicMaterial uses a solid or textured color without lighting.
  • LambertMaterial bakes diffuse lighting on the CPU.
  • ToonMaterial uses stepped Gouraud shading and an optional gradient map.
  • Line, point, and sprite materials target their corresponding rasterizer primitives.

Material opacity is intentionally discrete. Transparent objects depend on sorted draw order, and changing depth writes can change how overlapping fragments appear.

This render needs a Canvas2D-capable browser.

Loading render…

Geometry colors rendered without a texture.