summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-05-15 01:19:43 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-05-24 20:44:17 +0200
commita8a6e664fb923d5aa0c21a875ab6667f2d3bb606 (patch)
treeeec470cb2bddea6a88a4d9d1b2e5599b3b25df95
parent4dd6f56c82fd87b85ad483e6f95585a83cd88a12 (diff)
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.
-rw-r--r--doc/classes/BaseMaterial3D.xml22
-rw-r--r--scene/resources/material.cpp6
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.
</member>
- <member name="albedo_tex_force_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
- Forces a conversion of the [member albedo_texture] from sRGB space to linear space.
- </member>
- <member name="albedo_tex_msdf" type="bool" setter="set_flag" getter="get_flag" default="false">
- Enables multichannel signed distance field rendering shader. Use [member msdf_pixel_range] and [member msdf_outline_size] to configure MSDF parameters.
- </member>
<member name="albedo_texture" type="Texture2D" setter="set_texture" getter="get_texture">
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].
+ </member>
+ <member name="albedo_texture_force_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
+ 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.
+ </member>
+ <member name="albedo_texture_msdf" type="bool" setter="set_flag" getter="get_flag" default="false">
+ Enables multichannel signed distance field rendering shader. Use [member msdf_pixel_range] and [member msdf_outline_size] to configure MSDF parameters.
</member>
<member name="alpha_antialiasing_edge" type="float" setter="set_alpha_antialiasing_edge" getter="get_alpha_antialiasing_edge">
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].
</member>
<member name="vertex_color_is_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
- 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.
</member>
<member name="vertex_color_use_as_albedo" type="bool" setter="set_flag" getter="get_flag" default="false">
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.
</constant>
<constant name="FLAG_SRGB_VERTEX_COLOR" value="2" enum="Flags">
- 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.
</constant>
<constant name="FLAG_USE_POINT_SIZE" value="3" enum="Flags">
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].
</constant>
<constant name="FLAG_ALBEDO_TEXTURE_FORCE_SRGB" value="12" enum="Flags">
- 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].
</constant>
<constant name="FLAG_DONT_RECEIVE_SHADOWS" value="13" enum="Flags">
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" },