Loading...
Loading...
Compare original and translation side by side
Tool Versions (2026)
- gltf-transform: v4+
- Meshoptimizer: v0.21+
- Basis Universal: v1.16+
- Blender: 4.2+
工具版本(2026)
- gltf-transform: v4+
- Meshoptimizer: v0.21+
- Basis Universal: v1.16+
- Blender: 4.2+
Geometry Compression:
├─ Need fastest decode time? → Meshopt (recommended)
├─ Need smallest file size? → Draco (10-20% smaller)
├─ Animated models (skinned/morphs)? → Meshopt (better animation support)
├─ Static meshes only? → Either works
└─ Maximum compatibility? → No compression (larger files)
Texture Compression:
├─ GPU-compressed (fastest rendering)? → KTX2/Basis Universal
├─ Good balance (size vs quality)? → WebP
├─ Best quality at cost of size? → PNG (lossless) or AVIF
├─ Need alpha channel? → WebP, PNG, KTX2, or AVIF
└─ Photo textures, no alpha? → JPEG or WebP几何体压缩:
├─ 需要最快解码速度? → Meshopt (推荐)
├─ 需要最小文件体积? → Draco (小10-20%)
├─ 带动画的模型(蒙皮/变形)? → Meshopt (更好的动画支持)
├─ 仅静态模型? → 两者均可
└─ 最大兼容性? → 不压缩(文件更大)
纹理压缩:
├─ GPU压缩(最快渲染)? → KTX2/Basis Universal
├─ 平衡体积与质量? → WebP
├─ 最佳质量(牺牲体积)? → PNG(无损)或AVIF
├─ 需要透明通道? → WebP、PNG、KTX2或AVIF
└─ 照片纹理,无透明通道? → JPEG或WebPSingle hero model (product viewer)?
→ gltf-transform optimize with high quality settings
Many similar models (e-commerce)?
→ Batch processing script with consistent settings
Game assets (performance critical)?
→ Aggressive compression + LODs + texture atlases
Architectural visualization?
→ High poly + baked lighting + KTX2 textures
Real-time application?
→ Meshopt + KTX2 + LODs + strict budgets单个核心模型(产品查看器)?
→ 使用高质量设置的gltf-transform optimize
多个相似模型(电商场景)?
→ 使用统一设置的批量处理脚本
游戏资产(性能要求严格)?
→ 激进压缩 + LOD + 纹理图集
建筑可视化?
→ 高多边形 + 烘焙光照 + KTX2纹理
实时应用?
→ Meshopt + KTX2 + LOD + 严格性能预算| Scenario | Geometry | Textures | LODs |
|---|---|---|---|
| Product viewer | Meshopt | WebP/KTX2 | Optional |
| Game assets | Meshopt | KTX2 | Required |
| Archviz | Meshopt | KTX2 2048px | Per-room |
| Mobile | Meshopt | KTX2 512-1024px | Required |
| E-commerce batch | Draco (smaller) | WebP | Optional |
| 场景 | 几何体 | 纹理 | LOD |
|---|---|---|---|
| 产品查看器 | Meshopt | WebP/KTX2 | 可选 |
| 游戏资产 | Meshopt | KTX2 | 必填 |
| 建筑可视化 | Meshopt | KTX2 2048px | 按房间设置 |
| 移动端 | Meshopt | KTX2 512-1024px | 必填 |
| 电商批量处理 | Draco(体积更小) | WebP | 可选 |
.gltf.glb.gltf.glbnpm install -g @gltf-transform/cliundefinednpm install -g @gltf-transform/cliundefinedundefinedundefinedundefinedundefinedundefinedundefined| Format | Use Case | Alpha | Compression | GPU Decode |
|---|---|---|---|---|
| KTX2/Basis | GPU-compressed (best) | Yes | UASTC/ETC1S | Native |
| WebP | General textures | Yes | Lossy/Lossless | CPU |
| AVIF | Best file compression | Yes | Lossy | CPU |
| JPEG | Photos, no alpha | No | Lossy | CPU |
| PNG | UI, sharp edges | Yes | Lossless | CPU |
| 格式 | 使用场景 | 透明通道 | 压缩方式 | GPU解码 |
|---|---|---|---|---|
| KTX2/Basis | GPU压缩(最佳选择) | 支持 | UASTC/ETC1S | 原生支持 |
| WebP | 通用纹理 | 支持 | 有损/无损 | CPU解码 |
| AVIF | 文件压缩率最佳 | 支持 | 有损 | CPU解码 |
| JPEG | 照片纹理,无透明通道 | 不支持 | 有损 | CPU解码 |
| PNG | UI、锐利边缘纹理 | 支持 | 无损 | CPU解码 |
| Texture Type | Mobile | Desktop | Notes |
|---|---|---|---|
| Diffuse/Albedo | 512-1024 | 1024-2048 | sRGB color space |
| Normal | 512-1024 | 1024-2048 | Linear, tangent space |
| Roughness/Metal | 256-512 | 512-1024 | Linear, can pack |
| AO | 256-512 | 512-1024 | Linear, can pack |
| Environment | 256-512 | 512-1024 | HDR for reflections |
| 纹理类型 | 移动端 | 桌面端 | 说明 |
|---|---|---|---|
| 漫反射/基础色 | 512-1024 | 1024-2048 | sRGB色彩空间 |
| 法线 | 512-1024 | 1024-2048 | 线性、切线空间 |
| 粗糙度/金属度 | 256-512 | 512-1024 | 线性,可打包 |
| 环境光遮蔽(AO) | 256-512 | 512-1024 | 线性,可打包 |
| 环境贴图 | 256-512 | 512-1024 | HDR用于反射 |
undefinedundefinedundefinedundefinedR: Ambient Occlusion
G: Roughness
B: Metalness
A: (unused or height)// Three.js with packed ORM texture
const ormTexture = textureLoader.load('/orm.png')
ormTexture.colorSpace = THREE.LinearSRGBColorSpace
const material = new THREE.MeshStandardNodeMaterial({
aoMap: ormTexture,
roughnessMap: ormTexture,
metalnessMap: ormTexture,
// Channel selection happens automatically in ORM workflow
})R: 环境光遮蔽(Ambient Occlusion)
G: 粗糙度(Roughness)
B: 金属度(Metalness)
A: (未使用或高度图)// Three.js中使用打包的ORM纹理
const ormTexture = textureLoader.load('/orm.png')
ormTexture.colorSpace = THREE.LinearSRGBColorSpace
const material = new THREE.MeshStandardNodeMaterial({
aoMap: ormTexture,
roughnessMap: ormTexture,
metalnessMap: ormTexture,
// 通道选择在ORM工作流中自动完成
})Format: GLB (single file)
Include:
[x] Selected Objects (if exporting subset)
[x] Custom Properties
[x] Cameras (if needed)
[x] Punctual Lights (if needed)
Transform:
+Y Up (standard for web)
Data:
Mesh:
[x] Apply Modifiers
[x] UVs
[x] Normals
[ ] Tangents (let Three.js compute)
[ ] Vertex Colors (unless needed)
Material:
[x] Materials → Export
[x] Images → Automatic (embeds in GLB)
Shape Keys: [x] (if using morph targets)
Skinning: [x] (if using armatures)
Armature:
[x] Export Deformation Bones Only
Animation:
[x] Animations
Sampling Rate: 24 or match source
Compression:
[ ] Draco (prefer post-processing with gltf-transform)格式: GLB(单文件)
包含:
[x] 选中对象(如果导出子集)
[x] 自定义属性
[x] 相机(如果需要)
[x] 点光源(如果需要)
变换:
+Y 向上(Web标准)
数据:
网格:
[x] 应用修改器
[x] UV
[x] 法线
[ ] 切线(让Three.js计算)
[ ] 顶点颜色(除非需要)
材质:
[x] 材质 → 导出
[x] 图像 → 自动(嵌入到GLB中)
形状键: [x](如果使用变形目标)
蒙皮: [x](如果使用骨骼)
骨骼:
[x] 仅导出变形骨骼
动画:
[x] 动画
采样率: 24或与源文件一致
压缩:
[ ] Draco(推荐使用gltf-transform进行后处理)| Problem | Solution |
|---|---|
| Model too big/small | Apply scale (Ctrl+A) before export |
| Missing textures | Pack textures (File → External Data → Pack) |
| Broken normals | Recalculate normals (Shift+N in Edit mode) |
| Flipped faces | Check normals direction, flip if needed |
| Animation jitter | Increase keyframe sampling rate |
| Materials wrong | Use Principled BSDF, check texture paths |
| Bones missing | Check "Export Deformation Bones Only" |
| 问题 | 解决方案 |
|---|---|
| 模型过大/过小 | 导出前应用缩放(Ctrl+A) |
| 纹理丢失 | 打包纹理(文件 → 外部数据 → 打包) |
| 法线错误 | 重新计算法线(编辑模式下Shift+N) |
| 面翻转 | 检查法线方向,必要时翻转 |
| 动画抖动 | 提高关键帧采样率 |
| 材质异常 | 使用Principled BSDF材质,检查纹理路径 |
| 骨骼丢失 | 勾选“仅导出变形骨骼” |
import * as THREE from 'three/webgpu'
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'
const loader = new GLTFLoader()
// Meshopt decoder (recommended)
loader.setMeshoptDecoder(MeshoptDecoder)
// KTX2 textures (requires renderer for format detection)
const ktx2Loader = new KTX2Loader()
ktx2Loader.setTranscoderPath('https://cdn.jsdelivr.net/npm/three@0.171.0/examples/jsm/libs/basis/')
ktx2Loader.detectSupport(renderer) // Required!
loader.setKTX2Loader(ktx2Loader)
// Load
const gltf = await loader.loadAsync('/model.glb')
scene.add(gltf.scene)import * as THREE from 'three/webgpu'
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'
const loader = new GLTFLoader()
// Meshopt解码器(推荐)
loader.setMeshoptDecoder(MeshoptDecoder)
// KTX2纹理(需要渲染器检测格式支持)
const ktx2Loader = new KTX2Loader()
ktx2Loader.setTranscoderPath('https://cdn.jsdelivr.net/npm/three@0.171.0/examples/jsm/libs/basis/')
ktx2Loader.detectSupport(renderer) // 必填!
loader.setKTX2Loader(ktx2Loader)
// 加载模型
const gltf = await loader.loadAsync('/model.glb')
scene.add(gltf.scene)import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'
const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.7/')
loader.setDRACOLoader(dracoLoader)import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'
const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.7/')
loader.setDRACOLoader(dracoLoader)import { useGLTF } from '@react-three/drei'
// Drei handles Meshopt and Draco automatically
const { scene, nodes, materials, animations } = useGLTF('/model.glb')
// Preload for instant display
useGLTF.preload('/model.glb')import { useGLTF } from '@react-three/drei'
// Drei自动处理Meshopt和Draco
const { scene, nodes, materials, animations } = useGLTF('/model.glb')
// 预加载以实现即时显示
useGLTF.preload('/model.glb')| Platform | Triangles | Draw Calls | Texture Memory | File Size |
|---|---|---|---|---|
| Mobile | <100K | <50 | <50MB | <5MB |
| Desktop | <500K | <100 | <200MB | <20MB |
| High-end | <2M | <200 | <500MB | <50MB |
| 平台 | 三角形数量 | 绘制调用 | 纹理内存 | 文件体积 |
|---|---|---|---|---|
| 移动端 | <100K | <50 | <50MB | <5MB |
| 桌面端 | <500K | <100 | <200MB | <20MB |
| 高端设备 | <2M | <200 | <500MB | <50MB |
// Three.js render info (call after render)
console.log(renderer.info.render)
// { calls, triangles, points, lines, frame }
console.log(renderer.info.memory)
// { geometries, textures }
// Performance monitor
import Stats from 'stats.js'
const stats = new Stats()
stats.showPanel(0) // 0: fps, 1: ms, 2: mb
document.body.appendChild(stats.dom)
function animate() {
stats.begin()
renderer.render(scene, camera)
stats.end()
}
renderer.setAnimationLoop(animate)// Three.js渲染信息(渲染后调用)
console.log(renderer.info.render)
// { calls, triangles, points, lines, frame }
console.log(renderer.info.memory)
// { geometries, textures }
// 性能监控器
import Stats from 'stats.js'
const stats = new Stats()
stats.showPanel(0) // 0: fps, 1: 毫秒, 2: 内存占用
document.body.appendChild(stats.dom)
function animate() {
stats.begin()
renderer.render(scene, camera)
stats.end()
}
renderer.setAnimationLoop(animate)undefinedundefinedundefinedundefined| When you need... | Use skill |
|---|---|
| Build 3D scenes with Three.js | → threejs |
| Build 3D scenes with React | → react-three-fiber |
| Debug rendering/performance issues | → graphics-troubleshooting |
| 当你需要... | 使用技能 |
|---|---|
| 使用Three.js构建3D场景 | → threejs |
| 使用React构建3D场景 | → react-three-fiber |
| 调试渲染/性能问题 | → graphics-troubleshooting |