godotengine / godotengine/godot-docs

Document writing shaders that work in multiple renderers

Open
#10,204 0 comments 2 reactions 0 assignees View on GitHub
area:manual enhancement topic:shaders
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
4.4
**Issue description:**
Since https://github.com/godotengine/godot/pull/97142 allowed falling back from Vulkan/D3D12/Metal to OpenGL, it is now more expected that rendering, including shaders, works on multiple renderers.

We should document writing shaders that work in multiple renderers, using `OUTPUT_SRGB`, `CLIP_SPACE_FAR`, and/or `CURRENT_RENDERER` (once https://github.com/godotengine/godot/pull/98549 is merged).

This is currently half-documented in two places:
- The NDC change from always using OpenGL NDC in 3.x to sometimes using Vulkan NDC in 4.x is documented in https://docs.godotengine.org/en/latest/tutorials/migrating/upgrading_to_godot_4.html#updating-shaders.
- The existence of Vulkan NDC is mentioned in https://docs.godotengine.org/en/latest/tutorials/shaders/advanced_postprocessing.html, but that page does not describe how to write a shader that works with Compatibility which uses OpenGL NDC.

Changes to make:
- Advanced postprocessing should include a snippet for using `CLIP_SPACE_FAR` to create correct NDCs for all renderers.
- Possibly, some shader page should include a general section on writing shaders that work in all renderers. Possibly, the Renderers page should link to that shader section.

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/latest/tutorials/migrating/upgrading_to_godot_4.html#updating-shaders
https://docs.godotengine.org/en/latest/tutorials/shaders/advanced_postprocessing.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.