diff --git a/tutorials/assets_pipeline/importing_images.rst b/tutorials/assets_pipeline/importing_images.rst index 34934d7b0ca..c682a99ca72 100644 --- a/tutorials/assets_pipeline/importing_images.rst +++ b/tutorials/assets_pipeline/importing_images.rst @@ -413,8 +413,9 @@ displayed correctly: - In 2D, a :ref:`class_CanvasItemMaterial` will need to be created and configured to use the **Premul Alpha** blend mode on CanvasItems that use this texture. -- In 3D, there is no support for premultiplied alpha blend mode yet, so this - option is only suited for 2D. +- In 3D, a :ref:`class_BaseMaterial3D` will need to be created and configured to use the **Premul Alpha** + blend mode on materials that use this texture. In :ref:`custom spatial shaders `, + ``render_mode blend_premul_alpha;`` should be used. Process > Normal Map Invert Y ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tutorials/shaders/shader_reference/spatial_shader.rst b/tutorials/shaders/shader_reference/spatial_shader.rst index 1e030dd1723..00f83139907 100644 --- a/tutorials/shaders/shader_reference/spatial_shader.rst +++ b/tutorials/shaders/shader_reference/spatial_shader.rst @@ -22,6 +22,8 @@ Render modes +-------------------------------+------------------------------------------------------------------------------------------------------+ | **blend_mul** | Multiplicative blend mode. | +-------------------------------+------------------------------------------------------------------------------------------------------+ +| **blend_premul_alpha** | Premultiplied alpha blend mode (fully transparent = add, fully opaque = mix). | ++-------------------------------+------------------------------------------------------------------------------------------------------+ | **depth_draw_opaque** | Only draw depth for opaque geometry (not transparent). | +-------------------------------+------------------------------------------------------------------------------------------------------+ | **depth_draw_always** | Always draw depth (opaque and transparent). | @@ -32,7 +34,7 @@ Render modes +-------------------------------+------------------------------------------------------------------------------------------------------+ | **depth_test_disabled** | Disable depth testing. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **sss_mode_skin** | Subsurface Scattering mode for skin. | +| **sss_mode_skin** | Subsurface Scattering mode for skin (optimizes visuals for human skin, e.g. boosted red channel). | +-------------------------------+------------------------------------------------------------------------------------------------------+ | **cull_back** | Cull back-faces (default). | +-------------------------------+------------------------------------------------------------------------------------------------------+ @@ -40,31 +42,33 @@ Render modes +-------------------------------+------------------------------------------------------------------------------------------------------+ | **cull_disabled** | Culling disabled (double sided). | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **unshaded** | Result is just albedo. No lighting/shading happens in material. | +| **unshaded** | Result is just albedo. No lighting/shading happens in material, making it faster to render. | ++-------------------------------+------------------------------------------------------------------------------------------------------+ +| **wireframe** | Geometry draws using lines (useful for troubleshooting). | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **wireframe** | Geometry draws using lines. | +| **debug_shadow_splits** | Directional shadows are drawn using different colors for each split (useful for troubleshooting). | +-------------------------------+------------------------------------------------------------------------------------------------------+ | **diffuse_burley** | Burley (Disney PBS) for diffuse (default). | +-------------------------------+------------------------------------------------------------------------------------------------------+ | **diffuse_lambert** | Lambert shading for diffuse. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **diffuse_lambert_wrap** | Lambert wrapping (roughness dependent) for diffuse. | +| **diffuse_lambert_wrap** | Lambert-wrap shading (roughness-dependent) for diffuse. | +-------------------------------+------------------------------------------------------------------------------------------------------+ | **diffuse_toon** | Toon shading for diffuse. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **specular_schlick_ggx** | Schlick-GGX for specular (default). | +| **specular_schlick_ggx** | Schlick-GGX for direct light specular lobes (default). | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **specular_toon** | Toon for specular. | +| **specular_toon** | Toon for direct light specular lobes. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **specular_disabled** | Disable specular. | +| **specular_disabled** | Disable direct light specular lobes. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **skip_vertex_transform** | VERTEX/NORMAL/etc. need to be transformed manually in vertex function. | +| **skip_vertex_transform** | ``VERTEX``/``NORMAL``/etc. need to be transformed manually in the ``vertex()`` function. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **world_vertex_coords** | VERTEX/NORMAL/etc. are modified in world coordinates instead of local. | +| **world_vertex_coords** | ``VERTEX``/``NORMAL``/etc. are modified in world coordinates instead of local. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **ensure_correct_normals** | Use when non-uniform scale is applied to mesh. | +| **ensure_correct_normals** | Use when non-uniform scale is applied to mesh *(note: currently unimplemented)*. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **shadows_disabled** | Disable computing shadows in shader. | +| **shadows_disabled** | Disable computing shadows in shader. The shader will not cast shadows, but can still receive them. | +-------------------------------+------------------------------------------------------------------------------------------------------+ | **ambient_light_disabled** | Disable contribution from ambient light and radiance map. | +-------------------------------+------------------------------------------------------------------------------------------------------+ @@ -72,7 +76,7 @@ Render modes | | non-shadowed areas are transparent. Useful for overlaying shadows onto | | | a camera feed in AR. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **vertex_lighting** | Use vertex-based lighting. | +| **vertex_lighting** | Use vertex-based lighting *(note: currently unimplemented)*. | +-------------------------------+------------------------------------------------------------------------------------------------------+ | **particle_trails** | Enables the trails when used on particles geometry. | +-------------------------------+------------------------------------------------------------------------------------------------------+ @@ -80,7 +84,7 @@ Render modes +-------------------------------+------------------------------------------------------------------------------------------------------+ | **alpha_to_coverage_and_one** | Alpha antialiasing mode, see `here `_ for more. | +-------------------------------+------------------------------------------------------------------------------------------------------+ -| **fog_disabled** | Disable receiving depth-based or volumetric fog. Useful for blend_add materials like particles. | +| **fog_disabled** | Disable receiving depth-based or volumetric fog. Useful for ``blend_add`` materials like particles. | +-------------------------------+------------------------------------------------------------------------------------------------------+ Built-ins @@ -347,6 +351,10 @@ these properties, and if you don't write to them, Godot will optimize away the c +----------------------------------------+--------------------------------------------------------------------------------------------------+ | out vec2 **ALPHA_TEXTURE_COORDINATE** | | +----------------------------------------+--------------------------------------------------------------------------------------------------+ +| out float **PREMUL_ALPHA_FACTOR** | Premultiplied alpha factor. Only effective if ``render_mode blend_premul_alpha;`` is used. | +| | This should be written to when using a *shaded* material with premultiplied alpha blending for | +| | interaction with lighting. This is not required for unshaded materials. | ++----------------------------------------+--------------------------------------------------------------------------------------------------+ | out float **METALLIC** | Metallic (0..1). | +----------------------------------------+--------------------------------------------------------------------------------------------------+ | out float **SPECULAR** | Specular. Defaults to 0.5, best not to modify unless you want to change IOR. |