Nova64 delivers spectacular Nintendo 64/PlayStation-style 3D graphics with modern performance, featuring advanced materials, cinematic lighting, and 100% test coverage (35/35 tests passing).
createCone, createCapsule, createTorus — expands the primitive library to 7 shapessetPBRProperties(meshId, {metalness, roughness, envMapIntensity}) — tune materials at runtimecreateImageSkybox([6 urls]) — cube-map backgrounds with image-based lightingcreateGradientSkybox(top, bottom), createSolidSkybox(color)setSkyboxSpeed(), enableSkyboxAutoAnimate(), disableSkyboxAutoAnimate()removeMesh Alias: removeMesh() is now identical to destroyMesh() — both workcreateCylinder() now correctly produces a cylinder, not a boxNova64's intelligent renderer system ensures maximum compatibility:
🔧 Renderer Control: Use control panel dropdown or localStorage.setItem('nova64-render-mode', 'threejs')
createCube(size, color, position, options?) / createCube(width, height, depth, color, position, options?) ⭐Creates a cube or rectangular box mesh.
size (number): Cube side length (default: 1)width, height, depth (number): Box dimensions when using the rectangular signaturecolor (hex): Colour, e.g. 0xff4488position (array): [x, y, z] world position (default: [0, 0, 0])options (object): Material options — see Material Options table// Basic cube
const box = createCube(2, 0xff4488, [0, 1, 0]);
// Rectangular box
const wall = createCube(8, 3, 0.5, 0x666688, [0, 1.5, -4]);
// Holographic cube
const holoCube = createCube(1.5, 0x00ff88, [3, 1, -3], {
material: 'holographic',
emissive: 0x004400,
metalness: 0.8,
roughness: 0.2,
});
createSphere(radius, color, position, options?) ⭐Creates a sphere mesh.
radius (number): Sphere radius (default: 1)color (hex): Colourposition (array): [x, y, z]options (object): Material options; also accepts segments (default: 8)// Metallic planet
const planet = createSphere(2, 0x4488ff, [0, 2, -8], {
material: 'metallic',
metalness: 0.9,
roughness: 0.1,
});
// Low-poly N64 orb
const orb = createSphere(0.8, 0xffff00, [-4, 1, -5], {
material: 'emissive',
segments: 8,
});
createPlane(width, height, color, position, options?) ⭐Creates a flat plane — ground, walls, ceilings.
width, height (numbers): Plane dimensionscolor (hex): Colourposition (array): [x, y, z]options (object): Material options// Ground plane
const ground = createPlane(100, 100, 0x228b22, [0, 0, 0]);
// Holographic wall
const wall = createPlane(8, 6, 0x00ffff, [5, 3, -10], {
material: 'holographic',
transparent: true,
opacity: 0.7,
});
loadModel(url, position, scale) (async)Loads GLTF/GLB 3D models with automatic N64-style material conversion.
url (string): Path to .gltf or .glb fileposition (array): [x, y, z] position (default: [0, 0, 0])scale (number): Uniform scale factor (default: 1)const spaceship = await loadModel('/assets/ship.glb', [0, 0, 0], 0.5);
setPosition(meshId, x, y, z)Sets absolute position of a 3D object.
setPosition(cube, 5, 2, -3);
setRotation(meshId, x, y, z)Sets absolute rotation in radians.
setRotation(cube, 0, Math.PI / 4, 0); // 45° Y rotation
setScale(meshId, x, y, z) or setScale(meshId, uniform)Sets object scale. Use single number for uniform scaling.
setScale(cube, 2); // Double size uniformly
setScale(cube, 1, 2, 1); // Stretch vertically only
rotateMesh(meshId, x, y, z)Rotates by the specified amounts (additive).
// Spin cube each frame
rotateMesh(cube, 0, dt, 0);
moveMesh(meshId, x, y, z)Moves by the specified offset (additive).
moveMesh(cube, 0, Math.sin(time) * dt, 0); // Bob up and down
destroyMesh(meshId)Removes object from scene and frees memory.
destroyMesh(cube);
setCameraPosition(x, y, z)Sets camera position in world space.
setCameraPosition(0, 5, 10); // Behind and above origin
setCameraTarget(x, y, z)Sets what the camera looks at.
setCameraTarget(0, 0, 0); // Look at origin
setCameraFOV(degrees)Sets field of view angle.
setCameraFOV(75); // Wide angle view
setFog(color, near, far)Adds atmospheric fog for depth perception.
color (hex): Fog color as 0xRRGGBBnear (number): Distance where fog startsfar (number): Distance where fog is fully opaquesetFog(0x003366, 10, 50); // Blue distance fog
setLightDirection(x, y, z)Sets the main directional light direction.
setLightDirection(1, 1, 0.5); // Light from upper-right
enablePixelation(factor)Applies N64-style pixelation effect.
factor (number): Pixelation intensity (1 = none, 2+ = pixelated)enablePixelation(2); // Double-pixel rendering
enableDithering(enabled)Toggles color dithering for authentic retro look.
enableDithering(true);
raycastFromCamera(x, y)Cast a ray from camera through screen coordinates for object picking.
{ meshId, point, distance } or nullconst hit = raycastFromCamera(mouseX, mouseY);
if (hit) {
console.log(`Clicked object ${hit.meshId} at distance ${hit.distance}`);
}
get3DStats()Returns rendering performance statistics.
const stats = get3DStats();
console.log(`Triangles: ${stats.render.triangles}, Calls: ${stats.render.calls}`);
For advanced users who need full Three.js control:
const scene = getScene();
const camera = getCamera();
const renderer = getRenderer();
const mesh = getMesh(meshId);
segments parameter on spheres (6-12 recommended)let objects = [];
let time = 0;
export async function init() {
// Setup scene
setCameraPosition(0, 5, 10);
setFog(0x001122, 10, 30);
enablePixelation(1.5);
// Create objects
objects.push(createCube(1, 0xff0000, [0, 0, 0]));
// Load models if needed
const model = await loadModel('/assets/ship.glb');
objects.push(model);
}
export function update(dt) {
time += dt;
// Animate objects
objects.forEach((obj, i) => {
rotateMesh(obj, 0, dt, 0);
});
// Move camera
const camX = Math.cos(time * 0.5) * 10;
const camZ = Math.sin(time * 0.5) * 10;
setCameraPosition(camX, 5, camZ);
setCameraTarget(0, 0, 0);
}
export function draw() {
cls(); // Clear 2D overlay
// 3D renders automatically
// Add 2D HUD elements
print('3D Scene Active', 8, 8, rgba8(255, 255, 255, 255));
print(`Objects: ${objects.length}`, 8, 24, rgba8(200, 200, 200, 255));
}
Existing 2D carts continue to work unchanged. To add 3D elements:
init()update()draw() for 2D overlay elementsupdate() and draw()The 2D framebuffer becomes a transparent overlay rendered on top of the 3D scene, perfect for HUD elements, text, and UI.