Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Polyhaven Material Swap

ASecurity

Cycle through multiple PolyHaven materials on a product and render each variant. Great for showing color/finish options. Trigger when asked to show material variants, swap textures, create color options, show finish comparisons, or render product in different materials.

5 stars
0 votes
0 copies
0 views
Added 9/22/2026
ai-agentspythonrustgonodesecurity

Works with

mcp

Security Analysis

A100/100

Scanned 9/22/2026

$npx -y skills add MAX-786/claude-3d-harness --skill polyhaven-material-swap --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Polyhaven Material Swap?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Polyhaven Material Swap
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/max-786-polyhaven-material-swap/badge)](https://www.skillsdirectory.com/skills/max-786-polyhaven-material-swap)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: polyhaven-material-swap
description: Cycle through multiple PolyHaven materials on a product and render each variant. Great for showing color/finish options. Trigger when asked to show material variants, swap textures, create color options, show finish comparisons, or render product in different materials.
---

# PolyHaven Material Swap

Applies multiple PolyHaven PBR textures to the same object one by one and renders each — perfect for showing product finish variants (matte black, glossy white, brushed metal, marble, etc.).

> Adapted for claude-3d-harness. The original ran a bundled Node script that opened Blender's add-on socket itself and
> sent it Python built from command-line text; it also switched Blender's Cycles device preferences for the whole
> machine. The same steps now go through the MCP server, and the preferences are left alone. See
> `docs/security-review.md`.

## Parameters

| Parameter | Description | Default |
|-----------|-------------|---------|
| `object` | Blender object name | **required** |
| `textures` | PolyHaven texture IDs | **required** (or use a preset) |
| `output` | Folder for the rendered images | `<JOB_DIR>/variants` |
| `preset` | Texture set: metals, woods, stones, fabrics | none |
| `resolution` | Texture resolution: 1k, 2k | `2k` |
| `render_width` / `render_height` | Render size | `1920` x `1080` |
| `samples` | Render samples | `64` |

## Presets

- **metals** — brushed_metal, rusty_metal, painted_metal_02, corrugated_iron
- **woods** — wood_cabinet_worn_long, plywood, bark_brown_02, wood_floor
- **stones** — marble_01, concrete_wall_003, rock_face, gravel_floor_02
- **fabrics** — fabric_pattern_07, leather_red_02, denim_fabric, burlap_01

## Flow

### Step 1: Remember what will change, then set up the render

```python
import bpy

OBJECT = "<object name>"
scene = bpy.context.scene
r = scene.render

# So that step 4 can put everything back
scene["_swap_restore"] = {
    "engine": r.engine, "samples": scene.cycles.samples, "denoise": scene.cycles.use_denoising,
    "res_x": r.resolution_x, "res_y": r.resolution_y, "format": r.image_settings.file_format,
    "filepath": r.filepath,
}
obj = bpy.data.objects.get(OBJECT)
if obj and obj.data.materials and obj.data.materials[0]:
    scene["_original_mat"] = obj.data.materials[0].name

r.engine = 'CYCLES'
scene.cycles.samples = 64
scene.cycles.use_denoising = True
r.resolution_x, r.resolution_y = 1920, 1080
r.image_settings.file_format = 'PNG'

# A camera only if the scene has none
if scene.camera is None:
    import mathutils
    bpy.ops.object.camera_add(location=(2.5, -2.5, 1.5))
    cam = bpy.context.active_object
    cam.name = 'Variants_Camera'
    scene.camera = cam
    direction = mathutils.Vector((0, 0, 0)) - cam.location
    cam.rotation_euler = direction.to_track_quat('-Z', 'Y').to_euler()
```

### Step 2: For each texture — download, apply, render

`download_polyhaven_asset(asset_id=<texture>, asset_type="textures", resolution=<resolution>, file_format="jpg")`
returns the material name. If a download fails, skip that texture and say so.

```python
import bpy

OBJECT = "<object name>"
MATERIAL = "<material name the download returned>"
OUT = "<JOB_DIR>/variants/<texture id>.png"

obj = bpy.data.objects.get(OBJECT)
mat = bpy.data.materials.get(MATERIAL)
if obj and mat:
    if obj.data.materials:
        obj.data.materials[0] = mat
    else:
        obj.data.materials.append(mat)
    bpy.context.scene.render.filepath = OUT
    bpy.ops.render.render(write_still=True)
```

### Step 3: Look at every render

Read each image before reporting: a variant that rendered black or untextured is a failed variant.

### Step 4: Put the scene back

```python
import bpy

OBJECT = "<object name>"
scene = bpy.context.scene
obj = bpy.data.objects.get(OBJECT)

orig_name = scene.get("_original_mat")
if obj and orig_name:
    mat = bpy.data.materials.get(orig_name)
    if mat and obj.data.materials:
        obj.data.materials[0] = mat

saved = scene.get("_swap_restore")
if saved:
    r = scene.render
    r.engine = saved["engine"]
    scene.cycles.samples = saved["samples"]
    scene.cycles.use_denoising = saved["denoise"]
    r.resolution_x, r.resolution_y = saved["res_x"], saved["res_y"]
    r.image_settings.file_format = saved["format"]
    r.filepath = saved["filepath"]
for key in ("_swap_restore", "_original_mat"):
    if key in scene:
        del scene[key]
```

Attribution

MAX-786MAX-786
View sourceSee grades on GitHubMore from MAX-786 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →