4.0 KiB
4.0 KiB
title, type, tags, date
| title | type | tags | date | |||||
|---|---|---|---|---|---|---|---|---|
| Godot Shader Developer Agent Personality | source |
|
2026-04-26 |
Source File
Summary(用中文描述)
- 核心主题:Godot 4 渲染专家 Agent,使用 Godot 着色语言(GLSL-like)编写高性能 2D/3D 视觉效果着色器
- 问题域:Godot 4 的 CanvasItem(2D)和 Spatial(3D)着色器开发、VisualShader 编辑器、后处理、性能优化
- 方法/机制:通过
shader_type声明、uniform 参数暴露、渲染器兼容性检查、纹理采样计数审计实现跨平台视觉效果 - 结论/价值:为 Godot 4 游戏提供创作性正确且性能合规的着色器方案,覆盖 2D 精灵描边、3D 溶解/水面着色、全屏后处理
Key Claims(用中文描述)
- Godot Shader Developer 通过
shader_type+ GLSL-like 语法实现 2D CanvasItem 和 3D Spatial 着色器,在 Forward+ / Mobile / Compatibility 三种渲染器下提供差异化效果 - VisualShader 编辑器适合艺术家快速迭代,代码着色器适合性能关键路径;两者互补而非替代
- 所有 uniform 参数必须附带 hint(
hint_range、source_color、hint_normal等),否则 Inspector 无法正确显示 SCREEN_TEXTURE采样会触发帧缓冲区复制,在移动端每帧 shader 中使用会严重影响性能discard在移动端不透明空间着色器中应替换为 Alpha Scissor,以保证性能合规
Key Quotes
"MANDATORY: Godot's shading language is not raw GLSL — use Godot built-ins (TEXTURE, UV, COLOR, FRAGCOORD) not GLSL equivalents" — Godot 4 着色语言核心规范 "8 texture samples in this fragment is 4 over mobile budget — here's a 4-sample version that looks 90% as good" — 移动端纹理采样性能审计原则 "Use VisualShader for effects artists need to extend — use code shaders for performance-critical or complex logic" — 工具选型原则
Key Concepts
- CanvasItem Shader:Godot 2D/UI 着色器类型,使用
shader_type canvas_item,通过TEXTURE、UV、COLOR内置变量操作精灵和 UI 效果 - Spatial Shader:Godot 3D 世界着色器类型,使用
shader_type spatial,通过ALBEDO、METALLIC、ROUGHNESS、NORMAL_MAP输出变量控制 PBR 材质 - VisualShader:Godot 图形化着色器编辑器,将 GLSL 节点化,支持艺术家快速搭建材质变体;Group 和 Comment 节点用于组织复杂图
- CompositorEffect:Godot 4 Forward+ 渲染器的全屏后处理扩展点,通过 GDScript
extends CompositorEffect实现自定义后处理 Pass - Forward+ Renderer:Godot 4 高端渲染器,支持
DEPTH_TEXTURE、SCREEN_TEXTURE、NORMAL_ROUGHNESS_TEXTURE全部特性 - Mobile Renderer:Godot 4 中端渲染器,避免
discard使用,优先 Alpha Scissor;纹理采样预算严格 - Compatibility Renderer:Godot 4 最广泛支持渲染器,无 compute shader、无
DEPTH_TEXTUREcanvas 采样、无 HDR 纹理
Key Entities
- Godot:Juan Linietsky 和 Ariel Manzur 主导的开源游戏引擎,Godot 4 引入了 Forward+ 渲染器和重构的着色语言
- GLSL:OpenGL 着色语言,Godot 着色语言基于 GLSL 但有自己的内置变量和 API(
texture()vstexture2D())
Connections
- Godot Gameplay Scripter ← collaborates_with ← Godot Shader Developer(Godot 游戏中脚本与着色器协同开发)
- Unity Shader Graph Artist ← compares_to ← Godot Shader Developer(两大主流游戏引擎的着色器方案对比)
- Technical Artist ← overlaps_with ← Godot Shader Developer(两者均涉及渲染技术与美术的桥梁工作)
- Godot Shader Developer ← uses ← VisualShader(VisualShader 作为快速原型工具)
- Godot Shader Developer ← targets ← Forward+ Renderer / Mobile Renderer / Compatibility Renderer(三种渲染器适配)
Contradictions
- 无已知冲突内容。