Generated banner for Webgl 3d Object
Generated logo for Webgl 3d Object

Webgl 3d Object

Meng ToCommunityCreated by Meng To

  • Skill
  • Tool integration
  • Software development
  • MIT
  • Medium risk

From the author

Create a real 3D WebGL object with geometric mesh depth, physically based material, directional and ambient lighting, perspective camera, subtle rotation, and floating motion. Use when a page needs a faceted 3D hero object or product-like visual with real lighting instead of CSS transform tricks.
— the description by Meng To

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to integrating 3D WebGL objects into web interfaces using Three.js. It focuses on creating geometric meshes with physically based rendering (PBR) materials, directional lighting, and subtle animation. The implementation includes a robust setup for handling canvas resizing, performance-conscious rendering, and proper memory management through object disposal.

What it does

  • Initializes a Three.js scene with a perspective camera and WebGL renderer.
  • Configures PBR materials using metalness, roughness, and emissive properties.
  • Sets up multi-point lighting including directional and ambient sources.
  • Implements subtle rotation and floating animations for 3D meshes.
  • Handles window resizing and cleanup of geometry, materials, and renderers.
  • Supports reduced motion preferences for accessibility.

When to use it

  • When a web page requires a 3D hero object or product visual.
  • When real geometric depth and lighting are preferred over CSS-based illusions.
  • When you need a faceted or custom mesh that responds to light sources.
  • When building feature blocks that benefit from subtle, continuous motion.

Advantages

  • Provides a clean, modular recipe for Three.js integration.
  • Includes built-in memory management to prevent leaks.
  • Ensures consistent rendering across different device pixel ratios.
  • Offers clear guidelines for material and lighting configurations.

Usage examples

“Create a metallic 3D hero object for my product page.”
The agent provides the Three.js initialization code with MeshStandardMaterial configured for a metallic look, including directional lighting and a shadow plane.
“How do I make my 3D object look like soft ceramic?”
The agent advises adjusting the material properties to low metalness (0.0-0.15) and moderate roughness (0.38-0.62) within the provided Three.js template.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/mengto/webgl-3d-object/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip webgl-3d-object.zip -d .agents/skills

Documentation by Meng To

WebGL 3D Object

Use When

  • A hero, feature block, or product moment needs one strong 3D object.

  • The visual should show real geometry, lighting, highlights, and edges.

  • A faceted mesh should float or rotate subtly inside a web layout.

  • CSS transforms, SVG illusions, or flat gradients are not enough.

Rules

  1. Use real 3D geometry: IcosahedronGeometry, DodecahedronGeometry, BoxGeometry, custom BufferGeometry, or a glTF mesh.

  2. Use a perspective camera so the object has depth and scale.

  3. Use PBR material: MeshStandardMaterial or MeshPhysicalMaterial.

  4. Tune metalness, roughness, and emissive to match the brand mood.

  5. Light the object with at least one directional light plus ambient or hemisphere fill.

  6. Animate transforms only: subtle rotation, bobbing, or parallax.

  7. Handle resize and dispose geometry/material/renderer on teardown.

HTML And CSS

<div class="webgl-object-shell">
  <canvas class="webgl-object-canvas" data-webgl-3d-object></canvas>
</div>
.webgl-object-shell {
  position: relative;
  width: min(100%, 720px);
  aspect-ratio: 1 / 1;
}

.webgl-object-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

Three.js Object Recipe

import * as THREE from "three";

function initWebGL3DObject(canvas, options = {}) {
  if (!canvas) return () => {};

  const renderer = new THREE.WebGLRenderer({
    canvas,
    antialias: true,
    alpha: true,
  });
  renderer.setClearColor(0x000000, 0);
  renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, options.maxDpr || 1.75));
  renderer.outputColorSpace = THREE.SRGBColorSpace;
  renderer.toneMapping = THREE.ACESFilmicToneMapping;
  renderer.toneMappingExposure = options.exposure || 1.05;
  renderer.shadowMap.enabled = true;
  renderer.shadowMap.type = THREE.PCFSoftShadowMap;

  const scene = new THREE.Scene();
  const camera = new THREE.PerspectiveCamera(38, 1, 0.1, 100);
  camera.position.set(0, 0.15, 5.2);

  const geometry = new THREE.IcosahedronGeometry(options.radius || 1.35, options.detail || 1);
  const material = new THREE.MeshStandardMaterial({
    color: options.color || 0x8aa4ff,
    metalness: options.metalness ?? 0.48,
    roughness: options.roughness ?? 0.34,
    emissive: options.emissive || 0x101833,
    emissiveIntensity: options.emissiveIntensity ?? 0.22,
    flatShading: true,
  });

  const object = new THREE.Mesh(geometry, material);
  object.castShadow = true;
  object.receiveShadow = true;
  scene.add(object);

  const ambient = new THREE.AmbientLight(0xffffff, 0.38);
  scene.add(ambient);

  const key = new THREE.DirectionalLight(0xffffff, 2.15);
  key.position.set(3.4, 4.2, 4.8);
  key.castShadow = true;
  key.shadow.mapSize.set(1024, 1024);
  scene.add(key);

  const rim = new THREE.DirectionalLight(options.rimColor || 0x7dd3fc, 0.82);
  rim.position.set(-4.2, 1.2, -2.8);
  scene.add(rim);

  const shadowPlane = new THREE.Mesh(
    new THREE.PlaneGeometry(5.2, 5.2),
    new THREE.ShadowMaterial({ opacity: 0.18 })
  );
  shadowPlane.position.set(0, -1.65, 0);
  shadowPlane.rotation.x = -Math.PI / 2;
  shadowPlane.receiveShadow = true;
  scene.add(shadowPlane);

  const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
  let rafId = 0;

  function resize() {
    const width = Math.max(1, canvas.clientWidth);
    const height = Math.max(1, canvas.clientHeight);
    renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, options.maxDpr || 1.75));
    renderer.setSize(width, height, false);
    camera.aspect = width / height;
    camera.updateProjectionMatrix();
  }

  function render(time = 0) {
    const t = time * 0.001;
    object.rotation.x = -0.16 + Math.sin(t * 0.45) * 0.06;
    object.rotation.y = t * 0.28;
    object.rotation.z = Math.sin(t * 0.32) * 0.08;
    object.position.y = reduceMotion ? 0 : Math.sin(t * 0.8) * 0.08;

    renderer.render(scene, camera);
    if (!reduceMotion) rafId = requestAnimationFrame(render);
  }

  function handleResize() {
    cancelAnimationFrame(rafId);
    resize();
    render();
  }

  resize();
  render();
  window.addEventListener("resize", handleResize);

  return () => {
    cancelAnimationFrame(rafId);
    window.removeEventListener("resize", handleResize);
    geometry.dispose();
    material.dispose();
    shadowPlane.geometry.dispose();
    shadowPlane.material.dispose();
    renderer.dispose();
  };
}

const cleanupObject = initWebGL3DObject(
  document.querySelector("[data-webgl-3d-object]"),
  {
    color: 0x8aa4ff,
    rimColor: 0x7dd3fc,
    metalness: 0.48,
    roughness: 0.34,
    emissive: 0x101833,
  }
);

Material Defaults

  • Premium metal: metalness: 0.45-0.7, roughness: 0.25-0.45.

  • Soft ceramic: metalness: 0.0-0.15, roughness: 0.38-0.62.

  • Glow-tinted tech object: low emissive with emissiveIntensity: 0.12-0.35.

  • Faceted object: set flatShading: true; smooth product object: set it to false.

Lighting Defaults

  • Key light: directional, high front-side angle, strongest source.

  • Ambient fill: low intensity so shadows stay visible.

  • Rim light: brand-tinted or cool light from behind to reveal edges.

  • Shadows: enable only when the object needs grounded depth; keep map size moderate.

Motion Defaults

  • Rotation: slow, continuous, and secondary to the page content.

  • Floating: 0.04 to 0.12 units on Y.

  • Reduced motion: render a still frame or only allow direct interaction.

  • Avoid camera movement unless the object is the main interaction.

Avoid

  • CSS 3D transforms pretending to be WebGL.

  • Unlit materials when the ask is real lighting and depth.

  • Flat planes with gradients instead of actual geometry.

  • Strong bloom or particles that hide the form.

  • High DPR, huge shadow maps, or too many lights on mobile.

  • Letting the object compete with foreground copy or CTAs.

Quick Checks

  • The object has visible form, edges, highlights, and shadows.

  • The material uses metalness, roughness, and optional emissive.

  • Directional and ambient lights are both present.

  • The camera is perspective, not orthographic by accident.

  • Resize does not stretch the object.

  • Geometry, material, event listeners, RAF, and renderer are cleaned up.

Files

demo/PROMPT.md

WebGL 3D Object Demo Prompts

Minimal prompt

Use $webgl-3d-object to create a responsive standalone HTML design with the same visual confidence, hierarchy, and interaction finish as the included Neuform reference.

Recreate the demo

Use $webgl-3d-object to recreate the design quality and behavior of PulsoApps | Tu app lista en 5 días. as a complete responsive HTML document. Treat the included demo/index.html as the visual and interaction reference, not as a loose mood board.

Product brief
  • Page concept: PulsoApps | Tu app lista en 5 días..

  • Purpose: Pulsoapps App Pricing Section is designed for comparing plans and supporting conversion decisions. Key features include plan comparison blocks and conversion-oriented actions. It is suitable for subscription pricing pages and plan comparison experiences.

  • Content anchors: TU APP LISTA EN 5 DÍAS. SIN EXCUSAS. · Lo que hacemos. · Aplicaciones de Negocios · Sitio Web que Vende · Rediseño Express.

  • Useful subject tags: faq, section, animated, cta, bento, billing, support.

Skill direction
  • Create a 3D WebGL object with real lighting and depth. Use a geometric mesh (faceted shape) with physically-based material (metalness, roughness, emissive). Light it with directional and ambient lights to reveal form and edges. Technique: real 3D geometry (not CSS transforms), dynamic lighting for highlights and shadows, subtle rotation and floating motion, and a perspective camera for depth.

    • WebGL 3D Object: Create a 3D WebGL object with real lighting and depth. Use a geometric mesh (faceted shape) with physically-based material (metalness, roughness, emissive). Light it with directional and ambient lights to reveal form and edges. Technique: real 3D geometry (not CSS transforms), dynamic lighting for highlights and shadows, subtle rotation and floating motion, and a perspective camera for depth.

Fidelity target
  • Match the reference's composition, information density, type scale, spacing rhythm, surface treatment, color relationships, and motion restraint.

  • Preserve the strongest interaction and animated background behavior instead of replacing it with generic fades or decorative movement.

  • Keep the first screen art-directed, then carry the same design logic through every supporting section.

  • Make the result responsive from mobile to desktop, keyboard accessible, and stable when reduced motion is enabled.

  • Deliver a full index.html. Put page-owned images, video, models, and textures in demo/assets/. External runtime libraries may stay as pinned CDN dependencies when the source relies on them.

Reference snapshot

Remix prompt

Use $webgl-3d-object and the included Neuform demo as the quality bar, but replace the brand, subject, copy, palette, and content. Preserve the underlying layout logic, signature visual treatment, interaction choreography, responsive behavior, and performance constraints so the remix still clearly demonstrates the skill.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Meng To
Publisher
Meng To (Community)
Source
MengTo/Skills · agent-skills/web-design/webgl-3d-object · commit 5ea1661
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Meng To or Meng To.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download webgl-3d-object.zip