pbr-shading

pbr-shading is a skill for Claude Code, Codex from oframe/ogpu. It costs 96 tokens per session (1,725 once invoked), scanned A, original, Unlicense.

A guide for adding physically based rendering to OGPU WebGPU shaders. Physically based rendering makes surfaces react to light in ways that resemble real materials, while image-based lighting uses environment images to light them.

In plain words
What is it for?
Use it to add metallic and rough materials, environment lighting, or physically based shading while keeping custom vertex effects such as displacement, instancing, or skinning.
Why use it?
It explains which shader code and JavaScript resources must be connected, including the parts that can fail silently.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/oframe/ogpu/pbr-shading
Any agent
npx skills add oframe/ogpu --skill pbr-shading
Clone the repo
git clone --depth 1 https://github.com/oframe/ogpu

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pbr-shading

README.md
[![agentmods](https://agentmods.dev/badge/skills/oframe/ogpu/pbr-shading.svg)](https://agentmods.dev/skills/oframe/ogpu/pbr-shading)
Your own site
<a href="https://agentmods.dev/skills/oframe/ogpu/pbr-shading"><img src="https://agentmods.dev/badge/skills/oframe/ogpu/pbr-shading.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,725 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00096 $0.01725
Opus 5 $0.00048 $0.00863
Sonnet 5 $0.00019 $0.00345
Haiku 4.5 $0.00010 $0.00172

Measured 3d ago against content hash df7855f127dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pbr-shading scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/pbr-shading/SKILL.md · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Fold PBR shading into a RenderPipeline

The engine has a complete PBR implementation in src/modules/pbr/pbr.wgsl (metallic-roughness + IBL: prefiltered specular cube, SH irradiance, split-sum BRDF LUT). There is no runtime shader-chunk system — integration means copying the right WGSL pieces into the target shader and wiring the right JS resources. This skill tells you which pieces, in what order, and what breaks silently if you get it wrong.

Decide the integration shape

  1. Stock shading, standard geometry → use @modules/pbr/pbr.wgsl?raw directly as the pipeline code. No WGSL editing. Works when the mesh just needs to look PBR-lit and the vertex stage is plain MVP transform.
  2. Custom shader keeps its vertex work (displacement, instancing, skinning, procedural normals) → fold the PBR fragment stage into the user's WGSL. Read references/wgsl-folding.md for exactly which blocks to copy and how to splice them.

Either way the JS wiring (IBL resources, fallback textures, bind group) is the same — references/js-wiring.md has the full copy-paste blocks.

Workflow

  1. Read the target pipeline/shader and its geometry. Confirm attribute ORDER — webgpu-utils assigns @location by declaration order in the data object, not by name. pbr.wgsl expects position (loc 0), normal (loc 1), uv (loc 2). A geometry declared {position, normal, texcoord} works (third attr lands on loc 2 regardless of name); {position, uv, normal} silently shades garbage.
  2. Wire IBL resources (specular cube + SH buffer + BRDF LUT + sampler). Copy initIBL() from examples/gltf/GLTF.js or examples/pbrshader/PBRShader.js — they are the canonical block. loadIBLCubeMap returns mipLevels; pass it back to the pipeline as constants: { roughnessLevels: ibl.mipLevels } or the roughness→lod mapping is wrong. Default environment assets: ./assets/pbr/artistworkshop_oct.exr (specular env) + ./assets/pbr/artistworkshop_sh.json (precomputed 9-coeff diffuse-irradiance SH, consumed by loadSphericalHarmonics).
  3. Resolve material textures. For every map the user did NOT provide, bind a 2×2 solid fallback instead — never leave a binding empty (pipeline creation throws) and never branch the shader on "has texture" per-map (the material factors already make white/black fallbacks behave as pass-throughs):
    • white → tMap, tMetallicRoughness, tOcclusion, tOpacity (sample = 1.0, so the *Factor uniforms fully control the material and opacity stays fully opaque)
    • black → tEmissive (no emission), tNormal (paired with hasNormalMap: 0 so the shader keeps the geometric normal — the normal map path uses screen-space derivatives and must not run on garbage data)
  4. Set ALL Material factors once at init — they live in a separate uniform block (binding 12), not the per-frame Uniforms, so they aren't written by Mesh.draw; you own that buffer. webgpu-utils zero-initializes, and a zeroed baseColorFactor renders black. Defaults that mean "plain mid-grey dielectric": see references/js-wiring.md.
  5. Create the bind group with the device — RenderPipeline exposes pipeline.bindGroupLayout(group) and pipeline.defs, but owns no uniform buffer or createBindGroup helper. With stock pbr.wgsl the layout is fixed: 0 per-frame Uniforms (the Mesh's buffer), 1 specular cube view, 2 SH buffer, 3 BRDF LUT view, 4 iblSampler (linear, mipmap linear, clamp), 5 tMap, 6 tMetallicRoughness, 7 tNormal, 8 tOcclusion, 9 tEmissive, 10 materialSampler (linear, repeat), 11 tOpacity, 12 Material buffer.
  6. Verify with npm run build (pipeline construction / reflection errors are runtime, but build catches JS/import mistakes) and npm run validate:shaders for folded WGSL. If a dev server check is possible, load the example view and check the console for device validation errors.

Read the full file on GitHub · 105 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 105 lines · 96 tokens per session scan A df7855f127dd

Subscribe to this mod's changes

pbr-shading is a skill published in the GitHub repository oframe/ogpu (139 stars, last pushed 22d ago), licensed Unlicense. It adds 96 tokens to every session and 1,725 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

particles

Use this skill when creating particle effects in Phaser 4. Covers ParticleEmitter, emission zones, death zones, particle properties, textures, gravity wells, and particle movement. Triggers on: particles, emitter, particle effect, explosion, fire, smoke.

phaserjs/phaser · 53 tokens

web-games

Web browser game development principles. Framework selection, WebGPU, optimization, PWA.

vudovn/ag-kit · 20 tokens

develop-web-game

Use when Codex is building or iterating on a web game (HTML/JS) and needs a reliable development + testing loop: implement small changes, run a Playwright-based test script with short input bursts and intentional pauses, inspect screenshots/text, and review console errors with rendergametotext.

netease-youdao/LobsterAI · 64 tokens

gameobject-component-destroy

Destroy one or more Components from a target GameObject. Missing (null) components are skipped — they cannot be destroyed. Use 'gameobject-find' and 'gameobject-component-get' to identify the components first.

IvanMurzak/Unity-MCP · 49 tokens

unity

Compile, test, and drive Unity for this repo's C# packages (unity/core, jint, quickjs, clearscript) and the two Unity projects (tests/, kitchen-sink/). Use when a change touches C# under unity/, when Unity test results are needed, when a rendering snapshot has to be checked or regenerated, or when the app has to be…

ReactUnity/core · 108 tokens

writing-modpack-changelog

Use when cutting a modpack release. Creates /docs/release-changelog.md if absent; appends a new version section with grouped changes. Triggers - 'cut a release', 'release notes', 'changelog', 'v1.2.3 changes', 'what changed since last version'.

hashgraph-online/awesome-codex-plugins · 69 tokens