module CrShader::Docs::C_EDITOR_TOOLING::B_SHADER_STUDIO

Overview

Godot 4.8 Shader Editor Tab, New Shader (Ctrl+N) & Templates

CRShader integrates directly into Godot 4.8's built-in bottom Shader Editor dock and Create Shader dialog (Ctrl+N) via CrShader::ShaderCreateDialogIntegration, CrShader::ShaderEditorIntegration, and CrShader::CrShaderTabEditor, while retaining CrShader::CrShaderStudioPanel for standalone showcase apps. Pressing Ctrl+N in the Shader Editor (or choosing New Shader... in the FileSystem dock or a ShaderMaterial Inspector) exposes CRShader right inside the Type: dropdown alongside 30+ curated templates across all 7 shader modes.

Executive Summary & Key Topics

Topic Method / Anchor Description
Ctrl+N New Shader Dialog & Built-in Templates .topic_01_dock_layout Creating .crshader files with curated templates directly from Godot's Create Shader dialog.
Multi-Target emit_target Compilation & Live Sync .topic_02_live_recompilation Automatic syncing of .gdshader, .gdshaderinc, and .glsl outputs on save.

Related Guides & Source References

Defined in:

docs/c_editor_tooling/b_shader_studio.cr

Class Method Summary

Class Method Detail

def self.topic_01_dock_layout : Nil #

Ctrl+N New Shader Dialog & Built-in Templates: Creating .crshader files with curated templates directly from Godot's Create Shader dialog.

When res://addons/crshader/plugin.cfg is enabled (either standalone or compiled into a single-GC Lapis host via require "crshader/addon"), CrShaderPlugin augments Godot's Shader Editor and Create Shader dialog:

  1. Native Ctrl+N (Create Shader) Integration: Selecting CRShader in Type: unlocks all 7 modes (Spatial, Canvas Item, Particles, Sky, Fog, Compute, and Shader Include) and populates Template: with over 30 ready-to-compile templates (Toon/Cel, Dissolve & Hit Flash, Foliage Wind, Water Waves, Hologram Shield, Triplanar, 2D Sprite Outline, UI SDF Card, Screen Post-Process, CRT Dither, Vortex Particles, Sunset Starfield, Rolling Mist, Compositor Outlines, Compute Particle Sim, and OOP .gdshaderinc libraries).
  2. In-Place .crshader Tabs & Template Picker: Opening or creating a .crshader resource upgrades its Shader Editor tab slot with CrShaderTabEditor, featuring a 📋 Template... picker, 🧩 Insert Trait... dropdown, syntax highlighting, and live split preview.
  3. Toolbar Menu & Companion Jump: Adds a 🔮 CRShader dropdown (➕ New CRShader..., 📋 New CRShader from Template, project .crshader files, and bulk compile) plus a contextual 🔮 Edit <name>.crshader button whenever viewing a generated .gdshader, .gdshaderinc, or .glsl file.

Working Examples

emit_target "outline.gdshader", pattern_default_enabled: false
emit_target "pattern_replace.gdshader", pattern_default_enabled: true

shader_type :spatial
render_mode :unshaded

def self.topic_02_live_recompilation : Nil #

Multi-Target emit_target Compilation & Live Sync: Automatic syncing of .gdshader, .gdshaderinc, and .glsl outputs on save.

Pressing Ctrl+S or clicking Compile & Sync in CrShaderTabEditor (or saving via ResourceSaver) invokes Compiler#compile_emit_targets, writing every declared emit_target file to disk and updating any cached Godot::Shader instances in memory for instant viewport hot-reload.