Skip to main content
skill CX Codex

substance-3d-texturing — Claude Code skill: PBR texturing and export

A skill for Substance 3D Painter work: PBR material authoring, texture export for Three.js, Babylon.js, Unity and Unreal, plus batch export through the Python API.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add freshtechbro/claudedesignskills --skill substance-3d-texturing -a claude-code
Open on GitHub

What substance-3d-texturing does

The skill lays out the metallic/roughness pipeline: which channels a material needs (baseColor, normal, metallic, roughness, AO, height, emissive, opacity) and how they get packed on export. For web engines the baseline is the PBR Metallic Roughness preset, which produces MyAsset_baseColor.png, MyAsset_normal.png and a shared MyAsset_metallicRoughness.png with roughness in green and metallic in blue.

Manual export runs through File → Export Textures. The skill also covers Python API automation: a script builds a config with the output path, PNG 8-bit, infinite padding and sizeLog2, loops over every texture set and calls export_project_textures. Resolution can be overridden per asset — 2048 for a hero, 512 for a background prop. There is a custom preset example that writes metallic and roughness as separate files instead of a packed map.

The advice is to start at 1024×1024 and scale up only where texture detail is actually visible. That matters for web builds: a 4096 map on a background prop costs memory and load time while looking the same on screen. The source text is cut off, so some custom preset examples are missing from it.

What it helps with

  • author a PBR material for a game or web asset
  • export textures from Substance 3D Painter for Three.js or Babylon.js
  • write a Python API script for batch export
  • pick a texture resolution for a specific asset
  • build a custom preset with separate metallic and roughness maps

Example prompts for the agent

  • Author a PBR material for this asset and export the textures for Three.js
  • Write a Substance Painter Python API script that batch-exports every texture set at 1024
  • Build a custom preset that writes metallic and roughness as separate files

How to install substance-3d-texturing

1Skills CLI (Vercel)

npx skills add freshtechbro/claudedesignskills --skill substance-3d-texturing -a claude-code

2Manually: put the files in place

~/.claude/skills/substance-3d-texturing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/substance-3d-texturing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about substance-3d-texturing

How do I install substance-3d-texturing in Claude?

Run npx skills add freshtechbro/claudedesignskills --skill substance-3d-texturing -a claude-code. The skill file then lives at ~/.claude/skills/substance-3d-texturing/SKILL.md.

What does substance-3d-texturing do?

It covers PBR texture work in Substance 3D Painter: material channels, export presets for web and game engines, resolution choices and batch export via the Python API.

Which engines can use the exported textures?

Three.js, Babylon.js, Unity and Unreal. For web engines the baseline preset is PBR Metallic Roughness, which is also the glTF standard.

Source text

SKILL.md · MIT
---
name: substance-3d-texturing
description: Comprehensive skill for Adobe Substance 3D Painter texturing and material creation workflow. Use this skill when creating PBR materials, exporting textures for web/game engines, optimizing 3D assets for real-time rendering, or automating texture workflows. Triggers on tasks involving Substance 3D Painter, PBR texturing, material creation, texture export for Three.js, Babylon.js, Unity, Unreal, glTF optimization, or Python API automation. Creates optimized textures for threejs-webgl, react-three-fiber, and babylonjs-engine materials.
---

# Substance 3D Texturing

## Overview

Master PBR (Physically Based Rendering) texture creation and export workflows for web and real-time engines. This skill covers Substance 3D Painter workflows from material creation through web-optimized texture export, with Python automation for batch processing and integration with WebGL/WebGPU engines.

**Key capabilities:**
- PBR material authoring (metallic/roughness workflow)
- Web-optimized texture export (glTF, Three.js, Babylon.js)
- Python API automation for batch export
- Texture compression and optimization for real-time rendering

## Core Concepts

### PBR Workflow

Substance 3D Painter uses the **metallic/roughness** PBR workflow with these core channels:

**Base Texture Maps:**
- `baseColor` (Albedo) - RGB diffuse color, no lighting information
- `normal` - RGB normal map (tangent space)
- `metallic` - Grayscale metalness (0 = dielectric, 1 = metal)
- `roughness` - Grayscale surface roughness (0 = smooth/glossy, 1 = rough/matte)

**Additional Maps:**
- `ambientOcclusion` (AO) - Grayscale cavity/occlusion
- `height` - Grayscale displacement/height
- `emissive` - RGB self-illumination
- `opacity` - Grayscale transparency

### Export Presets

Substance 3D Painter includes built-in export presets for common engines:
- **PBR Metallic Roughness** - Standard glTF/WebGL format
- **Unity HDRP/URP** - Unity pipelines
- **Unreal Engine** - UE4/UE5 format
- **Arnold (AiStandard)** - Renderer-specific

For web engines, **PBR Metallic Roughness** is the universal standard.

### Texture Resolution

Common resolutions for web (powers of 2):
- 512×512 - Low detail props, mobile
- 1024×1024 - Standard props, characters
- 2048×2048 - Hero assets, close-ups
- 4096×4096 - Showcase quality (use sparingly)

**Web optimization rule:** Start at 1024×1024, scale up only when texture detail is visible.

## Common Patterns

### 1. Basic Web Export (Three.js/Babylon.js)

Manual export workflow for single texture set:

**Steps:**
1. **File → Export Textures**
2. **Select preset:** "PBR Metallic Roughness"
3. **Configure export:**
   - Output directory: Choose target folder
   - File format: PNG (8-bit) for web
   - Padding: "Infinite" (prevents seams)
   - Resolution: 1024×1024 (adjust per asset)
4. **Export**

**Result files:**
```
MyAsset_baseColor.png
MyAsset_normal.png
MyAsset_metallicRoughness.png  // Packed: R=nothing, G=roughness, B=metallic
MyAsset_emissive.png           // Optional
```

**Three.js usage:**
```javascript
import * as THREE from 'three';

const textureLoader = new THREE.TextureLoader();

const material = new THREE.MeshStandardMaterial({
  map: textureLoader.load('MyAsset_baseColor.png'),
  normalMap: textureLoader.load('MyAsset_normal.png'),
  metalnessMap: textureLoader.load('MyAsset_metallicRoughness.png'),
  roughnessMap: textureLoader.load('MyAsset_metallicRoughness.png'),
  aoMap: textureLoader.load('MyAsset_ambientOcclusion.png'),
});
```

### 2. Batch Export with Python API

Automate export for multiple texture sets:

```python
import substance_painter.export
import substance_painter.resource
import substance_painter.textureset

# Define export preset
export_preset = substance_painter.resource.ResourceID(
    context="starter_assets",
    name="PBR Metallic Roughness"
)

# Configure export for all texture sets
config = {
    "exportShaderParams": False,
    "exportPath": "C:/export/web_textures",
    "defaultExportPreset": export_preset.url(),
    "exportList": [],
    "exportParameters": [{
        "parameters": {
            "fileFormat": "png",
            "bitDepth": "8",
            "dithering": True,
            "paddingAlgorithm": "infinite",
            "sizeLog2": 10  // 1024×1024
        }
    }]
}

# Add all texture sets to export list
for texture_set in substance_painter.textureset.all_texture_sets():
    config["exportList"].append({
        "rootPath": texture_set.name()
    })

# Execute export
result = substance_painter.export.export_project_textures(config)

if result.status == substance_painter.export.ExportStatus.Success:
    for stack, files in result.textures.items():
        print(f"Exported {stack}: {len(files)} textures")
else:
    print(f"Export failed: {result.message}")
```

### 3. Resolution Override per Asset

Export different resolutions for different assets (e.g., hero vs. background):

```python
config = {
    "exportPath": "C:/export",
    "defaultExportPreset": export_preset.url(),
    "exportList": [
        {"rootPath": "HeroCharacter"},   # Will use 2048 (override below)
        {"rootPath": "BackgroundProp"}   # Will use 512 (override below)
    ],
    "exportParameters": [
        {
            "filter": {"dataPaths": ["HeroCharacter"]},
            "parameters": {"sizeLog2": 11}  # 2048×2048
        },
        {
            "filter": {"dataPaths": ["BackgroundProp"]},
            "parameters": {"sizeLog2": 9}   # 512×512
        }
    ]
}
```

### 4. Custom Export Preset (Separate Channels)

Create custom preset to export metallic and roughness as separate files:

```python
custom_preset = {
    "exportPresets": [{
        "name": "WebGL_Separated",
        "maps": [
            {
                "fileName": "$textureSet_baseColor",
                "channels": [
                    {"destChannel": "R", "srcChannel": "R", "srcMapType": "documentMap", "srcMapName": "baseColor"},
                    {"destChannel": "G", "srcChannel": "G", "srcMapType": "documentMap", "srcMapName": "baseColor"},
                    {"destChannel": "B", "srcChannel": "B", "srcMapType": "documentMap", "srcMapName": "baseColor"}
                ]
            },
            {
                "fileName": "$textureSet_normal",
                "channels": [
                    {"destChannel": "R", "srcChannel": "R", "srcMapType": "documentMap", "srcMapName": "normal"},
                    {"destChannel": "G", "srcChannel": "G", "srcMapType": "documentMap", "srcMapName": "normal"},
                    {"destChannel": "B", "srcChannel": "B", "srcMapType": "documentMap", "srcMapName": "normal"}
                ]
            },
            {
                "fileName": "$textureSet_metallic",
                "channels": [
                    {"destChannel": "R", "srcChannel": "R", "srcMapType": "documentMap", "srcMapName": "metallic"}
                ],
                "parameters": {"fileFormat": "png", "bitDepth": "8"}
            },
            {
                "fileName": "$textureSet_roughness",
                "channels": [
                    {"destChannel": "R", "srcChannel": "R", "srcMapType": "documentMap", "srcMapName": "roughness"}
                ],
                "parameters": {"fileFormat": "png", "bitDepth": "8"}
            }
        ]
    }]
}

config = {
    "exportPath": "C:/export",
    "exportPresets": custom_preset["exportPresets"],
    "exportList": [{"rootPath": "MyAsset", "exportPreset": "WebGL_Separated"}]
}
```

### 5. Mobile-Optimized Export

Aggressive compression for mobile WebGL:

```python
mobile_config = {
    "exportPath": "C:/export/mobile",
    "defaultExportPreset": export_preset.url(),
    "exportList": [{"rootPath": texture_set.name()}],
    "exportParameters": [{
        "parameters": {
            "fileFormat": "jpeg",        # JPEG for baseColor (lossy but smaller)
            "bitDepth": "8",
            "sizeLog2": 9,               # 512×512 maximum
            "paddingAlgorithm": "infinite"
        }
    }, {
        "filter": {"outputMaps": ["$textureSet_normal", "$textureSet_metallicRoughness"]},
        "parameters": {
            "fileFormat": "png"          # PNG for data maps (need lossless)
        }
    }]
}
```

**Post-export:** Use tools like `pngquant` or `tinypng` for further compression.

### 6. glTF/GLB Integration

Export textures for glTF 2.0 format:

```python
gltf_config = {
    "exportPath": "C:/export/gltf",
    "defaultExportPreset": substance_painter.resource.ResourceID(
        context="starter_assets",
        name="PBR Metallic Roughness"
    ).url(),
    "exportList": [{"rootPath": texture_set.name()}],
    "exportParameters": [{
        "parameters": {
            "fileFormat": "png",
            "bitDepth": "8",
            "sizeLog2": 10,              # 1024×1024
            "paddingAlgorithm": "infinite"
        }
    }]
}

# After export, reference in glTF:
# {
#   "materials": [{
#     "name": "Material",
#     "pbrMetallicRoughness": {
#       "baseColorTexture": {"index": 0},
#       "metallicRoughnessTexture": {"index": 1}
#     },
#     "normalTexture": {"index": 2}
#   }]
# }
```

### 7. Event-Driven Export Plugin

Auto-export on save using Python plugin:

```python
import substance_painter.event
import substance_painter.export
import substance_painter.project

def auto_export(e):
    if not substance_painter.project.is_open():
        return

    config = {
        "exportPath": substance_painter.project.file_path().replace('.spp', '_textures'),
        "defaultExportPreset": substance_painter.resource.ResourceID(
            context="starter_assets", name="PBR Metallic Roughness"
        ).url(),
        "exportList": [{"rootPath": ts.name()} for ts in substance_painter.textureset.all_texture_sets()],
        "exportParameters": [{
            "parameters": {"fileFormat": "png", "bitDepth": "8", "sizeLog2": 10}
        }]
    }

    substance_painter.export.export_project_textures(config)
    print("Auto-export completed")

# Register event
substance_painter.event.DISPATCHER.connect(
    substance_painter.event.ProjectSaved,
    auto_export
)
```

## Integration Patterns

### Three.js + React Three Fiber

Use exported textures in R3F:

```jsx
import { useTexture } from '@react-three/drei';

function TexturedMesh() {
  const [baseColor, normal, metallicRoughness, ao] = useTexture([
    '/textures/Asset_baseColor.png',
    '/textures/Asset_normal.png',
    '/textures/Asset_metallicRoughness.png',
    '/textures/Asset_ambientOcclusion.png',
  ]);

  return (
    <mesh>
      <boxGeometry />
      <meshStandardMaterial
        map={baseColor}
        normalMap={normal}
        metalnessMap={metallicRoughness}
        roughnessMap={metallicRoughness}
        aoMap={ao}
      />
    </mesh>
  );
}
```

See **react-three-fiber** skill for advanced R3F material workflows.

### Babylon.js PBR Materials

```javascript
import { PBRMaterial, Texture } from '@babylonjs/core';

const pbr = new PBRMaterial("pbr", scene);
pbr.albedoTexture = new Texture("/textures/Asset_baseColor.png", scene);
pbr.bumpTexture = new Texture("/textures/Asset_normal.png", scene);
pbr.metallicTexture = new Texture("/textures/Asset_metallicRoughness.png", scene);
pbr.useRoughnessFromMetallicTextureAlpha = false;
pbr.useRoughnessFromMetallicTextureGreen = true;
pbr.useMetallnessFromMetallicTextureBlue = true;
```

See **babylonjs-engine** skill for advanced PBR workflows.

### GLTF Export Pipeline

1. Export textures from Substance (as above)
2. Export model from Blender with glTF exporter
3. Reference Substance textures in `.gltf` JSON
4. Use `gltf-pipeline` for Draco compression:

```bash
gltf-pipeline -i model.gltf -o model.glb -d
```

See **blender-web-pipeline** skill for complete 3D asset pipeline.

## Performance Optimization

### Texture Size Budget

**Desktop WebGL:** ~100-150MB total texture memory
**Mobile WebGL:** ~30-50MB total texture memory

**Budget per asset:**
- Background/props: 512×512 (1MB per texture × 4 maps = 4MB)
- Standard assets: 1024×1024 (4MB per texture × 4 maps = 16MB)
- Hero assets: 2048×2048 (16MB per texture × 4 maps = 64MB)

### Compression Strategies

1. **JPEG for baseColor** (70-80% quality) - 10× smaller than PNG
2. **PNG-8 for data maps** (normal, metallic, roughness) - lossless required
3. **Basis Universal** (`.basis`) - GPU texture compression (90% smaller)
4. **Texture atlasing** - Combine multiple assets into single texture

### Channel Packing

Pack grayscale maps into RGB channels to reduce texture count:

**Packed ORM (Occlusion-Roughness-Metallic):**
- Red: Ambient Occlusion
- Green: Roughness
- Blue: Metallic

Export in Substance:
```python
orm_map = {
    "fileName": "$textureSet_ORM",
    "channels": [
        {"destChannel": "R", "srcChannel": "R", "srcMapType": "documentMap", "srcMapName": "ambientOcclusion"},
        {"destChannel": "G", "srcChannel": "R", "srcMapType": "documentMap", "srcMapName": "roughness"},
        {"destChannel": "B", "srcChannel": "R", "srcMapType": "documentMap", "srcMapName": "metallic"}
    ]
}
```

### Mipmaps

Always enable mipmaps in engine for textures viewed at distance:

```javascript
// Three.js (automatic)
texture.generateMipmaps = true;

// Babylon.js
texture.updateSamplingMode(Texture.TRILINEAR_SAMPLINGMODE);
```

## Common Pitfalls

### 1. Wrong Color Space for BaseColor

**Problem:** BaseColor exported in linear space looks washed out.

**Solution:** Substance exports baseColor in sRGB by default (correct). Ensure engine uses sRGB:

```javascript
// Three.js
baseColorTexture.colorSpace = THREE.SRGBColorSpace;

// Babylon.js (automatic for albedoTexture)
```

### 2. Normal Map Baking Issues

**Problem:** Normal maps show inverted or incorrect shading.

**Solution:**
- Verify tangent space normal format (DirectX vs. OpenGL Y-flip)
- Substance uses OpenGL (Y+), same as glTF standard
- If using DirectX engine, flip green channel in export

### 3. Metallic/Roughness Channel Order

**Problem:** Metallic/roughness texture has swapped channels.

**Solution:** Default Substance export:
- Blue channel = Metallic
- Green channel = Roughness
- Matches glTF 2.0 specification

### 4. Padding Artifacts at UV Seams

**Problem:** Black or colored lines appear at UV seams.

**Solution:** Set padding algorithm to **"infinite"** in export settings:
```python
"paddingAlgorithm": "infinite"
```

### 5. Oversized Textures for Web

**Problem:** 4K textures cause long load times and memory issues on web.

**Solution:**
- Default to 1024×1024 for web
- Use 2048×2048 only for hero assets viewed close-up
- Implement LOD system with multiple resolution sets

### 6. Missing AO Map in Engine

**Problem:** AO map exported but not visible in engine.

**Solution:**
- Three.js: Requires second UV channel (`geometry.attributes.uv2`)
- Babylon.js: Set `material.useAmbientOcclusionFromMetallicTextureRed = true`
- Alternative: Bake AO into baseColor in Substance

## Resources

See bundled resources for complete workflows:

- **references/python_api_reference.md** - Complete Substance Painter Python API
- **references/export_presets.md** - Built-in and custom export preset catalog
- **references/pbr_channel_guide.md** - Deep dive into PBR texture channels
- **scripts/batch_export.py** - Batch export all texture sets
- **scripts/web_optimizer.py** - Post-process textures for web (resize, compress)
- **scripts/generate_export_preset.py** - Create custom export preset JSON
- **assets/export_templates/** - Pre-configured export presets for Three.js, Babylon.js, Unity

## Related Skills

- **blender-web-pipeline** - Complete 3D model → texture → web pipeline
- **threejs-webgl** - Loading and using PBR textures in Three.js
- **react-three-fiber** - R3F material workflows with Substance textures
- **babylonjs-engine** - Babylon.js PBR material system integration

© freshtechbro · MIT · freshtechbro/claudedesignskills

Similar skills

Everything for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set22

lightweight-3d-effects A skill for decorative 3D elements and micro-interactions: pseudo-3D illustrations, animated backgrounds, tilt on hover. Useful when a landing page needs depth without a full WebGL stack. CX Codex +1 2,600installs babylonjs-engine A skill that walks the agent through Babylon.js: engine setup, cameras, lights and meshes for browser 3D work, so you don't rebuild the API from memory. CX Codex +1 2,500installs pixijs-2d Equips your coding agent with PixiJS patterns for WebGL and WebGPU canvas apps, handling sprite animations, vector graphics, and fast particle systems. CX Codex +1 2,500installs locomotive-scroll This skill guides an agent through Locomotive Scroll setup for smooth scrolling, parallax, and scroll-driven motion. Use it when page elements need viewport tracking or scroll events. CX Codex +1 2,500installs scroll-reveal-libraries Adds lightweight scroll-triggered reveal animations using the AOS library. Useful for marketing pages, documentation, and landing pages that need simple reveal effects. CX Codex +1 2,400installs react-spring-physics A skill for physics-based React animation with React Spring and Popmotion. Useful for gestures, inertia and transitions you can interrupt mid-motion. CX Codex +1 2,400installs playcanvas-engine Guides 3D web app and browser game development using the PlayCanvas WebGL/WebGPU engine. Helps set up ECS architecture, asset loading, and the main rendering loop. CX Codex +1 2,300installs aframe-webxr A skill that gets your agent writing A-Frame scenes in HTML: 3D, VR, AR and 360-degree media with little JavaScript. CX Codex +1 2,300installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor