blender-texturing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Texturing

纹理制作

The execution model is in
blender-core
. Material wiring and measured values are in
blender-pbr-materials
, and bakes are in
blender-texture-baking
. This skill authors the surface story: where paint chips, where dirt collects, what's printed on it.
执行模型位于
blender-core
。材质节点连接和测量值位于
blender-pbr-materials
,烘焙流程位于
blender-texture-baking
。本技能用于构建表面叙事:漆面在哪里剥落、污垢在哪里积聚,以及表面印有什么。

One call each

每次调用示例

scripts/smart_material.py -- --objects Crate --wear 0.5 --grime 0.4 --dust 0.3
scripts/smart_material.py -- --objects Crate --rust 0.6 --under-color 0.3 0.29 0.28    # rusty iron
scripts/smart_material.py -- --objects SM_Crate --wear 0.5 --curvature-map //tex/T_Crate_CURV.png --ao-map //tex/T_Crate_AO.png
scripts/decal.py -- --target Wall --at 0 -0.1 1.5 --image //decals/hazard.png --size 0.4
scripts/smart_material.py -- --objects Crate --remove                                  # exact restore
scripts/smart_material.py -- --objects Crate --wear 0.5 --grime 0.4 --dust 0.3
scripts/smart_material.py -- --objects Crate --rust 0.6 --under-color 0.3 0.29 0.28    # rusty iron
scripts/smart_material.py -- --objects SM_Crate --wear 0.5 --curvature-map //tex/T_Crate_CURV.png --ao-map //tex/T_Crate_AO.png
scripts/decal.py -- --target Wall --at 0 -0.1 1.5 --image //decals/hazard.png --size 0.4
scripts/smart_material.py -- --objects Crate --remove                                  # exact restore

How pros layer a material

专业人员如何叠加材质层

Start with a clean base (correct albedo/roughness,
blender-pbr-materials
), then stack from the inside out: base → edge wear → rust → grime → dust. Each layer has a physical cause:
LayerMask (cause)Look
Edge wearconvex curvature (edges get hit) + chip noisereveals the under-material: bare metal, primer, raw wood
Rustcavities and worn edges + blotch noiseorange-brown, metallic 0, roughness ~0.85
Grimeconcave curvature + (1 − AO) (dirt collects where it can't be wiped)dark, rougher, not metallic
Dustworld up-facing normal × patch noise (it settles from above)light, roughness ~0.9
Breakupfine noise on roughness (±25%)the cheapest realism win; never ship a flat roughness value
Pure curvature looks procedural and even. Always multiply in noise so wear is heavy in some places and absent in others. Less is more: wear 0.2–0.4 reads as "used", and 0.7+ reads as "abandoned".
从干净的基础层开始(正确的 albedo/roughness,使用
blender-pbr-materials
),然后由内向外依次叠加:基础层 → 边缘磨损 → 锈迹 → 污垢 → 灰尘。每一层都有对应的物理成因:
层遮罩(成因)外观
边缘磨损凸面曲率(边缘容易受到碰撞)+ 碎屑噪声显露底材:裸金属、底漆、原木
锈迹凹陷和磨损边缘 + 斑块噪声橙棕色,metallic 0,roughness ~0.85
污垢凹面曲率 + (1 − AO)(无法擦到的位置会积聚污垢)深色、更粗糙、非金属
灰尘朝上的世界空间法线 × 斑块噪声(灰尘从上方沉降)浅色,roughness ~0.9
打散效果对 roughness 叠加细噪声(±25%)最廉价却最有效的真实感提升;绝不要交付完全平坦的 roughness 数值
纯曲率遮罩看起来程序化且均匀。始终乘入噪声,让磨损在某些位置较重,在另一些位置完全不存在。适可而止:磨损值 0.2–0.4 看起来像“已使用”,而 0.7 以上则像“已废弃”。

smart_material.py

smart_material.py

  • Inserts one
    TX_Layers
    group in front of every Principled BSDF (Base Color, Roughness, Metallic) and records the originals, so
    --remove
    restores links and values exactly. Re-running updates values in place. All layer amounts stay inputs on the group node, so you can tweak them there.
  • Curvature, live and portable (Cycles + EEVEE, no bake): the
    TX_Curvature
    point attribute is the mean elevation of the neighbours within
    --edge-width
    (m, default 0.02). It's density-independent: band ≈ edge width. Set the width to roughly the bevel width (1–3 cm on props, 5–10 cm on buildings). Cost: ~1.5 s per 30k verts.
  • It needs mid-poly density (bevels/supports). When the median edge is > 4× the edge width, the result carries a
    note
    : wear would smear across whole faces. On low-poly game meshes, bake from the high (
    bake_maps.py --high ... --maps normal ao curvature
    ) and pass
    --curvature-map
    /
    --ao-map
    (loaded as Non-Color, read through
    --uv
    ).
  • Noise is in object space (
    --scale
    = feature size in m), so masks stick to the asset when it moves. Mirrored/linked duplicates share the pattern, so vary
    --scale
    or the object if that shows.
  • Colors are sRGB 0–1. Defaults: steel under paint (0.56, 0.57, 0.58, metallic 1, roughness 0.35). For wood under paint, use
    --under-color 0.45 0.32 0.2 --under-metallic 0 --under-roughness 0.7
    .
  • 会在每个 Principled BSDF(Base Color、Roughness、Metallic)前插入一个
    TX_Layers
    组,并记录原始设置,因此
    --remove
    可以精确恢复节点连接和数值。重新运行会就地更新数值。所有图层强度都保留为组节点上的输入,可直接在此进行调整。
  • 曲率实时且可移植(Cycles + EEVEE,无需烘焙):
    TX_Curvature
    点属性是
    --edge-width
    (单位为 m,默认 0.02)范围内相邻顶点的平均高度。它与网格密度无关:过渡带宽度 ≈ edge width。该宽度应大致设为倒角宽度(道具通常为 1–3 cm,建筑通常为 5–10 cm)。成本约为每 3 万个顶点 1.5 秒。
  • 它需要中等面数密度(包含倒角/支撑结构)。当边缘长度中位数 > 4× edge width 时,结果会附带一条
    note
    :磨损会扩散并覆盖整个面。对于低多边形游戏网格,应从高模烘焙(
    bake_maps.py --high ... --maps normal ao curvature
    ),然后传入
    --curvature-map
    /
    --ao-map
    (以 Non-Color 加载,并通过
    --uv
    读取)。
  • 噪声位于对象空间(
    --scale
    = 以 m 为单位的特征尺寸),因此资产移动时遮罩会跟随资产。镜像或链接的副本会共享图案;若出现这种情况,请调整
    --scale
    或对象本身。
  • 颜色采用 sRGB 0–1。默认值:漆面下的钢材(0.56, 0.57, 0.58,metallic 1,roughness 0.35)。对于漆面下的木材,使用
    --under-color 0.45 0.32 0.2 --under-metallic 0 --under-roughness 0.7
    。

To game engines

导出到游戏引擎

Engines don't run Blender node trees. Bake the result into a texture set:
bake_maps.py -- --low SM_Crate --maps basecolor roughness metallic normal --pack-orm
(self-bake, no
--high
). Then
build_pbr_material.py --textures
and export. Check the result with
blender-asset-qa
and a lit
look
.
游戏引擎不会执行 Blender 节点树。将结果烘焙为纹理集:
bake_maps.py -- --low SM_Crate --maps basecolor roughness metallic normal --pack-orm
(自行烘焙,不使用
--high
)。然后运行
build_pbr_material.py --textures
并导出。使用
blender-asset-qa
和带光照的
look
检查结果。

Decals (decal.py)

贴花(decal.py)

  • Places a subdivided plane at the closest surface point to
    --at
    , oriented to the normal and spun by
    --rotation
    . A Shrinkwrap (project, above surface) keeps it
    --offset
    (2 mm) off the surface. It's parented, has no shadow, uses Dithered alpha, and its height follows the image aspect.
  • It measures the gap at every triangle like
    blender-asset-qa
    does, and doubles
    --subdiv
    (to 128) until flat triangles stop dipping over convex creases. The result reports
    gap_min_m
    /
    gap_max_m
    . Never place decals at 0 offset: that's guaranteed z-fighting.
  • Games: mesh decals cost a draw call each and need alpha sorting. Merge decals that share an atlas into one mesh, use engine projectors (UE Decal Actor, Unity URP Decal Projector, Godot
    Decal
    ) for dynamic ones, or bake them into the base texture.
  • 在距离
    --at
    最近的表面点放置一个细分平面,使其朝向法线,并通过
    --rotation
    旋转。Shrinkwrap(投射模式,位于表面上侧)会使其与表面保持
    --offset
    (2 mm)的间距。它会设置父级、不投射阴影、使用 Dithered alpha,且高度遵循图像宽高比。
  • 与
    blender-asset-qa
    一样测量每个三角形处的间隙,并将
    --subdiv
    逐次加倍(最高达到 128),直到平面三角形不再在凸起折痕处向下陷入。结果会报告
    gap_min_m
    /
    gap_max_m
    。切勿以 0 偏移放置贴花:这必然会导致 z-fighting。
  • 游戏方面:每个网格贴花都会占用一个 draw call,并需要 alpha 排序。将共用同一 atlas 的贴花合并为一个网格;动态贴花可使用引擎投射器(UE Decal Actor、Unity URP Decal Projector、Godot
    Decal
    ),也可将其烘焙到基础纹理中。

Trim sheets, tiling, painting

Trim Sheet、平铺与绘制

Trim sheets, tiling with vertex-color blends, hand/texture painting (5.2 brush assets) and headless pixel writes: references/trims-tiling-painting.md.
Trim Sheet、使用顶点色混合的平铺、手绘/纹理绘制(5.2 笔刷资产)以及无头像素写入:references/trims-tiling-painting.md。

Gotchas

注意事项

  • Mask textures (curvature, AO, roughness, ID) must be Non-Color. The script forces it, but hand-made nodes often don't.
  • Apply scale before computing curvature or setting
    --scale
    . Both are world-sized.
  • TX_Curvature
    is mesh data. Applying modifiers or remeshing afterward invalidates it, so re-run after topology changes.
  • Viewport EEVEE vs Cycles: identical masks (no Bevel/Pointiness/AO shader nodes are used, because those are Cycles-only or screen-space).
  • 遮罩纹理(曲率、AO、roughness、ID)必须设为 Non-Color。脚本会强制进行此设置,但手工创建的节点通常不会。
  • 在计算曲率或设置
    --scale
    前应用缩放。二者都采用世界尺寸。
  • TX_Curvature
    是网格数据。之后应用修改器或重新网格化会使其失效,因此拓扑变化后需要重新运行。
  • 视口 EEVEE 与 Cycles:遮罩完全相同(未使用 Bevel/Pointiness/AO 着色节点,因为它们仅适用于 Cycles 或依赖屏幕空间)。