godot-3d-materials
Expert patterns for Godot 3D PBR materials using StandardMaterial3D including albedo, metallic/roughness workflows, normal maps, ORM texture packing, transparency modes, and shader conversion. Use when creating realistic 3D surfaces, PBR workflows, or material optimization. Trigger keywords: StandardMaterial3D, BaseMaterial3D, albedo_texture, metallic, metallic_texture, roughness, roughness_texture, normal_texture, normal_enabled, orm_texture, transparency, alpha_scissor, alpha_hash, cull_mode, ShaderMaterial, shader parameters.
thedivergentai · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add thedivergentai/GD-Agentic-Skills --skill godot-3d-materials技能说明
name: godot-3d-materials description: "Expert patterns for Godot 3D PBR materials using StandardMaterial3D including albedo, metallic/roughness workflows, normal maps, ORM texture packing, transparency modes, and shader conversion. Use when creating realistic 3D surfaces, PBR workflows, or material optimization. Trigger keywords: StandardMaterial3D, BaseMaterial3D, albedo_texture, metallic, metallic_texture, roughness, roughness_texture, normal_texture, normal_enabled, orm_texture, transparency, alpha_scissor, alpha_hash, cull_mode, ShaderMaterial, shader parameters."
3D Materials
Expert guidance for PBR materials and StandardMaterial3D in Godot.
NEVER Do
- NEVER use separate metallic/roughness/AO textures — Use ORM packing (1 RGB texture with Occlusion/Roughness/Metallic channels) to save texture slots and memory.
- NEVER forget to enable normal_enabled — Normal maps don't work unless you set
normal_enabled = true. Silent failure is common. - NEVER use TRANSPARENCY_ALPHA for cutout materials — Use TRANSPARENCY_ALPHA_SCISSOR or TRANSPARENCY_ALPHA_HASH instead. Full alpha blending is expensive and causes sorting issues.
- NEVER set metallic = 0.5 — Materials are either metallic (1.0) or dielectric (0.0). Values between are physically incorrect except for rust/dirt transitions.
- NEVER use emission without HDR — Emission values > 1.0 only work with HDR rendering enabled in Project Settings.
- NEVER use transparent materials for large environmental surfaces — Transparent objects cannot rely on the Z-buffer for early fragment rejection, resulting in massive overdraw. If only a tiny part of a mesh is transparent, split the mesh into two surfaces: one opaque, one transparent.
- NEVER create hundreds of slightly varied StandardMaterial3D resources if performance is dropping — Godot minimizes GPU state changes by automatically reusing the underlying shader for materials that share the exact same configuration flags (checkboxes). Try to group your material configurations.
- NEVER attempt to fix Z-fighting strictly by moving objects further apart — Floating-point precision degrades over distance. To fix flickering textures, increase your Camera3D's
Nearplane property and decrease theFarproperty to compress the precision range. - NEVER use unique Material resources per MeshInstance3D — This breaks draw call batching. Use 'Instance Uniforms' to vary parameters while keeping a single shared material.
- NEVER mutate a shared Material
.tres/ surface material at runtime — Callduplicate(true)or enable Local To Scene, then assign the unique instance before tweaking parameters. MANDATORY usematerial_fx.gdensure_unique_override()/ overlay helpers for flash/dissolve. - NEVER use Decals on dynamic moving actors without a Cull Mask — Bullet holes should not stick to the player's face as they walk over them. Mask out character layers.
Available Scripts
MANDATORY: Read the appropriate script before implementing the corresponding pattern.
Workflow router (MANDATORY / Do NOT Load)
| Task | Load | Do NOT Load |
|---|---|---|
| StandardMaterial3D / ORM / transparency | pbr_orm_packer.gd, transparency_sorting_fix.gd, material_batcher.gd, material_fx.gd | triplanar_world*.gdshader, vertex_wind_sway.gdshader |
| UV-less terrain / cliffs | triplanar_world.gdshader or triplanar_world_projection.gdshader + pbr_material_builder.gd | Wind sway unless foliage |
| Foliage wind | vertex_wind_sway.gdshader | Triplanar unless rock/terrain also needed |
| Runtime damage / dissolve | MANDATORY material_fx.gd | Editing shared imported materials |
| Instance color/health / texture-array variants | MANDATORY instance_uniform_batching.gdshader | Per-mesh unique StandardMaterial3D copies; body texture-array samples |
| HLOD / distant material simplify | material_batcher.gd (setup_lod_materials) | Alpha-blend distance fade (use Pixel Dither) |
| Organic SSS / rim / clearcoat | organic_material.gd, subsurface_scattering_setup.gd | SSS recipes on Mobile/Compatibility |
Pure StandardMaterial3D albedo/ORM/transparency work: Do NOT Load triplanar, wind, or texture-array shaders.
material_fx.gd
MANDATORY for runtime FX. ensure_unique_override() / overlay flash / scissor dissolve — never tween shared .tres materials.
pbr_material_builder.gd
Runtime PBR material creation with ORM textures and triplanar mapping.
organic_material.gd
Subsurface scattering and rim lighting setup for organic surfaces (skin, leaves). Use for realistic character or vegetation materials.
triplanar_world.gdshader
Triplanar projection shader for terrain without UV mapping. Blends textures based on surface normals. Use for cliffs, caves, or procedural terrain.
pbr_orm_packer.gd
Expert PBR resource utility. Packs Ambient Occlusion, Roughness, and Metallic into a single ORM texture to optimize VRAM and draw calls.
vertex_wind_sway.gdshader
High-performance GPU-driven foliage animation. Uses vertex world coordinates and vertex color weight painting to simulate wind without skeletons.
triplanar_world_projection.gdshader
UV-less environment mapping. Projects textures along X/Y/Z axes for organic blending over complex rocks and terrain.
subsurface_scattering_setup.gd
Configuring realistic organic materials. Covers Skin Mode, Transmittance, and depth scattering settings for Forward+ rendering.
instance_uniform_batching.gdshader
Architecture pattern for high-speed batching. Allows 10,000 meshes to share one
阅读完整来源 ↗