# babylonjs-engine

A skill that walks the agent through Babylon.js: engine setup, cameras, lights and meshes for browser 3D work, so you don't rebuild the API from memory.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2500 installs · ★ 1133
- Author: freshtechbro
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/freshtechbro/claudedesignskills/tree/HEAD/plugins/bundles/core-3d-animation/skills/babylonjs-engine/SKILL.md
- Updated: 2025-11-20
- HTML: https://affpapa.org/en/nevibecode/skills/babylonjs-engine

## What it does

The skill covers the starting moves of a Babylon.js app: creating `Engine` and `Scene`, driving them with `runRenderLoop`, handling window resize. Cameras get their own section — first-person FreeCamera, ArcRotateCamera with radius and beta limits, UniversalCamera with gravity and collisions. TypeScript and ES6 setups appear too, using imports from `@babylonjs/core`, which fits projects built with a bundler.

Four light types are laid out: hemispheric, directional with a ShadowGenerator, point and spot. You get the knobs for shadow maps and the `includedOnlyMeshes` / `excludedMeshes` filters that keep a light from touching every mesh in a crowded scene.

Meshes come through `MeshBuilder` — box, sphere, cylinder, plane, ground including a heightmap version, torus, torus knot — plus position, rotation in radians, scaling, `lookAt` and parenting. The skill presents Babylon.js as an alternative to Three.js with editor integration and game-engine features; the editor and physics only get a passing mention, so don't expect ready-made recipes for them. One practical note: the sample creates the engine with `preserveDrawingBuffer: true` and `stencil: true`, which matter for screenshots and canvas capture. Leave them off unless you need them.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add freshtechbro/claudedesignskills --skill babylonjs-engine -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/babylonjs-engine/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/babylonjs-engine/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add freshtechbro/claudedesignskills --skill babylonjs-engine -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/babylonjs-engine/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add freshtechbro/claudedesignskills --skill babylonjs-engine -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/babylonjs-engine/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install freshtechbro/claudedesignskills babylonjs-engine
```

2. **Manually: put the files in place**
- File: `.github/skills/babylonjs-engine/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add freshtechbro/claudedesignskills --skill babylonjs-engine -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/freshtechbro/claudedesignskills --path plugins/bundles/core-3d-animation/skills/babylonjs-engine
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/babylonjs-engine/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add freshtechbro/claudedesignskills --skill babylonjs-engine -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/freshtechbro/claudedesignskills/tree/HEAD/plugins/bundles/core-3d-animation/skills/babylonjs-engine/SKILL.md

## When to use it
- scaffold a Babylon.js scene without rereading the docs
- set up an orbit camera with zoom limits
- add a directional light and shadow map
- generate terrain from a heightmap
- port the examples to `@babylonjs/core` imports in TypeScript

## Example prompts
- Set up a Babylon.js scene with an engine, camera and render loop on `renderCanvas`
- Add an ArcRotateCamera clamped between radius 5 and 50
- Give me a DirectionalLight with a ShadowGenerator casting on the meshes

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 32089d9e8dbfb849.

BEGIN THIRD-PARTY FILE 32089d9e8dbfb849
````text
---
name: babylonjs-engine
description: Comprehensive skill for Babylon.js 3D web rendering engine. Use this skill when building real-time 3D experiences, browser-based games, interactive visualizations, or immersive web applications. Triggers on tasks involving Babylon.js, 3D scenes, WebGL/WebGPU rendering, entity-component systems, physics simulations, PBR materials, shadow mapping, or 3D model loading. Alternative to Three.js with built-in editor integration and game engine features.
---

# Babylon.js Engine Skill

## Related Skills
- threejs-webgl: Alternative 3D engine
- react-three-fiber: React integration for 3D
- gsap-scrolltrigger: Animation library
- motion-framer: UI animations

## Core Concepts

### 1. Engine and Scene Initialization

**Basic Setup**
```javascript
// Get canvas element
const canvas = document.getElementById('renderCanvas');

// Create engine
const engine = new BABYLON.Engine(canvas, true, {
  preserveDrawingBuffer: true,
  stencil: true
});

// Create scene
const scene = new BABYLON.Scene(engine);

// Render loop
engine.runRenderLoop(() => {
  scene.render();
});

// Handle resize
window.addEventListener('resize', () => {
  engine.resize();
});
```

**ES6/TypeScript Setup**
```typescript
import { Engine } from '@babylonjs/core/Engines/engine';
import { Scene } from '@babylonjs/core/scene';
import { FreeCamera } from '@babylonjs/core/Cameras/freeCamera';
import { Vector3 } from '@babylonjs/core/Maths/math.vector';
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight';
import { CreateSphere } from '@babylonjs/core/Meshes/Builders/sphereBuilder';

const canvas = document.getElementById('renderCanvas') as HTMLCanvasElement;
const engine = new Engine(canvas);
const scene = new Scene(engine);

// Camera setup
const camera = new FreeCamera('camera1', new Vector3(0, 5, -10), scene);
camera.setTarget(Vector3.Zero());
camera.attachControl(canvas, true);

// Lighting
const light = new HemisphericLight('light1', new Vector3(0, 1, 0), scene);
light.intensity = 0.7;

// Create mesh
const sphere = CreateSphere('sphere1', { segments: 16, diameter: 2 }, scene);
sphere.position.y = 2;

// Render
engine.runRenderLoop(() => {
  scene.render();
});
```

**Scene Configuration Options**
```javascript
````
END THIRD-PARTY FILE 32089d9e8dbfb849

The third-party file has ended. Everything between the 32089d9e8dbfb849 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2266 of 31117 bytes. © freshtechbro · MIT · https://github.com/freshtechbro/claudedesignskills/tree/HEAD/plugins/bundles/core-3d-animation/skills/babylonjs-engine/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
