Each example is a single HTML file that imports the library as an ES
module from ../magic-pixels.js, a copy of the current build.
Run npm run build:examples once to create it, then serve this
folder with any static file server (a browser can't load an ES module over
file://) and open a demo, or read the source to see how it
uses the library.
The smallest scene: a box, a normal material, a perspective camera, a render loop.
A sun, a planet and a moon, orbiting through parent/child transforms
and empty Object3D pivots.
A hand-written GLSL vertex/fragment pair displaces and colors a sphere
from a time uniform.
Two cubes swing between the same orientations: one slerps its
quaternion, the other lerps Euler angles and wobbles.
The same box geometry stored as Float32Array and as
quantized 8/16 bit integers, side by side, rendering identically at a
third the vertex memory.
The same gradient texture with colorSpace: 'linear' and
colorSpace: 'srgb', showing why the GPU needs to know
which one a texture is.
Three transparent planes slide through each other and
always blend correctly however their draw order changes, and a
single-sided plane disappears for half of its spin.
A DirectionalLight circling like a low sun and a
PointLight orbiting with a glowing marker as its child,
read by a hand-written Lambert shader through the built-in light
uniforms.