threejs-landscape
Ce qu’il fait
Ce skill crée un décor extérieur 3D calme qui fait paraître un sujet dans un lieu réel. Il s'adresse aux développeurs qui réalisent des scènes web 3D, des scènes produit ou des jeux qui ont besoin d'un cadre naturel.
Quand l’utiliser
- ✓Quand vous avez besoin d'un décor extérieur 3D derrière un produit ou un personnage dans une scène Three.js.
- ✓Quand vous voulez un terrain détaillé près de la caméra et plus simple au loin.
- ✓Quand vous voulez un changement d'heure de la journée qui s'estompe doucement au lieu de couper.
Lien du skill
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/threejs-landscape/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Peux-tu construire un paysage Three.js derrière mon produit 3D, avec de l'herbe, un ciel et un coucher de soleil qui s'estompe doucement ?”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'agent crée un maillage de terrain sur une grille polaire autour de la caméra, pour que le détail soit dense près du spectateur et clairsemé à l'horizon. Il ajoute de l'herbe en instances qui ondule sur la carte graphique, des pierres dispersées, un dôme de ciel et un système d'heure de la journée.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Three.js Landscape
A backdrop has one job: make the subject look like it is somewhere. Everything here is chosen so the landscape reads at a glance and then gets out of the way.
Reach for threejs-weather to put rain, storm or snow on top of it, and threejs-towers when the subject standing in it is architecture.
Ring the camera with a polar grid
Do not build a square heightfield. A long lens sees a narrow wedge, so a square grid spends most of its triangles behind the camera and still runs out of resolution at the horizon.
Sample on a polar grid centred under the camera, with radial rings that get further apart as they recede:
const AN = 900, RN = 52, R0 = 2.0, R1 = 700; // angular, radial, near, far
for (let r = 0; r <= RN; r++) {
const t = r / RN;
const rad = R0 + (R1 - R0) * Math.pow(t, 2.4); // dense near, sparse far
for (let a = 0; a < AN; a++) {
const th = a / AN * Math.PI * 2;
push(Math.cos(th) * rad, landH(x, z), Math.sin(th) * rad);
}
}
Two thousand triangles near the subject beat two hundred thousand spread evenly. pow(t, 2.4) is the whole trick: every ring covers roughly the same number of screen pixels.
Watch the winding. On a polar grid it is easy to wind every quad the wrong way and end up looking at the sky through the ground. Index as (a0, b1, b0, a0, a1, b1) and check by orbiting under the horizon once, deliberately, before you build anything else on top.
Warp the domain before you layer octaves
Plain fBm reads as crumpled paper. Warping the sample position with another noise field before you evaluate it is the single biggest step toward terrain that looks eroded:
function landH(x, z) {
const wx = x + fbm(x * 0.012, z * 0.012, 3) * 26; // domain warp
const wz = z + fbm(x * 0.012 + 41, z * 0.012 - 17, 3) * 26;
let h = fbm(wx * 0.0075, wz * 0.0075, 5) * 34; // broad landforms
h += ridged(wx * 0.021, wz * 0.021, 3) * 9; // ridge lines
return h;
}
Keep the analytic function separate from the mesh. Grass, stones, fog and anything else you scatter must sample the same landH, or they will float and sink.
Ridge layers have to scale with distance. A ridge amplitude that reads well at 40 units is invisible at 600, so the far rings need theirs multiplied up or the horizon goes flat.
Colour by what the ground is doing, not by a texture
A tiled ground texture always announces itself. Compute a vertex colour from the terrain's own properties instead:
const slope = 1 - normal.y; // steep = rock
const moist = smoothstep(-4, 6, -height); // low = wet, green
const c = rock.clone()
.lerp(grass, (1 - slope * 3.2) * (0.35 + moist * 0.65))
.lerp(sand, Math.max(0, 0.5 - moist) * 0.6);
You get cliffs that go stony, hollows that go green and ridges that go pale, for free, with no UVs and no seams. Keep a very low-frequency noise on top so the colour does not band.
Grass: one ribbon, shaped entirely in the vertex shader
100k blades is a single InstancedMesh of a five-segment ribbon. Every bend, lean, taper and gust happens in the vertex shader, so the wind costs nothing on the CPU:
const geo = new THREE.BufferGeometry(); // 11 verts: a strip + a tip
const mesh = new THREE.InstancedMesh(geo, mat, 104000);
mat.onBeforeCompile = sh => {
Object.assign(sh.uniforms, grassUni);
sh.vertexShader = `
uniform float uTime, uWindAmp; uniform vec2 uWind;
attribute vec4 aParams; // height, phase, tint, lean
varying float vT; varying float vTint;
` + sh.vertexShader.replace('#include <begin_vertex>', `
float gT = position.y; // 0 at root, 1 at tip
float gBend = uRestBend + sin(uTime * 1.7 + aParams.y) * uWindAmp;
vec2 gRib = ... ; // sweep the blade along an arc
vec3 transformed = vec3(gRib.x, gT * aParams.x, gRib.y);
`);
};
mat.customProgramCacheKey = () => 'grass'; // or every instance recompiles
Anchor the field to the camera. Keep a fixed grid of blades around the viewer and move the grid, snapping to cell size, rather than growing the field outward. The player never reaches the edge and you never pay for grass behind them.
Do not hard-code the blade colour in the fragment shader and then expect the material colour to change it. diffuseColor.rgb *= mix(base, tip, t) multiplies whatever the material gave you, so a white material times a green cons
Questions fréquentes
Pourquoi une grille polaire ?
Une grille carrée gaspille du détail derrière la caméra, alors qu'une grille polaire met la résolution là où le spectateur regarde.
L'herbe ralentit-elle la page ?
Le skill indique que le vent est calculé sur la carte graphique, donc il coûte peu au processeur principal.
Les effets météo sont-ils inclus ?
Ils font l'objet d'un skill séparé, vers lequel le skill paysage renvoie pour la pluie, la neige et les tempêtes.
Détails
Description originale de l’auteur
Build a live Three.js landscape that stays quiet behind a subject — a noise heightfield on a polar grid so resolution follows the lens, ground coloured by slope and moisture rather than by texture, instanced GPU grass whose wind costs nothing on the CPU, scattered stones, a gradient sky dome, a star field you can actually see, and a time-of-day system that cross-fades instead of cutting. Use for hero backdrops, product stages, scroll worlds, or any scene where a building, object, or figure has to sit in a place rather than float on a gradient.
repo: MengTo/Skills
Popularité
- Étoiles GitHub
- 7.2k
- Position au classement
- #13475
- Licence
- MIT
- Mis à jour
- 01/11/2026
Commentaires
- …
Autres skills de ce dépôt
3d-cloth-material
7.2kAide votre agent à créer un tissu tissé réaliste dans Three.js, avec le tissage des fils, un léger brillant, des plis naturels, des ourlets et des coutures.
3d-falling-leaves
7.2kAide votre agent à ajouter des feuilles qui tombent de façon réaliste dans une scène 3D, qui tournoient, dérivent avec le vent et se recyclent quand la caméra bouge.
3d-four-seasons
7.2kAide votre agent à ajouter les looks printemps, été, automne et hiver à une scène 3D, en changeant le feuillage, la lumière, le ciel et la neige sans la reconstruire.
3d-high-poly-models
7.2kAide votre agent à construire des modèles 3D détaillés aux formes lisses, puis à préparer des versions légères qui tournent bien sur le web.
Skills similaires
angular-developer
280kAide votre agent à créer du code Angular et à conseiller sur la structure des projets. Utile pour démarrer, créer des composants ou améliorer performances et accessibilité.
frontend-a11y
280kAide votre agent à rendre les interfaces web accessibles à tous. Il garantit que sites et apps fonctionnent avec les lecteurs d'écran et la navigation au clavier.
frontend-patterns
280kPermet à votre agent d'appliquer les modèles modernes du frontend : optimisation des performances, gestion d'état et bonnes pratiques avec React et Next.js.