Open
Description
Your Godot version:
4.4
Issue description:
Since godotengine/godot#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 godotengine/godot#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