Add back information about per-vertex shading (#10281)

* Add back information about per-vertex shading

---------

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
tetrapod
2024-11-18 20:06:54 +01:00
committed by GitHub
co-authored by Hugo Locurcio
parent bed807600b
commit 5bad2a6282
5 changed files with 29 additions and 23 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

+28 -20
View File
@@ -244,34 +244,42 @@ Shading
Shading mode Shading mode
~~~~~~~~~~~~ ~~~~~~~~~~~~
Godot has a more or less uniform cost per pixel thanks to the depth pre-pass. Materials support three shading modes: **Per-Pixel**, **Per-Vertex**, and
All lighting calculations are made by running the lighting shader on every **Unshaded**.
pixel.
As these calculations are costly, performance can be brought down considerably .. figure:: img/standard_material_shading_modes.webp
in some corner cases such as drawing several layers of transparency (which is :align: center
common in particle systems). Switching to the **Unshaded** shading mode may help improve :alt: Three spheres showing the Per-Pixel, Per-Vertex, and Unshaded modes.
performance in these cases, especially when the camera is close to particles.
Additionally, on low-end or mobile devices, switching to unshaded rendering The **Per-Pixel** shading mode calculates lighting for each pixel, and is a good
can considerably increase rendering performance. fit for most use cases. However, in some cases you may want to increase
performance by using another shading mode.
.. image:: img/spatial_material26.png The **Per-Vertex** shading mode, often called "vertex shading" or "vertex lighting",
instead calculates lighting once for each vertex, and interpolates the result
between each pixel.
Keep in mind that when unshaded rendering is enabled, lights will not affect the On low-end or mobile devices, using per-vertex lighting can considerably increase
material at all. rendering performance. When rendering several layers of transparency,
such as when using particle systems, using per-vertex shading can improve
performance, especially when the camera is close to particles.
.. UPDATE: Not implemented. When per-vertex shading is implemented, remove this You can also use per-vertex lighting to achieve a retro look.
.. note and remove this comment.
.. note:: .. figure:: img/standard_material_shading_modes_textured.webp
:align: center
:alt: Two cubes with a brick texture, one shaded and one unshaded.
Texture from `AmbientCG <https://ambientcg.com/view?id=Bricks051>`__
**Per-Vertex** shading is listed as an option in the shading mode property. The **Unshaded** shading mode does not calculate lighting at all. Instead, the
However, per-vertex shading is currently unimplemented and will act **Albedo** color is output directly. Lights will not affect the material at all,
identical to per-pixel shading. and unshaded materials will tend to appear considerably brighter than shaded
materials.
Support for per-vertex shading is planned to be reimplemented in a future Rendering unshaded is useful for some specific visual effects. If maximum
Godot release. performance is needed, it can also be used for particles, or low-end or
mobile devices.
Diffuse Mode Diffuse Mode
~~~~~~~~~~~~ ~~~~~~~~~~~~
+1 -3
View File
@@ -154,9 +154,7 @@ Pay attention to the additional vertex processing required when using:
- Skinning (skeletal animation) - Skinning (skeletal animation)
- Morphs (shape keys) - Morphs (shape keys)
- Vertex-lit objects (common on mobile)
.. UPDATE: Not implemented in Godot 4.x yet. Uncomment when this is implemented.
- Vertex-lit objects (common on mobile)
Pixel/fragment shaders and fill rate Pixel/fragment shaders and fill rate
------------------------------------ ------------------------------------