Skip to content
Back to skills

105 Core Bd572f13

ASecurity

Core concepts for building your first 3D scene.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
developmentjavascriptjava

Works with

  • cli

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 105-core_bd572f13 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 105 Core Bd572f13?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 105 Core Bd572f13
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-105-core-bd572f13/badge)](https://www.skillsdirectory.com/skills/tools-only-105-core-bd572f13)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# Getting Started with Three.js

Core concepts for building your first 3D scene.

## Essential Components

Every Three.js app needs 3 core elements:

### 1. Scene
Container for all 3D objects, lights, cameras.

```javascript
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x000000); // black background
scene.fog = new THREE.Fog(0xffffff, 1, 5000); // distance fog
```

### 2. Camera
Viewpoint into the 3D scene.

**PerspectiveCamera** (realistic, most common):
```javascript
const camera = new THREE.PerspectiveCamera(
  75,  // fov - field of view in degrees
  window.innerWidth / window.innerHeight,  // aspect ratio
  0.1,  // near clipping plane
  1000  // far clipping plane
);
camera.position.set(0, 0, 5);
camera.lookAt(0, 0, 0);
```

**OrthographicCamera** (no perspective distortion):
```javascript
const camera = new THREE.OrthographicCamera(
  left, right, top, bottom, near, far
);
```

### 3. Renderer
Renders scene using camera perspective.

```javascript
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(window.devicePixelRatio);
document.body.appendChild(renderer.domElement);
```

## Basic Geometries

Primitive shapes ready to use:

```javascript
// Box
new THREE.BoxGeometry(width, height, depth);

// Sphere
new THREE.SphereGeometry(radius, widthSegments, heightSegments);

// Plane
new THREE.PlaneGeometry(width, height);

// Cylinder
new THREE.CylinderGeometry(radiusTop, radiusBottom, height, radialSegments);

// Cone
new THREE.ConeGeometry(radius, height, radialSegments);

// Torus
new THREE.TorusGeometry(radius, tube, radialSegments, tubularSegments);
```

## Basic Materials

Materials define surface appearance:

**MeshBasicMaterial** - unlit, flat color:
```javascript
new THREE.MeshBasicMaterial({ color: 0xff0000 });
```

**MeshStandardMaterial** - PBR, responds to lights:
```javascript
new THREE.MeshStandardMaterial({
  color: 0x00ff00,
  metalness: 0.5,
  roughness: 0.5
});
```

**MeshPhongMaterial** - specular highlights:
```javascript
new THREE.MeshPhongMaterial({
  color: 0x0000ff,
  shininess: 100
});
```

## Creating Mesh

Combine geometry + material:

```javascript
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshStandardMaterial({ color: 0x00ff00 });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
```

## Basic Lights

Materials (except Basic) need lights to be visible:

```javascript
// Ambient - global illumination
const ambient = new THREE.AmbientLight(0x404040); // soft white
scene.add(ambient);

// Directional - sun-like, infinite distance
const directional = new THREE.DirectionalLight(0xffffff, 1);
directional.position.set(5, 5, 5);
scene.add(directional);

// Point - lightbulb, radiates in all directions
const point = new THREE.PointLight(0xff0000, 1, 100);
point.position.set(0, 10, 0);
scene.add(point);
```

## Animation Loop

Continuously render and update scene:

```javascript
function animate() {
  requestAnimationFrame(animate);

  // Update objects
  cube.rotation.x += 0.01;
  cube.rotation.y += 0.01;

  // Render
  renderer.render(scene, camera);
}
animate();
```

## Handle Window Resize

Keep aspect ratio correct:

```javascript
window.addEventListener('resize', () => {
  camera.aspect = window.innerWidth / window.innerHeight;
  camera.updateProjectionMatrix();
  renderer.setSize(window.innerWidth, window.innerHeight);
});
```

## Object3D Hierarchy

Transform and group objects:

```javascript
const group = new THREE.Group();
group.add(cube1);
group.add(cube2);
scene.add(group);

// Transform
object.position.set(x, y, z);
object.rotation.set(x, y, z); // Euler angles
object.scale.set(x, y, z);

// Hierarchy transforms are relative to parent
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.