threejs-textures

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

When to use this skill

何时使用此技能

ALWAYS use this skill when the user mentions:
  • texture.wrapS
    /
    wrapT
    ,
    minFilter
    ,
    magFilter
    ,
    generateMipmaps
    ,
    anisotropy
  • colorSpace
    / correct handling of sRGB vs linear data maps
  • Creating
    DataTexture
    ,
    CubeTexture
    , compressed GPU formats, video/canvas driven textures
  • PMREMGenerator
    from environment maps for IBL
IMPORTANT: textures vs loaders
StepSkill
Decode file / HTTPthreejs-loaders
Configure GPU
Texture
threejs-textures
Trigger phrases include:
  • "Texture", "CubeTexture", "PMREM", "colorSpace", "mipmap", "各向异性"
  • "环境贴图", "数据纹理", "压缩纹理"
当用户提到以下内容时,务必使用此技能:
  • texture.wrapS
    /
    wrapT
    、
    minFilter
    、
    magFilter
    、
    generateMipmaps
    、
    anisotropy
  • colorSpace
    / sRGB 与线性数据贴图的正确处理
  • 创建
    DataTexture
    、
    CubeTexture
    、压缩 GPU 格式、视频/画布驱动的纹理
  • 基于环境贴图使用
    PMREMGenerator
    实现 IBL(基于图像照明)
重要提示:纹理 vs 加载器
步骤技能
解码文件 / HTTP 请求threejs-loaders
配置 GPU
Texture
threejs-textures
触发短语包括:
  • "Texture", "CubeTexture", "PMREM", "colorSpace", "mipmap", "各向异性"
  • "环境贴图", "数据纹理", "压缩纹理"

How to use this skill

如何使用此技能

  1. Classify texture dimensionality and format (2D, cube, depth, compressed, data).
  2. Color pipeline: set
    colorSpace
    appropriately; normal/roughness maps are non-color data.
  3. Sampling: choose filters; enable mipmaps when minification occurs; consider max anisotropy.
  4. PMREM: feed env map through
    PMREMGenerator
    per docs; assign result to scene/env/intensity paths as required.
  5. Video/canvas: understand update needs each frame for
    VideoTexture
    /
    CanvasTexture
    .
  6. Disposal:
    dispose()
    textures when replacing to free GPU memory.
  7. KTX2/Basis: transcoder wiring belongs in threejs-loaders before this step.
See examples/workflow-pmrem-env.md.
  1. 分类:确定纹理的维度和格式(2D、立方体贴图、深度、压缩、数据)。
  2. 色彩管线:合理设置
    colorSpace
    ;法线/粗糙度贴图属于非颜色数据。
  3. 采样:选择滤镜;当发生缩小时启用 mipmap;考虑最大各向异性。
  4. PMREM:按照文档将环境贴图传入
    PMREMGenerator
    ;根据需要将结果赋值到 scene/env/intensity 相关路径。
  5. 视频/画布:了解
    VideoTexture
    /
    CanvasTexture
    每帧的更新需求。
  6. 销毁:替换纹理时调用
    dispose()
    释放 GPU 内存。
  7. KTX2/Basis:转码器的配置属于 threejs-loaders 的范畴,应在此步骤之前完成。
参见 examples/workflow-pmrem-env.md。

Doc map (official)

文档索引(官方)

Scope

适用范围

  • In scope: Core Textures + PMREMGenerator; sampling and color pipeline at texture level.
  • Out of scope: Loader configuration; post-processing passes that sample buffers (threejs-postprocessing).
  • 适用范围: 核心纹理 + PMREMGenerator;纹理层面的采样和色彩管线。
  • 不适用范围: 加载器配置;对缓冲区进行采样的后处理通道(threejs-postprocessing)。

Common pitfalls and best practices

常见陷阱与最佳实践

  • sRGB albedo in linear workflow without proper colorSpace looks wrong next to renderer output.
  • Non-power-of-two textures have mip/wrap limitations unless padded.
  • Forgetting texture disposal on hot reload leaks VRAM.
  • 在线性工作流中,sRGB 反照率贴图若未正确设置
    colorSpace
    ,与渲染器输出搭配时会出现色彩异常。
  • 非二次幂纹理在 mipmap/环绕模式上存在限制,除非进行填充处理。
  • 热重载时忘记销毁纹理会导致 VRAM 泄漏。

Documentation and version

文档与版本

Texture classes and
PMREMGenerator
are documented under Textures and PMREMGenerator in three.js docs. Compressed and KTX2 paths often depend on threejs-loaders for transcoder setup before this skill applies.
纹理类和
PMREMGenerator
的文档位于 three.js 官方文档 的 纹理 和 PMREMGenerator 板块下。压缩纹理和 KTX2 相关流程通常需要先通过 threejs-loaders 完成转码器配置,之后才能应用此技能。

Agent response checklist

Agent 回复检查清单

When answering under this skill, prefer responses that:
  1. Link
    Texture
    ,
    DataTexture
    ,
    CubeTexture
    , or
    PMREMGenerator
    as appropriate.
  2. Tie
    colorSpace
    / filtering to threejs-renderers output and threejs-materials maps.
  3. Send Draco/KTX2 decoder wiring questions to threejs-loaders first.
  4. Emphasize
    dispose()
    when replacing env maps or large atlases.
  5. Mention Global constants only when wrapping/filter enums matter.
在此技能范畴内回答问题时,优先遵循以下回复原则:
  1. 根据情况链接
    Texture
    、
    DataTexture
    、
    CubeTexture
    或
    PMREMGenerator
    的文档。
  2. 将
    colorSpace
    / 滤镜与 threejs-renderers 的输出以及 threejs-materials 的贴图关联起来。
  3. 涉及 Draco/KTX2 解码器配置的问题,请优先引导至 threejs-loaders 技能。
  4. 在替换环境贴图或大型图集时,强调
    dispose()
    的使用。
  5. 仅在涉及环绕/滤镜枚举值时,提及 Global 常量。

References

参考资料

Keywords

关键词

English: texture, cubemap, pmrem, mipmap, colorspace, compressed texture, data texture, three.js
中文: 纹理、立方体贴图、PMREM、mipmap、色彩空间、压缩纹理、three.js
英文: texture, cubemap, pmrem, mipmap, colorspace, compressed texture, data texture, three.js
中文: 纹理、立方体贴图、PMREM、mipmap、色彩空间、压缩纹理、three.js