From a8a6e664fb923d5aa0c21a875ab6667f2d3bb606 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 15 May 2022 01:19:43 +0200 Subject: Rename BaseMaterial3D properties to use fully spelled out "texture" This is more consistent with other BaseMaterial properties such as `ao_texture_channel`. This also improves the documentation related to `albedo_texture_force_srgb`. This also fixes a typo in the 3.x material converter. --- doc/classes/BaseMaterial3D.xml | 22 +++++++++++++--------- scene/resources/material.cpp | 6 +++--- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml index c6f3aae929..a9c6030809 100644 --- a/doc/classes/BaseMaterial3D.xml +++ b/doc/classes/BaseMaterial3D.xml @@ -61,14 +61,16 @@ The material's base color. [b]Note:[/b] If [member detail_enabled] is [code]true[/code] and a [member detail_albedo] texture is specified, [member albedo_color] will [i]not[/i] modulate the detail texture. This can be used to color partial areas of a material by not specifying an albedo texture and using a transparent [member detail_albedo] texture instead. - - Forces a conversion of the [member albedo_texture] from sRGB space to linear space. - - - Enables multichannel signed distance field rendering shader. Use [member msdf_pixel_range] and [member msdf_outline_size] to configure MSDF parameters. - Texture to multiply by [member albedo_color]. Used for basic texturing of objects. + If the texture appears unexpectedly too dark or too bright, check [member albedo_texture_force_srgb]. + + + If [code]true[/code], forces a conversion of the [member albedo_texture] from sRGB color space to linear color space. See also [member vertex_color_is_srgb]. + This should only be enabled when needed (typically when using a [ViewportTexture] as [member albedo_texture]). If [member albedo_texture_force_srgb] is [code]true[/code] when it shouldn't be, the texture will appear to be too dark. If [member albedo_texture_force_srgb] is [code]false[/code] when it shouldn't be, the texture will appear to be too bright. + + + Enables multichannel signed distance field rendering shader. Use [member msdf_pixel_range] and [member msdf_outline_size] to configure MSDF parameters. Threshold at which antialiasing will be applied on the alpha channel. @@ -401,7 +403,8 @@ If [code]true[/code], triplanar mapping for [code]UV2[/code] is calculated in world space rather than object local space. See also [member uv2_triplanar]. - If [code]true[/code], the model's vertex colors are processed as sRGB mode. + If [code]true[/code], vertex colors are considered to be stored in sRGB color space and are converted to linear color space during rendering. If [code]false[/code], vertex colors are considered to be stored in linear color space and are rendered as-is. See also [member albedo_texture_force_srgb]. + [b]Note:[/b] Only effective when using the Vulkan Clustered or Vulkan Mobile backends. If [code]true[/code], the vertex color is used as albedo color. @@ -607,7 +610,8 @@ Set [code]ALBEDO[/code] to the per-vertex color specified in the mesh. - Vertex color is in sRGB space and needs to be converted to linear. Only applies in the Vulkan renderer. + Vertex colors are considered to be stored in sRGB color space and are converted to linear color space during rendering. See also [member vertex_color_is_srgb]. + [b]Note:[/b] Only effective when using the Vulkan Clustered or Vulkan Mobile backends. Uses point size to alter the size of primitive points. Also changes the albedo texture lookup to use [code]POINT_COORD[/code] instead of [code]UV[/code]. @@ -637,7 +641,7 @@ Use [code]UV2[/code] coordinates to look up from the [member emission_texture]. - Forces the shader to convert albedo from sRGB space to linear space. + Forces the shader to convert albedo from sRGB space to linear space. See also [member albedo_texture_force_srgb]. Disables receiving shadows from other objects. diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 591d58d527..997a45cce5 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -2557,8 +2557,8 @@ void BaseMaterial3D::_bind_methods() { ADD_GROUP("Albedo", "albedo_"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "albedo_color"), "set_albedo", "get_albedo"); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "albedo_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_ALBEDO); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "albedo_tex_force_srgb"), "set_flag", "get_flag", FLAG_ALBEDO_TEXTURE_FORCE_SRGB); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "albedo_tex_msdf"), "set_flag", "get_flag", FLAG_ALBEDO_TEXTURE_MSDF); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "albedo_texture_force_srgb"), "set_flag", "get_flag", FLAG_ALBEDO_TEXTURE_FORCE_SRGB); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "albedo_texture_msdf"), "set_flag", "get_flag", FLAG_ALBEDO_TEXTURE_MSDF); ADD_GROUP("ORM", "orm_"); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "orm_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_ORM); @@ -2965,7 +2965,7 @@ bool StandardMaterial3D::_set(const StringName &p_name, const Variant &p_value) { "flags_no_depth_test", "no_depth_test" }, { "flags_use_point_size", "use_point_size" }, { "flags_fixed_size", "fixed_Size" }, - { "flags_albedo_tex_force_srg", "albedo_tex_force_srgb" }, + { "flags_albedo_tex_force_srgb", "albedo_texture_force_srgb" }, { "flags_do_not_receive_shadows", "disable_receive_shadows" }, { "flags_disable_ambient_light", "disable_ambient_light" }, { "params_diffuse_mode", "diffuse_mode" }, -- cgit v1.2.3