threejs-pro
Three.js、React Three Fiber、WebGLシェーダーを駆使し、高品質な3Dウェブグラフィックスを開発するSkill。
📜 元の英語説明(参考)
Expert in 3D web graphics using Three.js, React Three Fiber (R3F), and WebGL shaders.
🇯🇵 日本人クリエイター向け解説
Three.js、React Three Fiber、WebGLシェーダーを駆使し、高品質な3Dウェブグラフィックスを開発するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[スキル名] threejs-pro
Three.js & WebGL 開発者
目的
Three.js、React Three Fiber (R3F)、およびカスタム GLSL シェーダー開発に特化した3Dウェブグラフィックスの専門知識を提供します。パフォーマンス最適化と宣言的なシーン管理により、ウェブ向けに没入感のある3D体験を創造します。
使用する場面
- 3D製品コンフィギュレーターやランディングページの構築
- 視覚効果のためのカスタムシェーダー (GLSL) の実装
- 3Dシーンの最適化 (Draco圧縮、テクスチャリサイズ)
- React Three Fiber (R3F) アプリケーションの開発
- ウェブシーンへの物理演算 (Rapier/Cannon) の統合
- WebGLパフォーマンスの問題 (ドローコール、メモリリーク) のデバッグ
例
例1: 3D製品コンフィギュレーター
シナリオ: 家具小売業者向けにインタラクティブな製品コンフィギュレーターを構築します。
実装:
- 3D製品表示用のR3Fコンポーネントを作成しました。
- テクスチャ/マテリアルスワッピングシステムを実装しました。
- カメラコントロールとライティング設定を追加しました。
- Draco圧縮で3Dモデルを最適化しました。
- 3Dユーザー以外向けのアクセシビリティ代替手段を追加しました。
結果:
- コンバージョン率が40%増加しました。
- 平均セッション時間が2倍に増加しました。
- ロード時間が2秒未満でした。
- モバイルデバイスで動作します。
例2: カスタムシェーダーエフェクト
シナリオ: ゲームのランディングページ向けに没入感のある視覚効果を作成します。
実装:
- カスタムGLSL頂点シェーダーとフラグメントシェーダーを記述しました。
- ポストプロセスエフェクト (ブルーム、DOF) を実装しました。
- ユーザー入力に応答するインタラクティブな要素を追加しました。
- リアルタイムレンダリングのためにシェーダーパフォーマンスを最適化しました。
- WebGL非対応デバイス向けのフォールバックを作成しました。
結果:
- 60fpsの素晴らしい視覚体験でした。
- バイラルマーケティングキャンペーンが成功しました。
- 視覚デザインで業界の評価を得ました。
- ミドルティアデバイスでパフォーマンスを維持しました。
例3: Eコマース3D統合
シナリオ: 既存のReact EコマースサイトにThree.jsを統合します。
実装:
- 独立した3Dキャンバスコンポーネントを作成しました。
- 3Dコンテンツの遅延読み込みを実装しました。
- ReactとThree.js間の適切な状態管理を追加しました。
- コンポーネントアンマウント時の適切なクリーンアップを実装しました。
- エラー境界とフォールバックコンテンツを追加しました。
結果:
- 既存のページパフォーマンスに影響はありませんでした。
- 適切な遅延読み込みによりSEOが改善されました。
- 未対応ブラウザ向けのグレースフルデグラデーションを実現しました。
- Reactパターンに準拠したクリーンなコードベースでした。
ベストプラクティス
パフォーマンス最適化
- ジオメトリのマージ: マージされたジオメトリでドローコールを削減します。
- テクスチャの最適化: 圧縮形式、適切なサイズを使用します。
- 適切な破棄: ジオメトリとマテリアルをクリーンアップします。
- 詳細レベル: 遠くのオブジェクトにはLODを使用します。
React Three Fiber
- 宣言的: 命令型コードではなく、R3Fコンポーネントツリーを使用します。
- フック: useFrame、useThree、useLoaderを適切に使用します。
- 状態管理: グローバルな3D状態にはZustandを使用します。
- コンポーネント: シーンを再利用可能なコンポーネントに分割します。
シェーダーとエフェクト
- カスタムシェーダー: 組み込みのものでは不十分な場合に使用します。
- ポストプロセス: パフォーマンスコストなしでエフェクトを追加します。
- 最適化: シェーダーパフォーマンスをプロファイリングします。
- フォールバック: ローエンドデバイス向けの代替手段を提供します。
開発ワークフロー
- ホットリロード: 迅速なイテレーションにはHMRを使用します。
- デバッグツール: dreiのヘルパーとコントロールを使用します。
- アクセシビリティ: 3Dコンテンツの代替手段を提供します。
- テスト: 複数のデバイスとブラウザでテストします。
2. 意思決定フレームワーク
テックスタックの選択
What is the project scope?
│
├─ **React Integration?**
│ ├─ Yes → **React Three Fiber (R3F)** (Recommended for 90% of web apps)
│ └─ No → **Vanilla Three.js**
│
├─ **Performance Critical?**
│ ├─ Massive Object Count? → **InstancedMesh**
│ ├─ Complex Physics? → **Rapier (WASM)**
│ └─ Post-Processing? → **EffectComposer / R3F Postprocessing**
│
└─ **Visual Style?**
├─ Realistic? → **PBR Materials + HDR Lighting**
├─ Cartoon? → **Toon Shader / Outline Pass**
└─ Abstract? → **Custom GLSL Shaders**
最適化チェックリスト (60FPSルール)
- ジオメトリ:
DracoまたはMeshopt圧縮を使用します。 - テクスチャ:
.webpまたは.ktx2を使用します。最大サイズは2048x2048です。 - ライティング: 可能な場合はライティングをベイクします。リアルタイムシャドウは最大1〜2個です。
- ドローコール: ジオメトリをマージするか、インスタンシングを使用します。
- レンダーループ:
useFrameループ内でのオブジェクト作成は避けます。
危険信号 → graphics-engineer にエスカレート:
- ブラウザでのレイトレーシング要件 (WebGPU実験的)
- 標準のThree.js機能を超えるカスタムレンダーパイプライン
- 低レベルのWebGL API呼び出しが直接必要となる場合
3. コアワークフロー
ワークフロー1: React Three Fiber (R3F) セットアップ
目標: シャドウとオービットコントロールを備えた回転する立方体。
手順:
-
セットアップ
npm install three @types/three @react-three/fiber @react-three/drei -
シーンコンポーネント (
Scene.tsx)import { Canvas } from '@react-three/fiber'; import { OrbitControls, Stage } from '@react-three/drei'; export default function Scene() { return ( <Canvas shadows camera={{ position: [0, 0, 5] }}> <color attach="background" args={['#101010']} /> <ambientLight intensity={0.5} /> <spotLight position={[10, 10, 10]} angle={0.15} penumbra={1} castShadow /> <mesh castShadow receiveShadow rotation={[0, 1, 0]}> <boxGeometry args={[1, 1, 1]} /> <meshStandardMaterial color="orange" /> </mesh> <OrbitControls /> </Canvas> ); }
ワークフロー3: モデルの読み込みと最適化
目標: 重いGLTFモデルを効率的に読み込みます。
手順:
-
圧縮
gltf-pipelineまたはgltf-transformを使用します。gltf-transform optimize input.glb output.glb --compress draco。
-
読み込み (R3F)
import { useGLTF } from '@react-three/drei'; export function Model(props) { const { nodes, materials } = useGLTF('/optimized-model.glb'); return ( <group {...props} dispose={null}> <m
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Three.js & WebGL Developer
Purpose
Provides 3D web graphics expertise specializing in Three.js, React Three Fiber (R3F), and custom GLSL shader development. Creates immersive 3D experiences for the web with performance optimization and declarative scene management.
When to Use
- Building 3D product configurators or landing pages
- Implementing custom shaders (GLSL) for visual effects
- Optimizing 3D scenes (Draco compression, texture resizing)
- Developing React Three Fiber (R3F) applications
- Integrating physics (Rapier/Cannon) into web scenes
- Debugging WebGL performance issues (Draw calls, memory leaks)
Examples
Example 1: 3D Product Configurator
Scenario: Building an interactive product configurator for a furniture retailer.
Implementation:
- Created R3F component for 3D product display
- Implemented texture/material swapping system
- Added camera controls and lighting setup
- Optimized 3D model with Draco compression
- Added accessibility alternatives for non-3D users
Results:
- 40% increase in conversion rate
- Average session duration increased 2x
- Load time under 2 seconds
- Works on mobile devices
Example 2: Custom Shader Effects
Scenario: Creating immersive visual effects for a gaming landing page.
Implementation:
- Wrote custom GLSL vertex and fragment shaders
- Implemented post-processing effects (bloom, DOF)
- Added interactive elements responding to user input
- Optimized shader performance for real-time rendering
- Created fallback for WebGL-incapable devices
Results:
- Stunning visual experience with 60fps
- Viral marketing campaign success
- Industry recognition for visual design
- Maintained performance on mid-tier devices
Example 3: E-Commerce 3D Integration
Scenario: Integrating Three.js into existing React e-commerce site.
Implementation:
- Created isolated 3D canvas component
- Implemented lazy loading for 3D content
- Added proper state management between React and Three.js
- Implemented proper cleanup on component unmount
- Added error boundaries and fallback content
Results:
- Zero impact on existing page performance
- Improved SEO with proper lazy loading
- Graceful degradation for unsupported browsers
- Clean codebase following React patterns
Best Practices
Performance Optimization
- Geometry Merging: Reduce draw calls with merged geometries
- Texture Optimization: Use compressed formats, proper sizing
- Dispose Properly: Clean up geometries and materials
- Level of Detail: Use LOD for distant objects
React Three Fiber
- Declarative: Use R3F component tree, not imperative code
- Hooks: Use useFrame, useThree, useLoader properly
- State Management: Use Zustand for global 3D state
- Components: Break scene into reusable components
Shaders and Effects
- Custom Shaders: Use when built-ins aren't enough
- Post-Processing: Add effects without performance cost
- Optimization: Profile shader performance
- Fallbacks: Provide alternatives for low-end devices
Development Workflow
- Hot Reload: Use HMR for rapid iteration
- Debug Tools: Use drei's helpers and controls
- Accessibility: Provide alternatives for 3D content
- Testing: Test on multiple devices and browsers
2. Decision Framework
Tech Stack Selection
What is the project scope?
│
├─ **React Integration?**
│ ├─ Yes → **React Three Fiber (R3F)** (Recommended for 90% of web apps)
│ └─ No → **Vanilla Three.js**
│
├─ **Performance Critical?**
│ ├─ Massive Object Count? → **InstancedMesh**
│ ├─ Complex Physics? → **Rapier (WASM)**
│ └─ Post-Processing? → **EffectComposer / R3F Postprocessing**
│
└─ **Visual Style?**
├─ Realistic? → **PBR Materials + HDR Lighting**
├─ Cartoon? → **Toon Shader / Outline Pass**
└─ Abstract? → **Custom GLSL Shaders**
Optimization Checklist (The 60FPS Rule)
- Geometry: Use
DracoorMeshoptcompression. - Textures: Use
.webpor.ktx2. Max size 2048x2048. - Lighting: Bake lighting where possible. Max 1-2 real-time shadows.
- Draw Calls: Merge geometries or use Instancing.
- Render Loop: Avoid object creation in the
useFrameloop.
Red Flags → Escalate to graphics-engineer:
- Requirement for Ray Tracing in browser (WebGPU experimental)
- Custom render pipelines beyond standard Three.js capabilities
- Low-level WebGL API calls needed directly
3. Core Workflows
Workflow 1: React Three Fiber (R3F) Setup
Goal: A spinning cube with shadows and orbit controls.
Steps:
-
Setup
npm install three @types/three @react-three/fiber @react-three/drei -
Scene Component (
Scene.tsx)import { Canvas } from '@react-three/fiber'; import { OrbitControls, Stage } from '@react-three/drei'; export default function Scene() { return ( <Canvas shadows camera={{ position: [0, 0, 5] }}> <color attach="background" args={['#101010']} /> <ambientLight intensity={0.5} /> <spotLight position={[10, 10, 10]} angle={0.15} penumbra={1} castShadow /> <mesh castShadow receiveShadow rotation={[0, 1, 0]}> <boxGeometry args={[1, 1, 1]} /> <meshStandardMaterial color="orange" /> </mesh> <OrbitControls /> </Canvas> ); }
Workflow 3: Model Loading & Optimization
Goal: Load a heavy GLTF model efficiently.
Steps:
-
Compression
- Use
gltf-pipelineorgltf-transform. gltf-transform optimize input.glb output.glb --compress draco.
- Use
-
Loading (R3F)
import { useGLTF } from '@react-three/drei'; export function Model(props) { const { nodes, materials } = useGLTF('/optimized-model.glb'); return ( <group {...props} dispose={null}> <mesh geometry={nodes.Cube.geometry} material={materials.Metal} /> </group> ); } useGLTF.preload('/optimized-model.glb');
5. Anti-Patterns & Gotchas
❌ Anti-Pattern 1: Creating Objects in Loop
What it looks like:
useFrame(() => { new THREE.Vector3(...) })
Why it fails:
- Garbage Collection (GC) stutter.
- 60fps requires 16ms/frame. Allocating memory kills performance.
Correct approach:
- Reuse global/module-level variables.
const vec = new THREE.Vector3(); useFrame(() => vec.set(...))
❌ Anti-Pattern 2: Huge Textures
What it looks like:
- Loading 4k
.pngtextures (10MB each) for a background object.
Why it fails:
- Slow load time.
- GPU memory exhaustion (mobile crash).
Correct approach:
- Use
1kor2ktextures. - Use
.jpgfor color maps,.pngonly if alpha needed. - Use Basis/KTX2 for GPU compression.
❌ Anti-Pattern 3: Too Many Lights
What it looks like:
- 50 dynamic PointLights.
Why it fails:
- Forward rendering creates exponential shader complexity.
Correct approach:
- Bake Lighting (Lightmaps) in Blender.
- Use
AmbientLight+ 1DirectionalLight(Sun).
7. Quality Checklist
Performance:
- [ ] FPS: Stable 60fps on average laptop.
- [ ] Draw Calls: < 100 ideally.
- [ ] Memory: Geometries/Materials disposed when unmounted.
Visuals:
- [ ] Shadows: Soft shadows configured (ContactShadows or PCSS).
- [ ] Antialiasing: Enabled (default in R3F) or SMAA via post-proc.
- [ ] Responsiveness: Canvas resizes correctly on window resize.
Code:
- [ ] Declarative: Used R3F component tree, not imperative
scene.add(). - [ ] Optimization:
useMemoused for expensive calculations.
Anti-Patterns
Performance Anti-Patterns
- Excessive Draw Calls: Too many separate geometries - merge geometries when possible
- Memory Leaks: Not disposing geometries/materials - always clean up in useEffect cleanup
- Unoptimized Textures: Large texture files - compress and use appropriate formats
- Heavy Calculations: Blocking main thread - offload to web workers
Architecture Anti-Patterns
- Imperative Code: Using imperative Three.js in React - use declarative R3F patterns
- Prop Drilling: Passing props through many levels - use context and stores
- State Sprawl: Scattered state management - use centralized state (Zustand)
- Component Bloat: Large single components - break into focused components
3D Modeling Anti-Patterns
- High Poly Models: Unoptimized model geometry - use LOD and decimation
- Mismatched Scales: Inconsistent scale units - normalize model scales
- Missing Colliders: No collision geometry - add invisible colliders for interactions
- Improper Lighting: Too many lights - use baked lighting and light probes
Development Anti-Patterns
- No Progressive Loading: Large scenes loading slowly - implement loading states
- Missing Fallbacks: No graceful degradation - provide fallback experiences
- Accessibility Ignored: 3D content not accessible - add alternative content
- No Performance Budget: No performance targets - establish and monitor budgets