mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Document Depth Test and Stencil features in Standard Material 3D and Spatial shader
Co-authored-by: Qbieshay <cislaghi.ilaria@gmail.com>
This commit is contained in:
@@ -36,6 +36,11 @@ For visual examples of these render modes, see :ref:`Standard Material 3D and OR
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **depth_test_disabled** | Disable depth testing. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **depth_test_default** | Depth test will discard the pixel if it is behind other pixels. |
|
||||
| | In Forward+ only, the pixel is also discarded if it's at the exact same depth as another pixel. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **depth_test_inverted** | Depth test will discard the pixel if it is in front of other pixels. Useful for stencil effects. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **sss_mode_skin** | Subsurface Scattering mode for skin (optimizes visuals for human skin, e.g. boosted red channel). |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **cull_back** | Cull back-faces (default). |
|
||||
@@ -91,6 +96,58 @@ For visual examples of these render modes, see :ref:`Standard Material 3D and OR
|
||||
| **fog_disabled** | Disable receiving depth-based or volumetric fog. Useful for ``blend_add`` materials like particles. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Stencil modes
|
||||
-------------
|
||||
|
||||
.. note::
|
||||
|
||||
Stencil support is experimental, use at your own risk.
|
||||
We will try to not break compatibility as much as possible,
|
||||
but if significant flaws are found in the API, it may change
|
||||
in the next minor version.
|
||||
|
||||
Stencil operations are a set of operations that allow writing to
|
||||
an efficient buffer in an hardware-accelerated manner.
|
||||
This is generally used to mask in or out parts of the scene.
|
||||
|
||||
Some of the most well-known uses are:
|
||||
|
||||
- Outlines: Mask out the inner mesh that is being outlined to avoid inner outlines.
|
||||
- X-Ray: Display a mesh behind other objects.
|
||||
- Portals: Draw geometry that is normally "impossible" (non-Euclidian) by masking objects.
|
||||
|
||||
.. note::
|
||||
|
||||
You can only read from the stencil buffer in the transparent pass.
|
||||
Any attempt to read in the opaque pass will fail, as it's currently not supported behavior.
|
||||
|
||||
Note that for compositor effects, the main renderer's stencil buffer can't be copied
|
||||
to a custom texture.
|
||||
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Stencil mode | Description |
|
||||
+===============================+======================================================================================================+
|
||||
| **read** | Read from the stencil buffer. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **write** | Write reference value to the stencil buffer. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **write_if_depth_fail** | Write reference value to the stencil buffer if the depth test fails. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **compare_always** | Always pass stencil test. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **compare_equal** | Pass stencil test if the reference value is equal to the stencil buffer value. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **compare_not_equal** | Pass stencil test if the reference value is not equal to the stencil buffer value. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **compare_less** | Pass stencil test if the reference value is less than the stencil buffer value. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **compare_less_or_equal** | Pass stencil test if the reference value is less than or equal to the stencil buffer value. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **compare_greater** | Pass stencil test if the reference value is greater than the stencil buffer value. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
| **compare_greater_or_equal** | Pass stencil test if the reference value is greater than or equal to the stencil buffer value. |
|
||||
+-------------------------------+------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Built-ins
|
||||
---------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user