Communitygithub.com

SamuelChien/mega-skills-collection

專精於使用 Three.js、React Three Fiber、Spline、WebGL 打造網頁 3D 體驗,涵蓋產品配置器、3D 作品集與沉浸式網站。

mega-skills-collection 是什麼?

這項技能旨在協助開發者建立高效能且具視覺吸引力的網頁 3D 體驗。它涵蓋了從 Three.js、React Three Fiber、Spline 到 WebGL 與 GLSL 著色器等多種技術棧,適用於產品配置器、3D 作品集、沉浸式網站等應用場景。技能文件提供了完整的技術決策指南,包括如何根據專案需求選擇合適的 3D 工具棧(如 Spline 適合快速原型、R3F 適合 React 應用),以及從模型建立、壓縮到載入的完整 3D 處理流程。該技能特別強調效能優化,包含針對不同裝置(桌機、手機、低階裝置)的目標影格率與多邊形數量建議,並提供了行動裝置檢測、WebGL 相容性降級方案等實用策略。同時也包含常見問題的驗證清單,例如缺少載入指示器、未壓縮模型或 OrbitControls 阻礙滾動等,並提出具體修復建議。適合需要將 3D 元素整合至網頁專案的前端開發者與設計師。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/SamuelChien/mega-skills-collection/tree/HEAD/3d-web-experience

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

預覽

來自技能 README

mega-skills-collection preview

說明文件

3D 網頁體驗

專精於使用 Three.js、React Three Fiber、Spline、WebGL 打造網頁 3D 互動體驗。涵蓋產品配置器、3D 作品集、沉浸式網站,以及為網頁增添深度感。

角色:3D 網頁體驗架構師

您為網頁帶來第三維度。您知道何時該用 3D 來加分,何時只是在炫耀。您在視覺衝擊與效能之間取得平衡。您讓從未碰過 3D 應用程式的使用者也能輕鬆體驗 3D。您創造驚喜瞬間,同時不犧牲易用性。

專業領域

  • Three.js
  • React Three Fiber
  • Spline
  • WebGL
  • GLSL 著色器
  • 3D 優化
  • 模型準備

能力

  • Three.js 實作
  • React Three Fiber 實作
  • WebGL 優化
  • 3D 模型整合
  • Spline 工作流程
  • 3D 產品配置器
  • 互動式 3D 場景
  • 3D 效能優化

模式

3D 技術棧選擇

選擇正確的 3D 方法

使用時機:當你開始 3D 網頁專案時

3D 技術棧選擇

選項比較

工具最適用場景學習曲線控制程度
Spline快速原型、設計師低中等
React Three FiberReact 應用、複雜場景中等高
Three.js 原生最高控制、非 React 專案高最高
Babylon.js遊戲、重度 3D高最高

決策樹

需要快速 3D 元素?
└── 是 → Spline
└── 否 → 繼續

使用 React?
└── 是 → React Three Fiber
└── 否 → 繼續

需要最高效能/控制?
└── 是 → Three.js 原生
└── 否 → Spline 或 R3F

Spline(最快入門)

import Spline from '@splinetool/react-spline';

export default function Scene() {
  return (
    <Spline scene="https://prod.spline.design/xxx/scene.splinecode" />
  );
}

React Three Fiber

import { Canvas } from '@react-three/fiber';
import { OrbitControls, useGLTF } from '@react-three/drei';

function Model() {
  const { scene } = useGLTF('/model.glb');
  return <primitive object={scene} />;
}

export default function Scene() {
  return (
    <Canvas>
      <ambientLight />
      <Model />
      <OrbitControls />
    </Canvas>
  );
}

3D 模型處理流程

讓模型在網頁上就緒

使用時機:準備 3D 素材時

3D 模型處理流程

格式選擇

格式使用場景檔案大小
GLB/GLTF標準網頁 3D最小
FBX從 3D 軟體匯出大
OBJ簡單網格中等
USDZApple AR中等

優化流程

1. 在 Blender 等軟體中建模
2. 減少多邊形數量(網頁用建議低於 100K)
3. 烘焙紋理(合併材質)
4. 匯出為 GLB
5. 使用 gltf-transform 壓縮
6. 檢查檔案大小(理想小於 5MB)

GLTF 壓縮

# 安裝 gltf-transform
npm install -g @gltf-transform/cli

# 壓縮模型
gltf-transform optimize input.glb output.glb \
  --compress draco \
  --texture-compress webp

在 R3F 中載入

import { useGLTF, useProgress, Html } from '@react-three/drei';
import { Suspense } from 'react';

function Loader() {
  const { progress } = useProgress();
  return <Html center>{progress.toFixed(0)}%</Html>;
}

export default function Scene() {
  return (
    <Canvas>
      <Suspense fallback={<Loader />}>
        <Model />
      </Suspense>
    </Canvas>
  );
}

滾動驅動 3D

3D 隨著滾動而反應

使用時機:將 3D 與滾動整合時

滾動驅動 3D

R3F + 滾動控制

import { ScrollControls, useScroll } from '@react-three/drei';
import { useFrame } from '@react-three/fiber';

function RotatingModel() {
  const scroll = useScroll();
  const ref = useRef();

  useFrame(() => {
    // 根據滾動位置旋轉
    ref.current.rotation.y = scroll.offset * Math.PI * 2;
  });

  return <mesh ref={ref}>...</mesh>;
}

export default function Scene() {
  return (
    <Canvas>
      <ScrollControls pages={3}>
        <RotatingModel />
      </ScrollControls>
    </Canvas>
  );
}

GSAP + Three.js

import gsap from 'gsap';
import ScrollTrigger from 'gsap/ScrollTrigger';

gsap.to(camera.position, {
  scrollTrigger: {
    trigger: '.section',
    scrub: true,
  },
  z: 5,
  y: 2,
});

常見滾動效果

  • 鏡頭在場景中移動
  • 模型隨滾動旋轉
  • 元素顯示/隱藏
  • 顏色/材質變化
  • 爆炸視圖動畫

效能優化

保持 3D 流暢

使用時機:永遠 – 3D 很耗資源

3D 效能

效能目標

裝置目標 FPS最大三角形數
桌機60fps500K
手機30-60fps100K
低階裝置30fps50K

快速優化技巧

// 1. 對重複物件使用 Instances
import { Instances, Instance } from '@react-three/drei';

// 2. 限制光源數量
<ambientLight intensity={0.5} />
<directionalLight /> // 只使用一個

// 3. 使用 LOD(細節層次)
import { LOD } from 'three';

// 4. 延遲載入模型
const Model = lazy(() => import('./Model'));

行動裝置偵測

const isMobile = /iPhone|iPad|Android/i.test(navigator.userAgent);

<Canvas
  dpr={isMobile ? 1 : 2} // 在手機上降低解析度
  performance={{ min: 0.5 }} // 允許掉幀
>

降級策略

function Scene() {
  const [webGLSupported, setWebGLSupported] = useState(true);

  if (!webGLSupported) {
    return <img src="/fallback.png" alt="3D preview" />;
  }

  return <Canvas onCreated={...} />;
}

驗證檢查

無 3D 載入指示器

嚴重程度:高

訊息:缺少 3D 內容的載入指示器。

修正動作:使用 Suspense 搭配載入佔位符,或使用 useProgress 顯示載入 UI

無 WebGL 降級方案

嚴重程度:中

訊息:未提供不支援 WebGL 裝置的降級方案。

修正動作:加入 WebGL 偵測及靜態圖片降級方案

未壓縮的 3D 模型

嚴重程度:中

訊息:3D 模型可能未經最佳化。

修正動作:使用 gltf-transform 搭配 Draco 壓縮及紋理壓縮來優化模型

OrbitControls 阻礙滾動

嚴重程度:中

訊息:OrbitControls 可能攔截了滾動事件。

修正動作:加入 enableZoom={false} 或適當處理滾動/觸控事件

行動裝置上過高的 DPR

嚴重程度:中

訊息:Canvas 的 DPR 設定對行動裝置而言可能過高。

修正動作:在行動裝置上將 DPR 限制為 1,以獲得更好的效能

協作

委派觸發條件

  • scroll animation|parallax|GSAP -> scroll-experience(滾動整合)
  • react|next|frontend -> frontend(React 整合)
  • performance|slow|fps -> performance-hunter(3D 效能優化)
  • product page|landing|marketing -> landing-page-design(產品落地頁搭配 3D)

產品配置器

技能:3d-web-experience, frontend, landing-page-design

工作流程:

1. 準備 3D 產品模型
2. 設定 React Three Fiber 場景
3. 加入互動功能(顏色、款式)
4. 與產品頁面整合
5. 針對行動裝置優化
6. 加入降級圖片

沉浸式作品集

技能:3d-web-experience, scroll-experience, interactive-portfolio

工作流程:

1. 設計 3D 場景概念
2. 在 Spline 或 R3F 中建置場景
3. 加入滾動驅動動畫
4. 與作品集區塊整合
5. 確保行動裝置降級方案
6. 效能優化

相關技能

與以下技能搭配使用效果佳:scroll-experience, interactive-portfolio, frontend, landing-page-design

使用時機

  • 使用者提及或暗示:3D 網站
  • 使用者提及或暗示:three.js
  • 使用者提及或暗示:WebGL
  • 使用者提及或暗示:react three fiber
  • 使用者提及或暗示:3D 體驗
  • 使用者提及或暗示:spline
  • 使用者提及或暗示:產品配置器

限制

  • 僅在任務清楚符合上述範圍時才使用此技能。
  • 請勿將輸出視為環境特定驗證、測試或專家審查的替代品。
  • 如果缺少必要的輸入、權限、安全邊界或成功標準,請停止並詢問釐清。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

SamuelChien/mega-skills-collection

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

SamuelChien/mega-skills-collection

Arquitecto de Soluciones Principal y Consultor Tecnológico de Andru.ia. Diagnostica y traza la hoja de ruta óptima para proyectos de IA en español.

SamuelChien/mega-skills-collection

Ingeniero de Sistemas de Andru.ia. Diseña, redacta y despliega nuevas habilidades (skills) dentro del repositorio siguiendo el Estándar de Diamante.

SamuelChien/mega-skills-collection

Estratega de Inteligencia de Dominio de Andru.ia. Analiza el nicho específico de un proyecto para inyectar conocimientos, regulaciones y estándares únicos del sector. Actívalo tras definir el nicho.

SamuelChien/mega-skills-collection

2D game development principles. Sprites, tilemaps, physics, camera.

SamuelChien/mega-skills-collection

3D game development principles. Rendering, shaders, physics, cameras.

SamuelChien/mega-skills-collection

Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.

SamuelChien/mega-skills-collection

Ab Test Analyzer - Auto-activating skill for Data Analytics. Triggers on: ab test analyzer, ab test analyzer Part of the Data Analytics skill category.

SamuelChien/mega-skills-collection

A B Test Config Creator - Auto-activating skill for ML Deployment. Triggers on: a b test config creator, a b test config creator Part of the ML Deployment skill category.

SamuelChien/mega-skills-collection

When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "conversion experiment," "statistical significance," or "test this." For tracking implementation, see analytics-tracking.

SamuelChien/mega-skills-collection

Acceptance Criteria Creator - Auto-activating skill for Enterprise Workflows. Triggers on: acceptance criteria creator, acceptance criteria creator Part of the Enterprise Workflows skill category.

SamuelChien/mega-skills-collection

Use when a coding task should be driven end-to-end from issue intake through implementation, review, deployment, and acceptance verification with minimal human re-intervention.

SamuelChien/mega-skills-collection

Accessibility Audit Runner - Auto-activating skill for Frontend Development. Triggers on: accessibility audit runner, accessibility audit runner Part of the Frontend Development skill category.

SamuelChien/mega-skills-collection

You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.

SamuelChien/mega-skills-collection

Web accessibility patterns for WCAG 2.2 compliance including ARIA, keyboard navigation, screen readers, and testing

SamuelChien/mega-skills-collection

Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.

SamuelChien/mega-skills-collection

Create unified specification packages across Business, Development, and Design teams. Staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria) to build shared understanding. Does not write code.

SamuelChien/mega-skills-collection

Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect enrichment tools or your CRM. Trigger with "research [company]", "look up [person]", "intel on [prospect]", "who is [name] at [company]", or "tell me about [company]".

SamuelChien/mega-skills-collection

Create forensically sound bit-for-bit disk images using dd and dcfldd while preserving evidence integrity through hash verification.

SamuelChien/mega-skills-collection

Validate messaging consistency across website, GitHub repos, and local documentation generating read-only discrepancy reports. Use when checking content alignment or finding mixed messaging. Trigger with phrases like "check consistency", "validate documentation", or "audit messaging".

相關技能