Ver código fonte

Merge pull request #10248 from tetrapod00/advanced-postprocessing-43

[4.3] Add multiple renderer support to Advanced Postprocessing
Max Hilbrunner 9 meses atrás
pai
commit
cf7c6547e5
1 arquivos alterados com 11 adições e 5 exclusões
  1. 11 5
      tutorials/shaders/advanced_postprocessing.rst

+ 11 - 5
tutorials/shaders/advanced_postprocessing.rst

@@ -108,11 +108,6 @@ from ``0.0`` to ``1.0`` in the ``z`` direction when using the Vulkan backend.
 Reconstruct the NDC using ``SCREEN_UV`` for the ``x`` and ``y`` axis, and
 the depth value for ``z``.
 
-.. note::
-
-    This tutorial assumes the use of the Vulkan renderer, which uses NDCs with a Z-range
-    of ``[0.0, 1.0]``. In contrast, OpenGL uses NDCs with a Z-range of ``[-1.0, 1.0]``.
-
 .. code-block:: glsl
 
   void fragment() {
@@ -120,6 +115,17 @@ the depth value for ``z``.
     vec3 ndc = vec3(SCREEN_UV * 2.0 - 1.0, depth);
   }
 
+.. note::
+
+  This tutorial assumes the use of the Forward+ or Mobile renderers, which both
+  use Vulkan NDCs with a Z-range of ``[0.0, 1.0]``. In contrast, the Compatibility
+  renderer uses OpenGL NDCs with a Z-range of ``[-1.0, 1.0]``. For the Compatibility
+  renderer, replace the NDC calculation with this instead:
+
+  .. code-block:: glsl
+
+    vec3 ndc = vec3(SCREEN_UV, depth) * 2.0 - 1.0;
+
 Convert NDC to view space by multiplying the NDC by ``INV_PROJECTION_MATRIX``.
 Recall that view space gives positions relative to the camera, so the ``z`` value will give us
 the distance to the point.