diff --git a/doc/classes/CPUParticles.xml b/doc/classes/CPUParticles.xml
index 376cc5102d5..d51db182471 100644
--- a/doc/classes/CPUParticles.xml
+++ b/doc/classes/CPUParticles.xml
@@ -128,15 +128,15 @@
Each particle's initial color.
- [b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
+ [b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
Each particle's initial color will vary along this [GradientTexture] (multiplied with [member color]).
- [b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
+ [b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
Each particle's color will vary along this [GradientTexture] over its lifetime (multiplied with [member color]).
- [b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
+ [b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
The rate at which particles lose velocity.
@@ -158,7 +158,7 @@
Sets the [Color]s to modulate particles by when using [constant EMISSION_SHAPE_POINTS] or [constant EMISSION_SHAPE_DIRECTED_POINTS].
- [b]Note:[/b] [member emission_colors] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_colors] will have no visible effect.
+ [b]Note:[/b] [member emission_colors] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_colors] will have no visible effect.
Sets the direction the particles will be emitted in when using [constant EMISSION_SHAPE_DIRECTED_POINTS].
diff --git a/doc/classes/EditorSpatialGizmoPlugin.xml b/doc/classes/EditorSpatialGizmoPlugin.xml
index ce2efc98d0d..e6b231d8564 100644
--- a/doc/classes/EditorSpatialGizmoPlugin.xml
+++ b/doc/classes/EditorSpatialGizmoPlugin.xml
@@ -14,7 +14,7 @@
-
+
Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden.
@@ -90,7 +90,7 @@
-
+
diff --git a/doc/classes/Label3D.xml b/doc/classes/Label3D.xml
index ebe57bf6e30..2750b33d5e1 100644
--- a/doc/classes/Label3D.xml
+++ b/doc/classes/Label3D.xml
@@ -41,8 +41,8 @@
If [code]true[/code], wraps the text to the [member width].
-
- The billboard mode to use for the label. See [enum SpatialMaterial.BillboardMode] for possible values.
+
+ The billboard mode to use for the label. See [enum Material3D.BillboardMode] for possible values.
If [code]true[/code], text can be seen from the back as well, if [code]false[/code], it is invisible when looking at it from behind.
diff --git a/doc/classes/Material3D.xml b/doc/classes/Material3D.xml
new file mode 100644
index 00000000000..12fe4d9885e
--- /dev/null
+++ b/doc/classes/Material3D.xml
@@ -0,0 +1,668 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns [code]true[/code], if the specified [enum Feature] is enabled.
+
+
+
+
+
+
+ Returns [code]true[/code], if the specified flag is enabled. See [enum Flags] enumerator for options.
+
+
+
+
+
+
+ Returns the [Texture] associated with the specified [enum TextureParam].
+
+
+
+
+
+
+
+ If [code]true[/code], enables the specified [enum Feature]. Many features that are available in [SpatialMaterial]s need to be enabled before use. This way the cost for using the feature is only incurred when specified. Features can also be enabled by setting the corresponding member to [code]true[/code].
+
+
+
+
+
+
+
+ If [code]true[/code], enables the specified flag. Flags are optional behavior that can be turned on and off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by setting the corresponding member to [code]true[/code]. See [enum Flags] enumerator for options.
+
+
+
+
+
+
+
+ Sets the [Texture] to be used by the specified [enum TextureParam]. This function is called when setting members ending in [code]*_texture[/code].
+
+
+
+
+
+ The material's base color.
+
+
+ Texture to multiply by [member albedo_color]. Used for basic texturing of objects.
+
+
+ The strength of the anisotropy effect. This is multiplied by [member anisotropy_flowmap]'s alpha channel if a texture is defined there and the texture contains an alpha channel.
+
+
+ If [code]true[/code], anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium and hair reflections.
+ [b]Note:[/b] Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken.
+ [b]Note:[/b] Material anisotropy should not to be confused with anisotropic texture filtering. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the [b]Anisotropic[/b] checkbox then clicking [b]Reimport[/b]. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].
+
+
+ Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion.
+ If present, the texture's alpha channel will be used to multiply the strength of the [member anisotropy] effect. Fully opaque pixels will keep the anisotropy effect's original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture's blue channel is ignored.
+
+
+ If [code]true[/code], ambient occlusion is enabled. Ambient occlusion darkens areas based on the [member ao_texture].
+
+
+ Amount that ambient occlusion affects lighting from lights. If [code]0[/code], ambient occlusion only affects ambient light. If [code]1[/code], ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
+
+
+ If [code]true[/code], use [code]UV2[/code] coordinates to look up from the [member ao_texture].
+
+
+ Texture that defines the amount of ambient occlusion for a given point on the object.
+
+
+ Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
+
+
+ If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is [code]Synchronous[/code] (with or without cache), this determines how this material must behave in regards to asynchronous shader compilation.
+ [constant ASYNC_MODE_VISIBLE] is the default and the best for most cases.
+
+
+ Sets the strength of the clearcoat effect. Setting to [code]0[/code] looks the same as disabling the clearcoat effect.
+
+
+ If [code]true[/code], clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting calculation resulting in an added specular blob. This makes materials appear as if they have a clear layer on them that can be either glossy or rough.
+ [b]Note:[/b] Clearcoat rendering is not visible if the material has [member flags_unshaded] set to [code]true[/code].
+
+
+ Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
+
+
+ Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. Strength is specified in the red channel while glossiness is specified in the green channel.
+
+
+ If [code]true[/code], the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
+
+
+ If [code]true[/code], depth mapping is enabled (also called "parallax mapping" or "height mapping"). See also [member normal_enabled].
+ [b]Note:[/b] Depth mapping is not supported if triplanar mapping is used on the same material. The value of [member depth_enabled] will be ignored if [member uv1_triplanar] is enabled.
+
+
+ If [code]true[/code], direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
+
+
+ If [code]true[/code], direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
+
+
+ Number of layers to use when using [member depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
+
+
+ Number of layers to use when using [member depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
+
+
+ Scales the depth offset effect. A higher number will create a larger depth.
+
+
+ Texture used to determine depth at a given pixel. Depth is always stored in the red channel.
+
+
+ Texture that specifies the color of the detail overlay.
+
+
+ Specifies how the [member detail_albedo] should blend with the current [code]ALBEDO[/code]. See [enum BlendMode] for options.
+
+
+ If [code]true[/code], enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on [member detail_mask]. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
+
+
+ Texture used to specify how the detail textures get blended with the base textures.
+
+
+ Texture that specifies the per-pixel normal of the detail overlay.
+ [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
+
+
+ Specifies whether to use [code]UV[/code] or [code]UV2[/code] for the detail layer. See [enum DetailUV] for options.
+
+
+ Distance at which the object appears fully opaque.
+ [b]Note:[/b] If [code]distance_fade_max_distance[/code] is less than [code]distance_fade_min_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
+
+
+ Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
+ [b]Note:[/b] If [code]distance_fade_min_distance[/code] is greater than [code]distance_fade_max_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
+
+
+ Specifies which type of fade to use. Can be any of the [enum DistanceFadeMode]s.
+
+
+ The emitted light's color. See [member emission_enabled].
+
+
+ If [code]true[/code], the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a [GIProbe] or [BakedLightmap] is used and this object is used in baked lighting.
+
+
+ The emitted light's strength. See [member emission_enabled].
+
+
+ Use [code]UV2[/code] to read from the [member emission_texture].
+
+
+ Sets how [member emission] interacts with [member emission_texture]. Can either add or multiply. See [enum EmissionOperator] for options.
+
+
+ Texture that specifies how much surface emits light at a given point.
+
+
+ Forces a conversion of the [member albedo_texture] from sRGB space to linear space.
+
+
+ Enables signed distance field rendering shader.
+
+
+ If [code]true[/code], the object receives no ambient light.
+
+
+ If [code]true[/code], the object receives no shadow that would otherwise be cast onto it.
+
+
+ If [code]true[/code], the shader will compute extra operations to make sure the normal stays correct when using a non-uniform scale. Only enable if using non-uniform scaling.
+
+
+ If [code]true[/code], the object is rendered at the same size regardless of distance.
+
+
+ If [code]true[/code], depth testing is disabled and the object will be drawn in render order.
+
+
+ If [code]true[/code], transparency is enabled on the body. See also [member params_blend_mode].
+
+
+ If [code]true[/code], the object is unaffected by lighting.
+
+
+ If [code]true[/code], render point size can be changed.
+ [b]Note:[/b] This is only effective for objects whose geometry is point-based rather than triangle-based. See also [member params_point_size].
+
+
+ If [code]true[/code], enables the "shadow to opacity" render mode where lighting modifies the alpha so shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
+
+
+ If [code]true[/code], lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
+ See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials.
+ [b]Note:[/b] By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]'s [code]mobile[/code] override.
+ [b]Note:[/b] [member flags_vertex_lighting] has no effect if [member flags_unshaded] is [code]true[/code].
+
+
+ If [code]true[/code], triplanar mapping is calculated in world space rather than object local space. See also [member uv1_triplanar].
+
+
+ A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between [code]0[/code] and [code]1[/code] should only be used for blending between metal and non-metal sections. To alter the amount of reflection use [member roughness].
+
+
+ Sets the size of the specular lobe. The specular lobe is the bright spot that is reflected from light sources.
+ [b]Note:[/b] Unlike [member metallic], this is not energy-conserving, so it should be left at [code]0.5[/code] in most cases. See also [member roughness].
+
+
+ Texture used to specify metallic for an object. This is multiplied by [member metallic].
+
+
+ Specifies the channel of the [member metallic_texture] in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
+
+
+ If [code]true[/code], normal mapping is enabled.
+
+
+ The strength of the normal map's effect.
+
+
+ Texture used to specify the normal at a given pixel. The [code]normal_texture[/code] only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [code]normal_texture[/code] is oriented around the surface normal provided by the [Mesh].
+ [b]Note:[/b] The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won't render correctly and will only appear to darken the whole surface. If creating geometry with [SurfaceTool], you can use [method SurfaceTool.generate_normals] and [method SurfaceTool.generate_tangents] to automatically generate normals and tangents respectively.
+ [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
+
+
+ A single texture that combines information about AO, roughness and metallic. AO is stored in the red channel, roughness in the green channel and metallic in the blue channel.
+
+
+ Threshold at which the alpha scissor will discard values.
+
+
+ If [code]true[/code], the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
+
+
+ Controls how the object faces the camera. See [enum BillboardMode].
+ [b]Note:[/b] Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See [url=https://github.com/godotengine/godot/issues/41567]GitHub issue #41567[/url] for details.
+
+
+ The material's blend mode.
+ [b]Note:[/b] Values other than [code]Mix[/code] force the object into the transparent pipeline. See [enum BlendMode].
+
+
+ Which side of the object is not drawn when backfaces are rendered. See [enum CullMode].
+
+
+ Determines when depth rendering takes place. See [enum DepthDrawMode]. See also [member flags_transparent].
+
+
+ The algorithm used for diffuse light scattering. See [enum DiffuseMode].
+
+
+ If [code]true[/code], enables the vertex grow setting. See [member params_grow_amount].
+
+
+ Grows object vertices in the direction of their normals.
+
+
+ Currently unimplemented in Godot.
+
+
+ The point size in pixels. See [member flags_use_point_size].
+
+
+ The method for rendering the specular blob. See [enum SpecularMode].
+
+
+ If [code]true[/code], the shader will discard all pixels that have an alpha value less than [member params_alpha_scissor_threshold].
+
+
+ The number of horizontal frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
+
+
+ If [code]true[/code], particle animations are looped. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
+
+
+ The number of vertical frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
+
+
+ Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
+
+
+ If [code]true[/code], the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
+
+
+ If [code]true[/code], the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material's roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.
+
+
+ The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
+
+
+ Texture that controls the strength of the refraction per-pixel. Multiplied by [member refraction_scale].
+
+
+ Specifies the channel of the [member refraction_texture] in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
+
+
+ Sets the strength of the rim lighting effect.
+
+
+ If [code]true[/code], rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
+ [b]Note:[/b] Rim lighting is not visible if the material has [member flags_unshaded] set to [code]true[/code].
+
+
+ Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by [member rim].
+
+
+ The amount of to blend light and albedo color when rendering rim effect. If [code]0[/code] the light color is used, while [code]1[/code] means albedo color is used. An intermediate value generally works best.
+
+
+ Surface reflection. A value of [code]0[/code] represents a perfect mirror while a value of [code]1[/code] completely blurs the reflection. See also [member metallic].
+
+
+ Texture used to control the roughness per-pixel. Multiplied by [member roughness].
+
+
+ Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
+
+
+ If [code]true[/code], subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges.
+
+
+ The strength of the subsurface scattering effect.
+
+
+ Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by [member subsurf_scatter_strength].
+
+
+ The color used by the transmission effect. Represents the light passing through an object.
+
+
+ If [code]true[/code], the transmission effect is enabled.
+
+
+ Texture used to control the transmission effect per-pixel. Added to [member transmission].
+
+
+ How much to offset the [code]UV[/code] coordinates. This amount will be added to [code]UV[/code] in the vertex function. This can be used to offset a texture.
+
+
+ How much to scale the [code]UV[/code] coordinates. This is multiplied by [code]UV[/code] in the vertex function.
+
+
+ If [code]true[/code], instead of using [code]UV[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
+
+
+ A lower number blends the texture more softly while a higher number blends the texture more sharply.
+ [b]Note:[/b] [member uv1_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
+
+
+ How much to offset the [code]UV2[/code] coordinates. This amount will be added to [code]UV2[/code] in the vertex function. This can be used to offset a texture.
+
+
+ How much to scale the [code]UV2[/code] coordinates. This is multiplied by [code]UV2[/code] in the vertex function.
+
+
+ If [code]true[/code], instead of using [code]UV2[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
+
+
+ A lower number blends the texture more softly while a higher number blends the texture more sharply.
+ [b]Note:[/b] [member uv2_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
+
+
+ If [code]true[/code], the model's vertex colors are processed as sRGB mode.
+
+
+ If [code]true[/code], the vertex color is used as albedo color.
+
+
+
+
+ Texture specifying per-pixel color.
+
+
+ Texture specifying per-pixel metallic value.
+
+
+ Texture specifying per-pixel roughness value.
+
+
+ Texture specifying per-pixel emission color.
+
+
+ Texture specifying per-pixel normal vector.
+
+
+ Texture specifying per-pixel rim value.
+
+
+ Texture specifying per-pixel clearcoat value.
+
+
+ Texture specifying per-pixel flowmap direction for use with [member anisotropy].
+
+
+ Texture specifying per-pixel ambient occlusion value.
+
+
+ Texture specifying per-pixel depth.
+
+
+ Texture specifying per-pixel subsurface scattering.
+
+
+ Texture specifying per-pixel transmission color.
+
+
+ Texture specifying per-pixel refraction strength.
+
+
+ Texture specifying per-pixel detail mask blending value.
+
+
+ Texture specifying per-pixel detail color.
+
+
+ Texture specifying per-pixel detail normal.
+
+
+ Represents the size of the [enum TextureParam] enum.
+
+
+ Use [code]UV[/code] with the detail texture.
+
+
+ Use [code]UV2[/code] with the detail texture.
+
+
+ Constant for setting [member flags_transparent].
+
+
+ Constant for setting [member emission_enabled].
+
+
+ Constant for setting [member normal_enabled].
+
+
+ Constant for setting [member rim_enabled].
+
+
+ Constant for setting [member clearcoat_enabled].
+
+
+ Constant for setting [member anisotropy_enabled].
+
+
+ Constant for setting [member ao_enabled].
+
+
+ Constant for setting [member depth_enabled].
+
+
+ Constant for setting [member subsurf_scatter_enabled].
+
+
+ Constant for setting [member transmission_enabled].
+
+
+ Constant for setting [member refraction_enabled].
+
+
+ Constant for setting [member detail_enabled].
+
+
+ Represents the size of the [enum Feature] enum.
+
+
+ Default blend mode. The color of the object is blended over the background based on the object's alpha value.
+
+
+ The color of the object is added to the background.
+
+
+ The color of the object is subtracted from the background.
+
+
+ The color of the object is multiplied by the background.
+
+
+ Default depth draw mode. Depth is drawn only for opaque objects.
+
+
+ Depth draw is calculated for both opaque and transparent objects.
+
+
+ No depth draw.
+
+
+ For transparent objects, an opaque pass is made first with the opaque parts, then transparency is drawn.
+
+
+ Default cull mode. The back of the object is culled when not visible.
+
+
+ The front of the object is culled when not visible.
+
+
+ No culling is performed.
+
+
+ No lighting is used on the object. Color comes directly from [code]ALBEDO[/code].
+
+
+ Lighting is calculated per-vertex rather than per-pixel. This can be used to increase the speed of the shader at the cost of quality.
+
+
+ Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it.
+
+
+ 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 GLES3 renderer.
+
+
+ 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].
+
+
+ Object is scaled by depth so that it always appears the same size on screen.
+
+
+ Shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
+
+
+ Use triplanar texture lookup for all texture lookups that would normally use [code]UV[/code].
+
+
+ Use triplanar texture lookup for all texture lookups that would normally use [code]UV2[/code].
+
+
+ Use [code]UV2[/code] coordinates to look up from the [member ao_texture].
+
+
+ Use [code]UV2[/code] coordinates to look up from the [member emission_texture].
+
+
+ Use alpha scissor. Set by [member params_use_alpha_scissor].
+
+
+ Use world coordinates in the triplanar texture lookup instead of local coordinates.
+
+
+ Forces the shader to convert albedo from sRGB space to linear space.
+
+
+ Disables receiving shadows from other objects.
+
+
+ Disables receiving ambient light.
+
+
+ Ensures that normals appear correct, even with non-uniform scaling.
+
+
+ Enables the shadow to opacity feature.
+
+
+ Enables signed distance field rendering shader.
+
+
+ Represents the size of the [enum Flags] enum.
+
+
+ Default diffuse scattering algorithm.
+
+
+ Diffuse scattering ignores roughness.
+
+
+ Extends Lambert to cover more than 90 degrees when roughness increases.
+
+
+ Attempts to use roughness to emulate microsurfacing.
+
+
+ Uses a hard cut for lighting, with smoothing affected by roughness.
+
+
+ Default specular blob.
+
+
+ Older specular algorithm, included for compatibility.
+
+
+ Older specular algorithm, included for compatibility.
+
+
+ Toon blob which changes size based on roughness.
+
+
+ No specular blob.
+
+
+ Billboard mode is disabled.
+
+
+ The object's Z axis will always face the camera.
+
+
+ The object's X axis will always face the camera.
+
+
+ Used for particle systems when assigned to [Particles] and [CPUParticles] nodes. Enables [code]particles_anim_*[/code] properties.
+ The [member ParticlesMaterial.anim_speed] or [member CPUParticles.anim_speed] should also be set to a positive value for the animation to play.
+
+
+ Used to read from the red channel of a texture.
+
+
+ Used to read from the green channel of a texture.
+
+
+ Used to read from the blue channel of a texture.
+
+
+ Used to read from the alpha channel of a texture.
+
+
+ Currently unused.
+
+
+ Adds the emission color to the color from the emission texture.
+
+
+ Multiplies the emission color by the color from the emission texture.
+
+
+ Do not use distance fade.
+
+
+ Smoothly fades the object out based on each pixel's distance from the camera using the alpha channel.
+
+
+ Smoothly fades the object out based on each pixel's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
+
+
+ Smoothly fades the object out based on the object's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
+
+
+ The real conditioned shader needed on each situation will be sent for background compilation. In the meantime, a very complex shader that adapts to every situation will be used ("ubershader"). This ubershader is much slower to render, but will keep the game running without stalling to compile. Once shader compilation is done, the ubershader is replaced by the traditional optimized shader.
+
+
+ Anything with this material applied won't be rendered while this material's shader is being compiled.
+ This is useful for optimization, in cases where the visuals won't suffer from having certain non-essential elements missing during the short time their shaders are being compiled.
+
+
+
diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml
index 3ef57f4f1ff..8b4ced76756 100644
--- a/doc/classes/MultiMesh.xml
+++ b/doc/classes/MultiMesh.xml
@@ -81,7 +81,7 @@
Sets the color of a specific instance by [i]multiplying[/i] the mesh's existing vertex colors.
- For the color to take effect, ensure that [member color_format] is non-[code]null[/code] on the [MultiMesh] and [member SpatialMaterial.vertex_color_use_as_albedo] is [code]true[/code] on the material. If the color doesn't look as expected, make sure the material's albedo color is set to pure white ([code]Color(1, 1, 1)[/code]).
+ For the color to take effect, ensure that [member color_format] is non-[code]null[/code] on the [MultiMesh] and [member Material3D.vertex_color_use_as_albedo] is [code]true[/code] on the material. If the color doesn't look as expected, make sure the material's albedo color is set to pure white ([code]Color(1, 1, 1)[/code]).
diff --git a/doc/classes/ORMSpatialMaterial.xml b/doc/classes/ORMSpatialMaterial.xml
new file mode 100644
index 00000000000..6d43551b47c
--- /dev/null
+++ b/doc/classes/ORMSpatialMaterial.xml
@@ -0,0 +1,15 @@
+
+
+
+ ORM 3D rendering material, based on [Material3D].
+
+
+ This is a variant of the SpatialMaterial that uses an ORM texture to store AO, roughness and metallic information.
+
+
+
+
+
+
+
+
diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml
index c9f1ec8941b..b47bda3d208 100644
--- a/doc/classes/ParticlesMaterial.xml
+++ b/doc/classes/ParticlesMaterial.xml
@@ -75,7 +75,7 @@
Initial rotation applied to each particle, in degrees.
- [b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [SpatialMaterial] being used to draw the particle is using [constant SpatialMaterial.BILLBOARD_PARTICLES].
+ [b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [Material3D] being used to draw the particle is using [constant Material3D.BILLBOARD_PARTICLES].
Each particle's rotation will be animated along this [CurveTexture].
@@ -85,7 +85,7 @@
Initial angular velocity applied to each particle in [i]degrees[/i] per second. Sets the speed of rotation of the particle.
- [b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [SpatialMaterial] being used to draw the particle is using [constant SpatialMaterial.BILLBOARD_PARTICLES].
+ [b]Note:[/b] Only applied when [member flag_disable_z] or [member flag_rotate_y] are [code]true[/code] or the [Material3D] being used to draw the particle is using [constant Material3D.BILLBOARD_PARTICLES].
Each particle's angular velocity will vary along this [CurveTexture].
@@ -113,15 +113,15 @@
Each particle's initial color. If the [Particles2D]'s or [Particles]'s [code]texture[/code] is defined, it will be multiplied by this color.
- [b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
+ [b]Note:[/b] [member color] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
Each particle's initial color will vary along this [GradientTexture] (multiplied with [member color]).
- [b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
+ [b]Note:[/b] [member color_initial_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_initial_ramp] will have no visible effect.
Each particle's color will vary along this [GradientTexture] over its lifetime (multiplied with [member color]).
- [b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
+ [b]Note:[/b] [member color_ramp] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color_ramp] will have no visible effect.
The rate at which particles lose velocity.
@@ -140,7 +140,7 @@
Particle color will be modulated by color determined by sampling this texture at the same point as the [member emission_point_texture].
- [b]Note:[/b] [member emission_color_texture] multiplies the particle mesh's vertex colors. To have a visible effect on a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_color_texture] will have no visible effect.
+ [b]Note:[/b] [member emission_color_texture] multiplies the particle mesh's vertex colors. To have a visible effect on a [Material3D], [member Material3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member emission_color_texture] will have no visible effect.
Particle velocity and rotation will be set by sampling this texture at the same point as the [member emission_point_texture]. Used only in [constant EMISSION_SHAPE_DIRECTED_POINTS]. Can be created automatically from mesh or node by selecting "Create Emission Points from Mesh/Node" under the "Particles" tool in the toolbar.
diff --git a/doc/classes/PointMesh.xml b/doc/classes/PointMesh.xml
index 8021d0ed1ac..2c48f542d19 100644
--- a/doc/classes/PointMesh.xml
+++ b/doc/classes/PointMesh.xml
@@ -5,7 +5,7 @@
The PointMesh is made from a single point. Instead of relying on triangles, points are rendered as a single rectangle on the screen with a constant size. They are intended to be used with Particle systems, but can be used as a cheap way to render constant size billboarded sprites (for example in a point cloud).
- PointMeshes, must be used with a material that has a point size. Point size can be accessed in a shader with [code]POINT_SIZE[/code], or in a [SpatialMaterial] by setting [member SpatialMaterial.flags_use_point_size] and the variable [member SpatialMaterial.params_point_size].
+ PointMeshes, must be used with a material that has a point size. Point size can be accessed in a shader with [code]POINT_SIZE[/code], or in a [SpatialMaterial] by setting [member Material3D.flags_use_point_size] and the variable [member Material3D.params_point_size].
When using PointMeshes, properties that normally alter vertices will be ignored, including billboard mode, grow, and cull face.
diff --git a/doc/classes/PrimitiveMesh.xml b/doc/classes/PrimitiveMesh.xml
index c8a1ab214c1..742e178ceae 100644
--- a/doc/classes/PrimitiveMesh.xml
+++ b/doc/classes/PrimitiveMesh.xml
@@ -27,7 +27,7 @@
If set, the order of the vertices in each triangle are reversed resulting in the backside of the mesh being drawn.
- This gives the same result as using [constant SpatialMaterial.CULL_BACK] in [member SpatialMaterial.params_cull_mode].
+ This gives the same result as using [constant Material3D.CULL_BACK] in [member Material3D.params_cull_mode].
The current [Material] of the primitive mesh.
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 78068fc6995..6b3bee98e4c 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1593,7 +1593,7 @@
If set to [code]Asynchronous[/code] and available on the target device, asynchronous compilation of shaders is enabled (in contrast to [code]Asynchronous[/code]).
That means that when a shader is first used under some new rendering situation, the game won't stall while such shader is being compiled. Instead, a fallback will be used and the real shader will be compiled in the background. Once the actual shader is compiled, it will be used the next times it's used to draw a frame.
- Depending on the [member SpatialMaterial.async_mode] mode configured for a given material, the fallback will be an "ubershader" (the default) or just skip rendering any item it is applied to. In custom [ShaderMaterial]s, the async mode is set using [code]render_mode async_visible;[/code] (default) or [code]render_mode async_hidden;[/code] at the top of the shader.
+ Depending on the [member Material3D.async_mode] mode configured for a given material, the fallback will be an "ubershader" (the default) or just skip rendering any item it is applied to. In custom [ShaderMaterial]s, the async mode is set using [code]render_mode async_visible;[/code] (default) or [code]render_mode async_hidden;[/code] at the top of the shader.
An ubershader is a very complex shader, slow but suited to any rendering situation, that the engine generates internally so it can be used from the beginning while the traditional conditioned, optimized version of it is being compiled.
To reduce loading times after the project has been launched at least once, you can use [code]Asynchronous + Cache[/code]. This also causes the ubershaders to be cached into storage so they can be ready faster next time they are used (provided the platform provides support for it).
[b]Note:[/b] Asynchronous compilation requires driver support for the [code]GL_ARB_get_program_binary[/code] OpenGL extension. This extension is supported by all hardware that supports OpenGL 4.1 or higher as well as most hardware that supports OpenGL 3.3 or higher.
@@ -1781,8 +1781,8 @@
Lower-end override for [member rendering/quality/shading/force_lambert_over_burley] on mobile devices, due to performance concerns or driver support.
- If [code]true[/code], forces vertex shading for all 3D [SpatialMaterial] and [ShaderMaterial] rendering. This can be used to improve performance on low-end mobile devices. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
- See also [member SpatialMaterial.flags_vertex_lighting] which can be used to enable vertex shading on specific materials only.
+ If [code]true[/code], forces vertex shading for all 3D [Material3D] and [ShaderMaterial] rendering. This can be used to improve performance on low-end mobile devices. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
+ See also [member Material3D.flags_vertex_lighting] which can be used to enable vertex shading on specific materials only.
[b]Note:[/b] This setting does not affect unshaded materials.
diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml
index ffcf76c83ff..1a241ab5fb5 100644
--- a/doc/classes/SpatialMaterial.xml
+++ b/doc/classes/SpatialMaterial.xml
@@ -1,7 +1,7 @@
-
+
- Default 3D rendering material.
+ Default 3D rendering material, based on [Material3D].
This provides a default material with a wide variety of rendering features and properties without the need to write shader code. See the tutorial below for details.
@@ -10,659 +10,7 @@
$DOCS_URL/tutorials/3d/spatial_material.html
-
-
-
-
- Returns [code]true[/code], if the specified [enum Feature] is enabled.
-
-
-
-
-
-
- Returns [code]true[/code], if the specified flag is enabled. See [enum Flags] enumerator for options.
-
-
-
-
-
-
- Returns the [Texture] associated with the specified [enum TextureParam].
-
-
-
-
-
-
-
- If [code]true[/code], enables the specified [enum Feature]. Many features that are available in [SpatialMaterial]s need to be enabled before use. This way the cost for using the feature is only incurred when specified. Features can also be enabled by setting the corresponding member to [code]true[/code].
-
-
-
-
-
-
-
- If [code]true[/code], enables the specified flag. Flags are optional behavior that can be turned on and off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by setting the corresponding member to [code]true[/code]. See [enum Flags] enumerator for options.
-
-
-
-
-
-
-
- Sets the [Texture] to be used by the specified [enum TextureParam]. This function is called when setting members ending in [code]*_texture[/code].
-
-
-
-
- The material's base color.
-
-
- Texture to multiply by [member albedo_color]. Used for basic texturing of objects.
-
-
- The strength of the anisotropy effect. This is multiplied by [member anisotropy_flowmap]'s alpha channel if a texture is defined there and the texture contains an alpha channel.
-
-
- If [code]true[/code], anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium and hair reflections.
- [b]Note:[/b] Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken.
- [b]Note:[/b] Material anisotropy should not to be confused with anisotropic texture filtering. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the [b]Anisotropic[/b] checkbox then clicking [b]Reimport[/b]. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].
-
-
- Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion.
- If present, the texture's alpha channel will be used to multiply the strength of the [member anisotropy] effect. Fully opaque pixels will keep the anisotropy effect's original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture's blue channel is ignored.
-
-
- If [code]true[/code], ambient occlusion is enabled. Ambient occlusion darkens areas based on the [member ao_texture].
-
-
- Amount that ambient occlusion affects lighting from lights. If [code]0[/code], ambient occlusion only affects ambient light. If [code]1[/code], ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
-
-
- If [code]true[/code], use [code]UV2[/code] coordinates to look up from the [member ao_texture].
-
-
- Texture that defines the amount of ambient occlusion for a given point on the object.
-
-
- Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
-
-
- If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is [code]Synchronous[/code] (with or without cache), this determines how this material must behave in regards to asynchronous shader compilation.
- [constant ASYNC_MODE_VISIBLE] is the default and the best for most cases.
-
-
- Sets the strength of the clearcoat effect. Setting to [code]0[/code] looks the same as disabling the clearcoat effect.
-
-
- If [code]true[/code], clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting calculation resulting in an added specular blob. This makes materials appear as if they have a clear layer on them that can be either glossy or rough.
- [b]Note:[/b] Clearcoat rendering is not visible if the material has [member flags_unshaded] set to [code]true[/code].
-
-
- Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
-
-
- Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. Strength is specified in the red channel while glossiness is specified in the green channel.
-
-
- If [code]true[/code], the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
-
-
- If [code]true[/code], depth mapping is enabled (also called "parallax mapping" or "height mapping"). See also [member normal_enabled].
- [b]Note:[/b] Depth mapping is not supported if triplanar mapping is used on the same material. The value of [member depth_enabled] will be ignored if [member uv1_triplanar] is enabled.
-
-
- If [code]true[/code], direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
-
-
- If [code]true[/code], direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
-
-
- Number of layers to use when using [member depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
-
-
- Number of layers to use when using [member depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
-
-
- Scales the depth offset effect. A higher number will create a larger depth.
-
-
- Texture used to determine depth at a given pixel. Depth is always stored in the red channel.
-
-
- Texture that specifies the color of the detail overlay.
-
-
- Specifies how the [member detail_albedo] should blend with the current [code]ALBEDO[/code]. See [enum BlendMode] for options.
-
-
- If [code]true[/code], enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on [member detail_mask]. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
-
-
- Texture used to specify how the detail textures get blended with the base textures.
-
-
- Texture that specifies the per-pixel normal of the detail overlay.
- [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
-
-
- Specifies whether to use [code]UV[/code] or [code]UV2[/code] for the detail layer. See [enum DetailUV] for options.
-
-
- Distance at which the object appears fully opaque.
- [b]Note:[/b] If [code]distance_fade_max_distance[/code] is less than [code]distance_fade_min_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
-
-
- Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
- [b]Note:[/b] If [code]distance_fade_min_distance[/code] is greater than [code]distance_fade_max_distance[/code], the behavior will be reversed. The object will start to fade away at [code]distance_fade_max_distance[/code] and will fully disappear once it reaches [code]distance_fade_min_distance[/code].
-
-
- Specifies which type of fade to use. Can be any of the [enum DistanceFadeMode]s.
-
-
- The emitted light's color. See [member emission_enabled].
-
-
- If [code]true[/code], the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a [GIProbe] or [BakedLightmap] is used and this object is used in baked lighting.
-
-
- The emitted light's strength. See [member emission_enabled].
-
-
- Use [code]UV2[/code] to read from the [member emission_texture].
-
-
- Sets how [member emission] interacts with [member emission_texture]. Can either add or multiply. See [enum EmissionOperator] for options.
-
-
- Texture that specifies how much surface emits light at a given point.
-
-
- Forces a conversion of the [member albedo_texture] from sRGB space to linear space.
-
-
- Enables signed distance field rendering shader.
-
-
- If [code]true[/code], the object receives no ambient light.
-
-
- If [code]true[/code], the object receives no shadow that would otherwise be cast onto it.
-
-
- If [code]true[/code], the shader will compute extra operations to make sure the normal stays correct when using a non-uniform scale. Only enable if using non-uniform scaling.
-
-
- If [code]true[/code], the object is rendered at the same size regardless of distance.
-
-
- If [code]true[/code], depth testing is disabled and the object will be drawn in render order.
-
-
- If [code]true[/code], transparency is enabled on the body. See also [member params_blend_mode].
-
-
- If [code]true[/code], the object is unaffected by lighting.
-
-
- If [code]true[/code], render point size can be changed.
- [b]Note:[/b] This is only effective for objects whose geometry is point-based rather than triangle-based. See also [member params_point_size].
-
-
- If [code]true[/code], enables the "shadow to opacity" render mode where lighting modifies the alpha so shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
-
-
- If [code]true[/code], lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
- See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials.
- [b]Note:[/b] By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]'s [code]mobile[/code] override.
- [b]Note:[/b] [member flags_vertex_lighting] has no effect if [member flags_unshaded] is [code]true[/code].
-
-
- If [code]true[/code], triplanar mapping is calculated in world space rather than object local space. See also [member uv1_triplanar].
-
-
- A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between [code]0[/code] and [code]1[/code] should only be used for blending between metal and non-metal sections. To alter the amount of reflection use [member roughness].
-
-
- Sets the size of the specular lobe. The specular lobe is the bright spot that is reflected from light sources.
- [b]Note:[/b] Unlike [member metallic], this is not energy-conserving, so it should be left at [code]0.5[/code] in most cases. See also [member roughness].
-
-
- Texture used to specify metallic for an object. This is multiplied by [member metallic].
-
-
- Specifies the channel of the [member metallic_texture] in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
-
-
- If [code]true[/code], normal mapping is enabled.
-
-
- The strength of the normal map's effect.
-
-
- Texture used to specify the normal at a given pixel. The [code]normal_texture[/code] only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [code]normal_texture[/code] is oriented around the surface normal provided by the [Mesh].
- [b]Note:[/b] The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won't render correctly and will only appear to darken the whole surface. If creating geometry with [SurfaceTool], you can use [method SurfaceTool.generate_normals] and [method SurfaceTool.generate_tangents] to automatically generate normals and tangents respectively.
- [b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
-
-
- Threshold at which the alpha scissor will discard values.
-
-
- If [code]true[/code], the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
-
-
- Controls how the object faces the camera. See [enum BillboardMode].
- [b]Note:[/b] Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See [url=https://github.com/godotengine/godot/issues/41567]GitHub issue #41567[/url] for details.
-
-
- The material's blend mode.
- [b]Note:[/b] Values other than [code]Mix[/code] force the object into the transparent pipeline. See [enum BlendMode].
-
-
- Which side of the object is not drawn when backfaces are rendered. See [enum CullMode].
-
-
- Determines when depth rendering takes place. See [enum DepthDrawMode]. See also [member flags_transparent].
-
-
- The algorithm used for diffuse light scattering. See [enum DiffuseMode].
-
-
- If [code]true[/code], enables the vertex grow setting. See [member params_grow_amount].
-
-
- Grows object vertices in the direction of their normals.
-
-
- Currently unimplemented in Godot.
-
-
- The point size in pixels. See [member flags_use_point_size].
-
-
- The method for rendering the specular blob. See [enum SpecularMode].
-
-
- If [code]true[/code], the shader will discard all pixels that have an alpha value less than [member params_alpha_scissor_threshold].
-
-
- The number of horizontal frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
-
-
- If [code]true[/code], particle animations are looped. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
-
-
- The number of vertical frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].
-
-
- Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
-
-
- If [code]true[/code], the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
-
-
- If [code]true[/code], the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material's roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.
-
-
- The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
-
-
- Texture that controls the strength of the refraction per-pixel. Multiplied by [member refraction_scale].
-
-
- Specifies the channel of the [member refraction_texture] in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
-
-
- Sets the strength of the rim lighting effect.
-
-
- If [code]true[/code], rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
- [b]Note:[/b] Rim lighting is not visible if the material has [member flags_unshaded] set to [code]true[/code].
-
-
- Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by [member rim].
-
-
- The amount of to blend light and albedo color when rendering rim effect. If [code]0[/code] the light color is used, while [code]1[/code] means albedo color is used. An intermediate value generally works best.
-
-
- Surface reflection. A value of [code]0[/code] represents a perfect mirror while a value of [code]1[/code] completely blurs the reflection. See also [member metallic].
-
-
- Texture used to control the roughness per-pixel. Multiplied by [member roughness].
-
-
- Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
-
-
- If [code]true[/code], subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges.
-
-
- The strength of the subsurface scattering effect.
-
-
- Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by [member subsurf_scatter_strength].
-
-
- The color used by the transmission effect. Represents the light passing through an object.
-
-
- If [code]true[/code], the transmission effect is enabled.
-
-
- Texture used to control the transmission effect per-pixel. Added to [member transmission].
-
-
- How much to offset the [code]UV[/code] coordinates. This amount will be added to [code]UV[/code] in the vertex function. This can be used to offset a texture.
-
-
- How much to scale the [code]UV[/code] coordinates. This is multiplied by [code]UV[/code] in the vertex function.
-
-
- If [code]true[/code], instead of using [code]UV[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
-
-
- A lower number blends the texture more softly while a higher number blends the texture more sharply.
- [b]Note:[/b] [member uv1_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
-
-
- How much to offset the [code]UV2[/code] coordinates. This amount will be added to [code]UV2[/code] in the vertex function. This can be used to offset a texture.
-
-
- How much to scale the [code]UV2[/code] coordinates. This is multiplied by [code]UV2[/code] in the vertex function.
-
-
- If [code]true[/code], instead of using [code]UV2[/code] textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
-
-
- A lower number blends the texture more softly while a higher number blends the texture more sharply.
- [b]Note:[/b] [member uv2_triplanar_sharpness] is clamped between [code]0.0[/code] and [code]150.0[/code] (inclusive) as values outside that range can look broken depending on the mesh.
-
-
- If [code]true[/code], the model's vertex colors are processed as sRGB mode.
-
-
- If [code]true[/code], the vertex color is used as albedo color.
-
-
-
- Texture specifying per-pixel color.
-
-
- Texture specifying per-pixel metallic value.
-
-
- Texture specifying per-pixel roughness value.
-
-
- Texture specifying per-pixel emission color.
-
-
- Texture specifying per-pixel normal vector.
-
-
- Texture specifying per-pixel rim value.
-
-
- Texture specifying per-pixel clearcoat value.
-
-
- Texture specifying per-pixel flowmap direction for use with [member anisotropy].
-
-
- Texture specifying per-pixel ambient occlusion value.
-
-
- Texture specifying per-pixel depth.
-
-
- Texture specifying per-pixel subsurface scattering.
-
-
- Texture specifying per-pixel transmission color.
-
-
- Texture specifying per-pixel refraction strength.
-
-
- Texture specifying per-pixel detail mask blending value.
-
-
- Texture specifying per-pixel detail color.
-
-
- Texture specifying per-pixel detail normal.
-
-
- Represents the size of the [enum TextureParam] enum.
-
-
- Use [code]UV[/code] with the detail texture.
-
-
- Use [code]UV2[/code] with the detail texture.
-
-
- Constant for setting [member flags_transparent].
-
-
- Constant for setting [member emission_enabled].
-
-
- Constant for setting [member normal_enabled].
-
-
- Constant for setting [member rim_enabled].
-
-
- Constant for setting [member clearcoat_enabled].
-
-
- Constant for setting [member anisotropy_enabled].
-
-
- Constant for setting [member ao_enabled].
-
-
- Constant for setting [member depth_enabled].
-
-
- Constant for setting [member subsurf_scatter_enabled].
-
-
- Constant for setting [member transmission_enabled].
-
-
- Constant for setting [member refraction_enabled].
-
-
- Constant for setting [member detail_enabled].
-
-
- Represents the size of the [enum Feature] enum.
-
-
- Default blend mode. The color of the object is blended over the background based on the object's alpha value.
-
-
- The color of the object is added to the background.
-
-
- The color of the object is subtracted from the background.
-
-
- The color of the object is multiplied by the background.
-
-
- Default depth draw mode. Depth is drawn only for opaque objects.
-
-
- Depth draw is calculated for both opaque and transparent objects.
-
-
- No depth draw.
-
-
- For transparent objects, an opaque pass is made first with the opaque parts, then transparency is drawn.
-
-
- Default cull mode. The back of the object is culled when not visible.
-
-
- The front of the object is culled when not visible.
-
-
- No culling is performed.
-
-
- No lighting is used on the object. Color comes directly from [code]ALBEDO[/code].
-
-
- Lighting is calculated per-vertex rather than per-pixel. This can be used to increase the speed of the shader at the cost of quality.
-
-
- Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it.
-
-
- 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 GLES3 renderer.
-
-
- 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].
-
-
- Object is scaled by depth so that it always appears the same size on screen.
-
-
- Shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [member params_billboard_mode] is [constant BILLBOARD_ENABLED].
-
-
- Use triplanar texture lookup for all texture lookups that would normally use [code]UV[/code].
-
-
- Use triplanar texture lookup for all texture lookups that would normally use [code]UV2[/code].
-
-
- Use [code]UV2[/code] coordinates to look up from the [member ao_texture].
-
-
- Use [code]UV2[/code] coordinates to look up from the [member emission_texture].
-
-
- Use alpha scissor. Set by [member params_use_alpha_scissor].
-
-
- Use world coordinates in the triplanar texture lookup instead of local coordinates.
-
-
- Forces the shader to convert albedo from sRGB space to linear space.
-
-
- Disables receiving shadows from other objects.
-
-
- Disables receiving ambient light.
-
-
- Ensures that normals appear correct, even with non-uniform scaling.
-
-
- Enables the shadow to opacity feature.
-
-
- Enables signed distance field rendering shader.
-
-
- Represents the size of the [enum Flags] enum.
-
-
- Default diffuse scattering algorithm.
-
-
- Diffuse scattering ignores roughness.
-
-
- Extends Lambert to cover more than 90 degrees when roughness increases.
-
-
- Attempts to use roughness to emulate microsurfacing.
-
-
- Uses a hard cut for lighting, with smoothing affected by roughness.
-
-
- Default specular blob.
-
-
- Older specular algorithm, included for compatibility.
-
-
- Older specular algorithm, included for compatibility.
-
-
- Toon blob which changes size based on roughness.
-
-
- No specular blob.
-
-
- Billboard mode is disabled.
-
-
- The object's Z axis will always face the camera.
-
-
- The object's X axis will always face the camera.
-
-
- Used for particle systems when assigned to [Particles] and [CPUParticles] nodes. Enables [code]particles_anim_*[/code] properties.
- The [member ParticlesMaterial.anim_speed] or [member CPUParticles.anim_speed] should also be set to a positive value for the animation to play.
-
-
- Used to read from the red channel of a texture.
-
-
- Used to read from the green channel of a texture.
-
-
- Used to read from the blue channel of a texture.
-
-
- Used to read from the alpha channel of a texture.
-
-
- Currently unused.
-
-
- Adds the emission color to the color from the emission texture.
-
-
- Multiplies the emission color by the color from the emission texture.
-
-
- Do not use distance fade.
-
-
- Smoothly fades the object out based on each pixel's distance from the camera using the alpha channel.
-
-
- Smoothly fades the object out based on each pixel's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
-
-
- Smoothly fades the object out based on the object's distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than [constant DISTANCE_FADE_PIXEL_ALPHA].
-
-
- The real conditioned shader needed on each situation will be sent for background compilation. In the meantime, a very complex shader that adapts to every situation will be used ("ubershader"). This ubershader is much slower to render, but will keep the game running without stalling to compile. Once shader compilation is done, the ubershader is replaced by the traditional optimized shader.
-
-
- Anything with this material applied won't be rendered while this material's shader is being compiled.
- This is useful for optimization, in cases where the visuals won't suffer from having certain non-essential elements missing during the short time their shaders are being compiled.
-
diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml
index 89910849987..fc04a0db0bb 100644
--- a/doc/classes/SpriteBase3D.xml
+++ b/doc/classes/SpriteBase3D.xml
@@ -42,7 +42,7 @@
The direction in which the front of the texture faces.
-
+
If [code]true[/code], texture will be centered.
@@ -61,7 +61,7 @@
A color value used to [i]multiply[/i] the texture's colors. Can be used for mood-coloring or to simulate the color of light.
- [b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in [member modulate] will be ignored. For a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function.
+ [b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in [member modulate] will be ignored. For a [SpatialMaterial], [member Material3D.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function.
If [code]true[/code], depth testing is disabled and the object will be drawn in render order.
@@ -71,7 +71,7 @@
The texture's visibility on a scale from [code]0[/code] (fully invisible) to [code]1[/code] (fully visible). [member opacity] is a multiplier for the [member modulate] color's alpha channel.
- [b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the opacity defined in [member opacity] will be ignored. For a [SpatialMaterial], [member SpatialMaterial.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALPHA *= COLOR.a;[/code] must be inserted in the shader's [code]fragment()[/code] function.
+ [b]Note:[/b] If a [member GeometryInstance.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the opacity defined in [member opacity] will be ignored. For a [SpatialMaterial], [member Material3D.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALPHA *= COLOR.a;[/code] must be inserted in the shader's [code]fragment()[/code] function.
The size of one pixel's width on the sprite to scale it in 3D.
diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml
index ab11d089736..98e8b4c8110 100644
--- a/doc/classes/SurfaceTool.xml
+++ b/doc/classes/SurfaceTool.xml
@@ -34,7 +34,7 @@
Specifies a [Color] to use for the [i]next[/i] vertex. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
- [b]Note:[/b] The material must have [member SpatialMaterial.vertex_color_use_as_albedo] enabled for the vertex color to be visible.
+ [b]Note:[/b] The material must have [member Material3D.vertex_color_use_as_albedo] enabled for the vertex color to be visible.
diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml
index e7091326b71..8da7943534b 100644
--- a/doc/classes/VisualServer.xml
+++ b/doc/classes/VisualServer.xml
@@ -2713,7 +2713,7 @@
- If asynchronous shader compilation is enabled, this controls whether [constant SpatialMaterial.ASYNC_MODE_HIDDEN] is obeyed.
+ If asynchronous shader compilation is enabled, this controls whether [constant Material3D.ASYNC_MODE_HIDDEN] is obeyed.
For instance, you may want to enable this temporarily before taking a screenshot. This ensures everything is visible even if shaders with async mode [i]hidden[/i] are not ready yet.
Reflection probes use this internally to ensure they capture everything regardless the shaders are ready or not.
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index f54d470ee4a..5ac14cd5dd1 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -518,7 +518,7 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, Set *
}
if (p_with_convert) {
- if (base == "SpatialMaterial") {
+ if (base == "SpatialMaterial" || base == "ORMSpatialMaterial") {
p_vector->insert("Texture");
} else if (base == "ShaderMaterial") {
p_vector->insert("Shader");
@@ -643,11 +643,22 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
if (at == "SpatialMaterial" && ClassDB::is_parent_class(dropped_resource->get_class(), "Texture")) {
// Use existing resource if possible and only replace its data.
- Ref mat = edited_resource;
+ Ref mat = edited_resource;
if (mat.is_null()) {
mat.instance();
}
- mat->set_texture(SpatialMaterial::TextureParam::TEXTURE_ALBEDO, dropped_resource);
+ mat->set_texture(Material3D::TextureParam::TEXTURE_ALBEDO, dropped_resource);
+ dropped_resource = mat;
+ break;
+ }
+
+ if (at == "ORMSpatialMaterial" && ClassDB::is_parent_class(dropped_resource->get_class(), "Texture")) {
+ // Use existing resource if possible and only replace its data.
+ Ref mat = edited_resource;
+ if (mat.is_null()) {
+ mat.instance();
+ }
+ mat->set_texture(Material3D::TextureParam::TEXTURE_ALBEDO, dropped_resource);
dropped_resource = mat;
break;
}
diff --git a/editor/icons/icon_o_r_m_spatial_material.svg b/editor/icons/icon_o_r_m_spatial_material.svg
new file mode 100644
index 00000000000..e09208155de
--- /dev/null
+++ b/editor/icons/icon_o_r_m_spatial_material.svg
@@ -0,0 +1 @@
+
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 963a33abc0e..39c44d4710c 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -336,7 +336,7 @@ Error ColladaImport::_create_material(const String &p_target) {
ERR_FAIL_COND_V(!collada.state.effect_map.has(src_mat.instance_effect), ERR_INVALID_PARAMETER);
Collada::Effect &effect = collada.state.effect_map[src_mat.instance_effect];
- Ref material = memnew(SpatialMaterial);
+ Ref material = memnew(SpatialMaterial);
if (src_mat.name != "") {
material->set_name(src_mat.name);
@@ -354,9 +354,9 @@ Error ColladaImport::_create_material(const String &p_target) {
}
Ref texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture);
+ material->set_texture(Material3D::TEXTURE_ALBEDO, texture);
material->set_albedo(Color(1, 1, 1, 1));
- //material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
+ //material->set_parameter(Material3D::PARAM_DIFFUSE,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
@@ -376,11 +376,11 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture);
+ material->set_texture(Material3D::TEXTURE_METALLIC, texture);
material->set_specular(1.0);
- //material->set_texture(SpatialMaterial::PARAM_SPECULAR,texture);
- //material->set_parameter(SpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1));
+ //material->set_texture(Material3D::PARAM_SPECULAR,texture);
+ //material->set_parameter(Material3D::PARAM_SPECULAR,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
@@ -401,18 +401,18 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
- material->set_texture(SpatialMaterial::TEXTURE_EMISSION, texture);
+ material->set_feature(Material3D::FEATURE_EMISSION, true);
+ material->set_texture(Material3D::TEXTURE_EMISSION, texture);
material->set_emission(Color(1, 1, 1, 1));
- //material->set_parameter(SpatialMaterial::PARAM_EMISSION,Color(1,1,1,1));
+ //material->set_parameter(Material3D::PARAM_EMISSION,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
}
} else {
if (effect.emission.color != Color()) {
- material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
+ material->set_feature(Material3D::FEATURE_EMISSION, true);
material->set_emission(effect.emission.color);
}
}
@@ -428,11 +428,11 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
- material->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
+ material->set_feature(Material3D::FEATURE_NORMAL_MAPPING, true);
+ material->set_texture(Material3D::TEXTURE_NORMAL, texture);
//material->set_emission(Color(1,1,1,1));
- //material->set_texture(SpatialMaterial::PARAM_NORMAL,texture);
+ //material->set_texture(Material3D::PARAM_NORMAL,texture);
} else {
//missing_textures.push_back(texfile.get_file());
}
@@ -443,9 +443,9 @@ Error ColladaImport::_create_material(const String &p_target) {
material->set_roughness(roughness);
if (effect.double_sided) {
- material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
+ material->set_cull_mode(Material3D::CULL_DISABLED);
}
- material->set_flag(SpatialMaterial::FLAG_UNSHADED, effect.unshaded);
+ material->set_flag(Material3D::FLAG_UNSHADED, effect.unshaded);
material_cache[p_target] = material;
return OK;
@@ -883,7 +883,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref &p_me
/*****************/
{
- Ref material;
+ Ref material;
{
if (p_material_map.has(p.material)) {
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index bdcc45c0c91..8462ff8174c 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -41,7 +41,7 @@ uint32_t EditorOBJImporter::get_import_flags() const {
return IMPORT_SCENE;
}
-static Error _parse_material_library(const String &p_path, Map> &material_map, List *r_missing_deps) {
+static Error _parse_material_library(const String &p_path, Map> &material_map, List *r_missing_deps) {
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, vformat("Couldn't open MTL file '%s', it may not exist or not be readable.", p_path));
@@ -99,7 +99,7 @@ static Error _parse_material_library(const String &p_path, Mapset_albedo(c);
if (c.a < 0.99) {
- current->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ current->set_feature(Material3D::FEATURE_TRANSPARENT, true);
}
} else if (l.begins_with("Tr ")) {
//normal
@@ -111,7 +111,7 @@ static Error _parse_material_library(const String &p_path, Mapset_albedo(c);
if (c.a < 0.99) {
- current->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ current->set_feature(Material3D::FEATURE_TRANSPARENT, true);
}
} else if (l.begins_with("map_Ka ")) {
@@ -133,7 +133,7 @@ static Error _parse_material_library(const String &p_path, Map texture = ResourceLoader::load(path);
if (texture.is_valid()) {
- current->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture);
+ current->set_texture(Material3D::TEXTURE_ALBEDO, texture);
} else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -153,7 +153,7 @@ static Error _parse_material_library(const String &p_path, Map texture = ResourceLoader::load(path);
if (texture.is_valid()) {
- current->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture);
+ current->set_texture(Material3D::TEXTURE_METALLIC, texture);
} else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -173,7 +173,7 @@ static Error _parse_material_library(const String &p_path, Map texture = ResourceLoader::load(path);
if (texture.is_valid()) {
- current->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, texture);
+ current->set_texture(Material3D::TEXTURE_ROUGHNESS, texture);
} else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -187,8 +187,8 @@ static Error _parse_material_library(const String &p_path, Map texture = ResourceLoader::load(path);
if (texture.is_valid()) {
- current->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
- current->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
+ current->set_feature(Material3D::FEATURE_NORMAL_MAPPING, true);
+ current->set_texture(Material3D::TEXTURE_NORMAL, texture);
} else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -217,7 +217,7 @@ static Error _parse_obj(const String &p_path, List> &r_meshes, bool p_
Vector colors;
String name;
- Map>> material_map;
+ Map>> material_map;
Ref surf_tool = memnew(SurfaceTool);
surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
@@ -361,7 +361,7 @@ static Error _parse_obj(const String &p_path, List> &r_meshes, bool p_
print_verbose("OBJ: Current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material)));
if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) {
- Ref &material = material_map[current_material_library][current_material];
+ Ref &material = material_map[current_material_library][current_material];
if (!colors.empty()) {
material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
}
@@ -411,7 +411,7 @@ static Error _parse_obj(const String &p_path, List> &r_meshes, bool p_
current_material_library = l.replace("mtllib", "").strip_edges();
if (!material_map.has(current_material_library)) {
- Map> lib;
+ Map> lib;
String lib_path = current_material_library;
if (lib_path.is_rel_path()) {
lib_path = p_path.get_base_dir().plus_file(current_material_library);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index a5862664f21..fad1403edc2 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -315,18 +315,18 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map
if (m.is_valid()) {
for (int i = 0; i < m->get_surface_count(); i++) {
- Ref mat = m->surface_get_material(i);
+ Ref mat = m->surface_get_material(i);
if (!mat.is_valid()) {
continue;
}
if (_teststr(mat->get_name(), "alpha")) {
- mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
mat->set_name(_fixstr(mat->get_name(), "alpha"));
}
if (_teststr(mat->get_name(), "vcol")) {
- mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
mat->set_name(_fixstr(mat->get_name(), "vcol"));
}
}
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index 374f7025125..b61f23e96b4 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -518,23 +518,23 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
imgeom = memnew(ImmediateGeometry);
imgeom->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
- line_material = Ref(memnew(SpatialMaterial));
- line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ line_material = Ref(memnew(SpatialMaterial));
+ line_material->set_flag(Material3D::FLAG_UNSHADED, true);
line_material->set_line_width(3.0);
- line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ line_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ line_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ line_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
line_material->set_albedo(Color(1, 1, 1));
- handle_material = Ref(memnew(SpatialMaterial));
- handle_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- handle_material->set_flag(SpatialMaterial::FLAG_USE_POINT_SIZE, true);
- handle_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- handle_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- handle_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ handle_material = Ref(memnew(SpatialMaterial));
+ handle_material->set_flag(Material3D::FLAG_UNSHADED, true);
+ handle_material->set_flag(Material3D::FLAG_USE_POINT_SIZE, true);
+ handle_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ handle_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ handle_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
Ref handle = editor->get_gui_base()->get_icon("Editor3DHandle", "EditorIcons");
handle_material->set_point_size(handle->get_width());
- handle_material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, handle);
+ handle_material->set_texture(Material3D::TEXTURE_ALBEDO, handle);
pointsm = memnew(MeshInstance);
imgeom->add_child(pointsm);
diff --git a/editor/plugins/collision_polygon_editor_plugin.h b/editor/plugins/collision_polygon_editor_plugin.h
index c83cc37f3ef..6147b6027e5 100644
--- a/editor/plugins/collision_polygon_editor_plugin.h
+++ b/editor/plugins/collision_polygon_editor_plugin.h
@@ -56,8 +56,8 @@ class Polygon3DEditor : public HBoxContainer {
ToolButton *button_create;
ToolButton *button_edit;
- Ref line_material;
- Ref handle_material;
+ Ref line_material;
+ Ref handle_material;
EditorNode *editor;
Panel *panel;
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 78f35170c42..d5afa301a14 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -263,11 +263,11 @@ String SpatialMaterialConversionPlugin::converts_to() const {
return "ShaderMaterial";
}
bool SpatialMaterialConversionPlugin::handles(const Ref &p_resource) const {
- Ref mat = p_resource;
+ Ref mat = p_resource;
return mat.is_valid();
}
Ref SpatialMaterialConversionPlugin::convert(const Ref &p_resource) const {
- Ref mat = p_resource;
+ Ref mat = p_resource;
ERR_FAIL_COND_V(!mat.is_valid(), Ref());
Ref smat;
diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp
index 12284cef6f6..4c14706d217 100644
--- a/editor/plugins/mesh_instance_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_editor_plugin.cpp
@@ -462,7 +462,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
options->get_popup()->add_item(TTR("Create Navigation Mesh"), MENU_OPTION_CREATE_NAVMESH);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Create Outline Mesh..."), MENU_OPTION_CREATE_OUTLINE_MESH);
- options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the SpatialMaterial Grow property when using that property isn't possible."));
+ options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the Material3D Grow property when using that property isn't possible."));
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("View UV1"), MENU_OPTION_DEBUG_UV1);
options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2);
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index 5b2e7b556d4..d988f8dade9 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -217,9 +217,9 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
void PathSpatialGizmo::redraw() {
clear();
- Ref path_material = gizmo_plugin->get_material("path_material", this);
- Ref path_thin_material = gizmo_plugin->get_material("path_thin_material", this);
- Ref handles_material = gizmo_plugin->get_material("handles");
+ Ref path_material = gizmo_plugin->get_material("path_material", this);
+ Ref path_thin_material = gizmo_plugin->get_material("path_thin_material", this);
+ Ref handles_material = gizmo_plugin->get_material("handles");
Ref c = path->get_curve();
if (c.is_null()) {
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 40cb3df3dc7..ffe2f546bc0 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -5028,19 +5028,19 @@ void SpatialEditor::_generate_selection_boxes() {
st_xray->add_vertex(b);
}
- Ref mat = memnew(SpatialMaterial);
- mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ Ref mat = memnew(SpatialMaterial);
+ mat->set_flag(Material3D::FLAG_UNSHADED, true);
const Color selection_box_color = EDITOR_GET("editors/3d/selection_box_color");
mat->set_albedo(selection_box_color);
- mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
st->set_material(mat);
selection_box = st->commit();
- Ref mat_xray = memnew(SpatialMaterial);
- mat_xray->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- mat_xray->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, true);
+ Ref mat_xray = memnew(SpatialMaterial);
+ mat_xray->set_flag(Material3D::FLAG_UNSHADED, true);
+ mat_xray->set_flag(Material3D::FLAG_DISABLE_DEPTH_TEST, true);
mat_xray->set_albedo(selection_box_color * Color(1, 1, 1, 0.15));
- mat_xray->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ mat_xray->set_feature(Material3D::FEATURE_TRANSPARENT, true);
st_xray->set_material(mat_xray);
selection_box_xray = st_xray->commit();
}
@@ -5618,10 +5618,10 @@ void SpatialEditor::_init_indicators() {
grid_enabled = true;
indicator_mat.instance();
- indicator_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- indicator_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- indicator_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- indicator_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ indicator_mat->set_flag(Material3D::FLAG_UNSHADED, true);
+ indicator_mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ indicator_mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
+ indicator_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
Vector origin_colors;
Vector origin_points;
@@ -5753,14 +5753,14 @@ void SpatialEditor::_init_indicators() {
scale_gizmo[i] = Ref(memnew(ArrayMesh));
scale_plane_gizmo[i] = Ref(memnew(ArrayMesh));
- Ref mat = memnew(SpatialMaterial);
- mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ Ref mat = memnew(SpatialMaterial);
+ mat->set_flag(Material3D::FLAG_UNSHADED, true);
mat->set_on_top_of_alpha();
- mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
mat->set_albedo(col);
gizmo_color[i] = mat;
- Ref mat_hl = mat->duplicate();
+ Ref mat_hl = mat->duplicate();
const Color albedo = col.from_hsv(col.get_h(), 0.25, 1.0, 1);
mat_hl->set_albedo(albedo);
gizmo_color_hl[i] = mat_hl;
@@ -5846,17 +5846,17 @@ void SpatialEditor::_init_indicators() {
surftool->add_vertex(points[2]);
surftool->add_vertex(points[3]);
- Ref plane_mat = memnew(SpatialMaterial);
- plane_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ Ref plane_mat = memnew(SpatialMaterial);
+ plane_mat->set_flag(Material3D::FLAG_UNSHADED, true);
plane_mat->set_on_top_of_alpha();
- plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
+ plane_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ plane_mat->set_cull_mode(Material3D::CULL_DISABLED);
plane_mat->set_albedo(col);
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
surftool->set_material(plane_mat);
surftool->commit(move_plane_gizmo[i]);
- Ref plane_mat_hl = plane_mat->duplicate();
+ Ref plane_mat_hl = plane_mat->duplicate();
plane_mat_hl->set_albedo(albedo);
plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
}
@@ -6055,17 +6055,17 @@ void SpatialEditor::_init_indicators() {
surftool->add_vertex(points[2]);
surftool->add_vertex(points[3]);
- Ref plane_mat = memnew(SpatialMaterial);
- plane_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ Ref plane_mat = memnew(SpatialMaterial);
+ plane_mat->set_flag(Material3D::FLAG_UNSHADED, true);
plane_mat->set_on_top_of_alpha();
- plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
+ plane_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ plane_mat->set_cull_mode(Material3D::CULL_DISABLED);
plane_mat->set_albedo(col);
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
surftool->set_material(plane_mat);
surftool->commit(scale_plane_gizmo[i]);
- Ref plane_mat_hl = plane_mat->duplicate();
+ Ref plane_mat_hl = plane_mat->duplicate();
plane_mat_hl->set_albedo(col.from_hsv(col.get_h(), 0.25, 1.0, 1));
plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
}
@@ -7398,13 +7398,13 @@ SpatialEditorPlugin::~SpatialEditorPlugin() {
void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color &p_color, bool p_billboard, bool p_on_top, bool p_use_vertex_color) {
Color instanced_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/instanced");
- Vector> mats;
+ Vector> mats;
for (int i = 0; i < 4; i++) {
bool selected = i % 2 == 1;
bool instanced = i < 2;
- Ref material = Ref(memnew(SpatialMaterial));
+ Ref material = Ref(memnew(SpatialMaterial));
Color color = instanced ? instanced_color : p_color;
@@ -7413,17 +7413,17 @@ void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color
}
material->set_albedo(color);
- material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- material->set_render_priority(SpatialMaterial::RENDER_PRIORITY_MIN + 1);
+ material->set_flag(Material3D::FLAG_UNSHADED, true);
+ material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ material->set_render_priority(Material3D::RENDER_PRIORITY_MIN + 1);
if (p_use_vertex_color) {
- material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
}
if (p_billboard) {
- material->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
+ material->set_billboard_mode(Material3D::BILLBOARD_ENABLED);
}
if (p_on_top && selected) {
@@ -7439,13 +7439,13 @@ void EditorSpatialGizmoPlugin::create_material(const String &p_name, const Color
void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const Ref &p_texture, bool p_on_top, const Color &p_albedo) {
Color instanced_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/instanced");
- Vector> icons;
+ Vector> icons;
for (int i = 0; i < 4; i++) {
bool selected = i % 2 == 1;
bool instanced = i < 2;
- Ref icon = Ref(memnew(SpatialMaterial));
+ Ref icon = Ref(memnew(SpatialMaterial));
Color color = instanced ? instanced_color : p_albedo;
@@ -7455,16 +7455,16 @@ void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const
icon->set_albedo(color);
- icon->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- icon->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- icon->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- icon->set_cull_mode(SpatialMaterial::CULL_DISABLED);
- icon->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_DISABLED);
- icon->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- icon->set_texture(SpatialMaterial::TEXTURE_ALBEDO, p_texture);
- icon->set_flag(SpatialMaterial::FLAG_FIXED_SIZE, true);
- icon->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
- icon->set_render_priority(SpatialMaterial::RENDER_PRIORITY_MIN);
+ icon->set_flag(Material3D::FLAG_UNSHADED, true);
+ icon->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ icon->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
+ icon->set_cull_mode(Material3D::CULL_DISABLED);
+ icon->set_depth_draw_mode(Material3D::DEPTH_DRAW_DISABLED);
+ icon->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ icon->set_texture(Material3D::TEXTURE_ALBEDO, p_texture);
+ icon->set_flag(Material3D::FLAG_FIXED_SIZE, true);
+ icon->set_billboard_mode(Material3D::BILLBOARD_ENABLED);
+ icon->set_render_priority(Material3D::RENDER_PRIORITY_MIN);
if (p_on_top && selected) {
icon->set_on_top_of_alpha();
@@ -7477,36 +7477,36 @@ void EditorSpatialGizmoPlugin::create_icon_material(const String &p_name, const
}
void EditorSpatialGizmoPlugin::create_handle_material(const String &p_name, bool p_billboard, const Ref &p_icon) {
- Ref handle_material = Ref(memnew(SpatialMaterial));
+ Ref handle_material = Ref(memnew(SpatialMaterial));
- handle_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- handle_material->set_flag(SpatialMaterial::FLAG_USE_POINT_SIZE, true);
+ handle_material->set_flag(Material3D::FLAG_UNSHADED, true);
+ handle_material->set_flag(Material3D::FLAG_USE_POINT_SIZE, true);
Ref handle_t = p_icon != nullptr ? p_icon : SpatialEditor::get_singleton()->get_icon("Editor3DHandle", "EditorIcons");
handle_material->set_point_size(handle_t->get_width());
- handle_material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, handle_t);
+ handle_material->set_texture(Material3D::TEXTURE_ALBEDO, handle_t);
handle_material->set_albedo(Color(1, 1, 1));
- handle_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- handle_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- handle_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ handle_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ handle_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ handle_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
handle_material->set_on_top_of_alpha();
if (p_billboard) {
- handle_material->set_billboard_mode(SpatialMaterial::BILLBOARD_ENABLED);
+ handle_material->set_billboard_mode(Material3D::BILLBOARD_ENABLED);
handle_material->set_on_top_of_alpha();
}
- materials[p_name] = Vector>();
+ materials[p_name] = Vector>();
materials[p_name].push_back(handle_material);
}
-void EditorSpatialGizmoPlugin::add_material(const String &p_name, Ref p_material) {
- materials[p_name] = Vector>();
+void EditorSpatialGizmoPlugin::add_material(const String &p_name, Ref p_material) {
+ materials[p_name] = Vector>();
materials[p_name].push_back(p_material);
}
-Ref EditorSpatialGizmoPlugin::get_material(const String &p_name, const Ref &p_gizmo) {
- ERR_FAIL_COND_V(!materials.has(p_name), Ref());
- ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref());
+Ref EditorSpatialGizmoPlugin::get_material(const String &p_name, const Ref &p_gizmo) {
+ ERR_FAIL_COND_V(!materials.has(p_name), Ref());
+ ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref());
if (p_gizmo.is_null() || materials[p_name].size() == 1) {
return materials[p_name][0];
@@ -7514,12 +7514,12 @@ Ref EditorSpatialGizmoPlugin::get_material(const String &p_name
int index = (p_gizmo->is_selected() ? 1 : 0) + (p_gizmo->is_editable() ? 2 : 0);
- Ref mat = materials[p_name][index];
+ Ref mat = materials[p_name][index];
if (current_state == ON_TOP && p_gizmo->is_selected()) {
- mat->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, true);
+ mat->set_flag(Material3D::FLAG_DISABLE_DEPTH_TEST, true);
} else {
- mat->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, false);
+ mat->set_flag(Material3D::FLAG_DISABLE_DEPTH_TEST, false);
}
return mat;
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 52caa146488..f761bd66080 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -619,11 +619,11 @@ private:
bool grid_enabled;
Ref move_gizmo[3], move_plane_gizmo[3], rotate_gizmo[4], scale_gizmo[3], scale_plane_gizmo[3];
- Ref gizmo_color[3];
- Ref plane_gizmo_color[3];
+ Ref gizmo_color[3];
+ Ref plane_gizmo_color[3];
Ref rotate_gizmo_color[3];
- Ref gizmo_color_hl[3];
- Ref plane_gizmo_color_hl[3];
+ Ref gizmo_color_hl[3];
+ Ref plane_gizmo_color_hl[3];
Ref rotate_gizmo_color_hl[3];
int over_gizmo_handle;
@@ -637,9 +637,9 @@ private:
RID indicators_instance;
RID cursor_mesh;
RID cursor_instance;
- Ref indicator_mat;
+ Ref indicator_mat;
Ref grid_mat[3];
- Ref cursor_material;
+ Ref cursor_material;
// Scene drag and drop support
Spatial *preview_node;
@@ -896,7 +896,7 @@ public:
protected:
int current_state;
List current_gizmos;
- HashMap>> materials;
+ HashMap>> materials;
static void _bind_methods();
virtual bool has_gizmo(Spatial *p_spatial);
@@ -906,9 +906,9 @@ public:
void create_material(const String &p_name, const Color &p_color, bool p_billboard = false, bool p_on_top = false, bool p_use_vertex_color = false);
void create_icon_material(const String &p_name, const Ref &p_texture, bool p_on_top = false, const Color &p_albedo = Color(1, 1, 1, 1));
void create_handle_material(const String &p_name, bool p_billboard = false, const Ref &p_icon = nullptr);
- void add_material(const String &p_name, Ref p_material);
+ void add_material(const String &p_name, Ref p_material);
- Ref get_material(const String &p_name, const Ref &p_gizmo = Ref());
+ Ref get_material(const String &p_name, const Ref &p_gizmo = Ref());
virtual String get_name() const;
virtual int get_priority() const;
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 40b49688189..4546c0742cd 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -1644,11 +1644,11 @@ Position3DSpatialGizmoPlugin::Position3DSpatialGizmoPlugin() {
cursor_colors.push_back(color_z.linear_interpolate(Color(0, 0, 0), 0.75));
cursor_colors.push_back(color_z.linear_interpolate(Color(0, 0, 0), 0.75));
- Ref mat = memnew(SpatialMaterial);
- mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ Ref mat = memnew(SpatialMaterial);
+ mat->set_flag(Material3D::FLAG_UNSHADED, true);
+ mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
+ mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
mat->set_line_width(3);
Array d;
d.resize(VS::ARRAY_MAX);
@@ -1990,7 +1990,7 @@ void RayCastSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->clear();
- const Ref material = raycast->is_enabled() ? raycast->get_debug_material() : get_material("shape_material_disabled");
+ const Ref material = raycast->is_enabled() ? raycast->get_debug_material() : get_material("shape_material_disabled");
p_gizmo->add_lines(raycast->get_debug_line_vertices(), material);
@@ -2028,7 +2028,7 @@ void ShapeCastGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->clear();
- const Ref material = shapecast->is_enabled() ? shapecast->get_debug_material() : get_material("shape_material_disabled");
+ const Ref material = shapecast->is_enabled() ? shapecast->get_debug_material() : get_material("shape_material_disabled");
p_gizmo->add_lines(shapecast->get_debug_line_vertices(), material);
@@ -2051,7 +2051,7 @@ void SpringArmSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
lines.push_back(Vector3());
lines.push_back(Vector3(0, 0, 1.0) * spring_arm->get_length());
- Ref material = get_material("shape_material", p_gizmo);
+ Ref material = get_material("shape_material", p_gizmo);
p_gizmo->add_lines(lines, material);
p_gizmo->add_collision_segments(lines);
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 6e6380d7c18..f227e207c25 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -878,7 +878,7 @@ void SpaceBullet::update_gravity() {
static ImmediateGeometry *motionVec(NULL);
static ImmediateGeometry *normalLine(NULL);
-static Ref red_mat;
+static Ref red_mat;
static Ref blue_mat;
#endif
@@ -895,21 +895,21 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
motionVec->set_as_toplevel(true);
normalLine->set_as_toplevel(true);
- red_mat = Ref(memnew(SpatialMaterial));
- red_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ red_mat = Ref(memnew(SpatialMaterial));
+ red_mat->set_flag(Material3D::FLAG_UNSHADED, true);
red_mat->set_line_width(20.0);
- red_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- red_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- red_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ red_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ red_mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ red_mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
red_mat->set_albedo(Color(1, 0, 0, 1));
motionVec->set_material_override(red_mat);
- blue_mat = Ref(memnew(SpatialMaterial));
- blue_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ blue_mat = Ref(memnew(SpatialMaterial));
+ blue_mat->set_flag(Material3D::FLAG_UNSHADED, true);
blue_mat->set_line_width(20.0);
- blue_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- blue_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- blue_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ blue_mat->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ blue_mat->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ blue_mat->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
blue_mat->set_albedo(Color(0, 0, 1, 1));
normalLine->set_material_override(blue_mat);
}
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index c6518e4ee30..5b76495f68b 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -961,7 +961,7 @@ void CSGMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_material"), &CSGMesh::get_material);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
}
void CSGMesh::set_mesh(const Ref &p_mesh) {
@@ -1128,7 +1128,7 @@ void CSGSphere::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
}
void CSGSphere::set_radius(const float p_radius) {
@@ -1307,7 +1307,7 @@ void CSGBox::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "width", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_width", "get_width");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
}
void CSGBox::set_width(const float p_width) {
@@ -1521,7 +1521,7 @@ void CSGCylinder::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cone"), "set_cone", "is_cone");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
}
void CSGCylinder::set_radius(const float p_radius) {
@@ -1748,7 +1748,7 @@ void CSGTorus::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides");
ADD_PROPERTY(PropertyInfo(Variant::INT, "ring_sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_ring_sides", "get_ring_sides");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
}
void CSGTorus::set_inner_radius(const float p_inner_radius) {
@@ -2266,7 +2266,7 @@ void CSGPolygon::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_u_distance", PROPERTY_HINT_RANGE, "0.0,10.0,0.01,or_greater"), "set_path_u_distance", "get_path_u_distance");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "path_joined"), "set_path_joined", "is_path_joined");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ORMSpatialMaterial,ShaderMaterial"), "set_material", "get_material");
BIND_ENUM_CONSTANT(MODE_DEPTH);
BIND_ENUM_CONSTANT(MODE_SPIN);
diff --git a/modules/fbx/data/fbx_material.cpp b/modules/fbx/data/fbx_material.cpp
index 56452384882..f8aa99f4b1c 100644
--- a/modules/fbx/data/fbx_material.cpp
+++ b/modules/fbx/data/fbx_material.cpp
@@ -184,7 +184,7 @@ FBXMaterial::MaterialInfo FBXMaterial::extract_material_info(const FBXDocParser:
const String texture_name = absoulte_fbx_file_path.get_file();
print_verbose("Getting FBX mapping mode for " + String(fbx_mapping_name.c_str()));
- const SpatialMaterial::TextureParam mapping_mode = fbx_texture_mapping_desc.at(fbx_mapping_name);
+ const Material3D::TextureParam mapping_mode = fbx_texture_mapping_desc.at(fbx_mapping_name);
print_verbose("Set FBX mapping mode to " + get_texture_param_name(mapping_mode));
TextureFileMapping file_mapping;
file_mapping.map_mode = mapping_mode;
@@ -194,42 +194,43 @@ FBXMaterial::MaterialInfo FBXMaterial::extract_material_info(const FBXDocParser:
// Make sure to active the various features.
switch (mapping_mode) {
- case SpatialMaterial::TextureParam::TEXTURE_ALBEDO:
- case SpatialMaterial::TextureParam::TEXTURE_METALLIC:
- case SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS:
- case SpatialMaterial::TextureParam::TEXTURE_FLOWMAP:
- case SpatialMaterial::TextureParam::TEXTURE_REFRACTION:
- case SpatialMaterial::TextureParam::TEXTURE_MAX:
+ case Material3D::TextureParam::TEXTURE_ALBEDO:
+ case Material3D::TextureParam::TEXTURE_METALLIC:
+ case Material3D::TextureParam::TEXTURE_ROUGHNESS:
+ case Material3D::TextureParam::TEXTURE_ORM:
+ case Material3D::TextureParam::TEXTURE_FLOWMAP:
+ case Material3D::TextureParam::TEXTURE_REFRACTION:
+ case Material3D::TextureParam::TEXTURE_MAX:
// No features required.
break;
- case SpatialMaterial::TextureParam::TEXTURE_EMISSION:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_EMISSION);
+ case Material3D::TextureParam::TEXTURE_EMISSION:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_EMISSION);
break;
- case SpatialMaterial::TextureParam::TEXTURE_NORMAL:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_NORMAL_MAPPING);
+ case Material3D::TextureParam::TEXTURE_NORMAL:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_NORMAL_MAPPING);
break;
- case SpatialMaterial::TextureParam::TEXTURE_RIM:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_RIM);
+ case Material3D::TextureParam::TEXTURE_RIM:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_RIM);
break;
- case SpatialMaterial::TextureParam::TEXTURE_CLEARCOAT:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_CLEARCOAT);
+ case Material3D::TextureParam::TEXTURE_CLEARCOAT:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_CLEARCOAT);
break;
- case SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_AMBIENT_OCCLUSION);
+ case Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_AMBIENT_OCCLUSION);
break;
- case SpatialMaterial::TextureParam::TEXTURE_DEPTH:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_DEPTH_MAPPING);
+ case Material3D::TextureParam::TEXTURE_DEPTH:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_DEPTH_MAPPING);
break;
- case SpatialMaterial::TextureParam::TEXTURE_SUBSURFACE_SCATTERING:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_SUBSURACE_SCATTERING);
+ case Material3D::TextureParam::TEXTURE_SUBSURFACE_SCATTERING:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_SUBSURACE_SCATTERING);
break;
- case SpatialMaterial::TextureParam::TEXTURE_TRANSMISSION:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_TRANSMISSION);
+ case Material3D::TextureParam::TEXTURE_TRANSMISSION:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_TRANSMISSION);
break;
- case SpatialMaterial::TextureParam::TEXTURE_DETAIL_ALBEDO:
- case SpatialMaterial::TextureParam::TEXTURE_DETAIL_MASK:
- case SpatialMaterial::TextureParam::TEXTURE_DETAIL_NORMAL:
- mat_info.features.push_back(SpatialMaterial::Feature::FEATURE_DETAIL);
+ case Material3D::TextureParam::TEXTURE_DETAIL_ALBEDO:
+ case Material3D::TextureParam::TEXTURE_DETAIL_MASK:
+ case Material3D::TextureParam::TEXTURE_DETAIL_NORMAL:
+ mat_info.features.push_back(Material3D::Feature::FEATURE_DETAIL);
break;
}
}
@@ -247,12 +248,12 @@ T extract_from_prop(FBXDocParser::PropertyPtr prop, const T &p_default, const st
return val->Value();
}
-Ref FBXMaterial::import_material(ImportState &state) {
+Ref FBXMaterial::import_material(ImportState &state) {
ERR_FAIL_COND_V(material == nullptr, nullptr);
const String p_fbx_current_directory = state.path;
- Ref spatial_material;
+ Ref spatial_material;
// read the material file
// is material two sided
@@ -364,8 +365,8 @@ Ref FBXMaterial::import_material(ImportState &state) {
Color c = spatial_material->get_albedo();
c.a = opacity;
spatial_material->set_albedo(c);
- material_info.features.push_back(SpatialMaterial::Feature::FEATURE_TRANSPARENT);
- spatial_material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
+ material_info.features.push_back(Material3D::Feature::FEATURE_TRANSPARENT);
+ spatial_material->set_depth_draw_mode(Material3D::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
}
} else if (vector_value) {
print_error("unsupported transparent desc type vector!");
@@ -410,7 +411,7 @@ Ref FBXMaterial::import_material(ImportState &state) {
} break;
case PROPERTY_DESC_COAT: {
if (real_value) {
- material_info.features.push_back(SpatialMaterial::Feature::FEATURE_CLEARCOAT);
+ material_info.features.push_back(Material3D::Feature::FEATURE_CLEARCOAT);
print_verbose("clearcoat real value: " + rtos(real_value->Value()));
spatial_material->set_clearcoat(MIN(1.0f, real_value->Value()));
} else {
@@ -423,7 +424,7 @@ Ref FBXMaterial::import_material(ImportState &state) {
print_verbose("clearcoat real value: " + rtos(real_value->Value()));
spatial_material->set_clearcoat_gloss(1.0 - real_value->Value());
- material_info.features.push_back(SpatialMaterial::Feature::FEATURE_CLEARCOAT);
+ material_info.features.push_back(Material3D::Feature::FEATURE_CLEARCOAT);
} else {
print_error("unsupported value type for clearcoat gloss");
}
@@ -432,7 +433,7 @@ Ref FBXMaterial::import_material(ImportState &state) {
if (real_value && Math::is_equal_approx(real_value->Value(), 0.0f)) {
print_verbose("Emissive real value: " + rtos(real_value->Value()));
spatial_material->set_emission_energy(real_value->Value());
- material_info.features.push_back(SpatialMaterial::Feature::FEATURE_EMISSION);
+ material_info.features.push_back(Material3D::Feature::FEATURE_EMISSION);
} else if (vector_value && !vector_value->Value().is_equal_approx(Vector3(0, 0, 0))) {
const Vector3 &color = vector_value->Value();
Color c;
@@ -440,7 +441,7 @@ Ref FBXMaterial::import_material(ImportState &state) {
c[1] = color[1];
c[2] = color[2];
spatial_material->set_emission(c);
- material_info.features.push_back(SpatialMaterial::Feature::FEATURE_EMISSION);
+ material_info.features.push_back(Material3D::Feature::FEATURE_EMISSION);
}
} break;
case PROPERTY_DESC_EMISSIVE_COLOR: {
@@ -548,31 +549,31 @@ Ref FBXMaterial::import_material(ImportState &state) {
}
switch (mapping.map_mode) {
- case SpatialMaterial::TextureParam::TEXTURE_METALLIC:
+ case Material3D::TextureParam::TEXTURE_METALLIC:
if (mapping.name.to_lower().find("ser") >= 0) {
// SER shader.
- spatial_material->set_metallic_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED);
+ spatial_material->set_metallic_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_RED);
} else {
// Use grayscale as default.
- spatial_material->set_metallic_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
+ spatial_material->set_metallic_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
}
break;
- case SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS:
+ case Material3D::TextureParam::TEXTURE_ROUGHNESS:
if (mapping.name.to_lower().find("ser") >= 0) {
// SER shader.
- spatial_material->set_roughness_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE);
+ spatial_material->set_roughness_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE);
} else {
// Use grayscale as default.
- spatial_material->set_roughness_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
+ spatial_material->set_roughness_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
}
break;
- case SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
+ case Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION:
// Use grayscale as default.
- spatial_material->set_ao_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
+ spatial_material->set_ao_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
break;
- case SpatialMaterial::TextureParam::TEXTURE_REFRACTION:
+ case Material3D::TextureParam::TEXTURE_REFRACTION:
// Use grayscale as default.
- spatial_material->set_refraction_texture_channel(SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
+ spatial_material->set_refraction_texture_channel(Material3D::TextureChannel::TEXTURE_CHANNEL_GRAYSCALE);
break;
default:
// Nothing to do.
diff --git a/modules/fbx/data/fbx_material.h b/modules/fbx/data/fbx_material.h
index 1b89216dd99..dbbe17ced9a 100644
--- a/modules/fbx/data/fbx_material.h
+++ b/modules/fbx/data/fbx_material.h
@@ -71,41 +71,41 @@ struct FBXMaterial : public Reference {
};
/* Returns the string representation of the TextureParam enum */
- static String get_texture_param_name(SpatialMaterial::TextureParam param) {
+ static String get_texture_param_name(Material3D::TextureParam param) {
switch (param) {
- case SpatialMaterial::TEXTURE_ALBEDO:
+ case Material3D::TEXTURE_ALBEDO:
return "TEXTURE_ALBEDO";
- case SpatialMaterial::TEXTURE_METALLIC:
+ case Material3D::TEXTURE_METALLIC:
return "TEXTURE_METALLIC";
- case SpatialMaterial::TEXTURE_ROUGHNESS:
+ case Material3D::TEXTURE_ROUGHNESS:
return "TEXTURE_ROUGHNESS";
- case SpatialMaterial::TEXTURE_EMISSION:
+ case Material3D::TEXTURE_EMISSION:
return "TEXTURE_EMISSION";
- case SpatialMaterial::TEXTURE_NORMAL:
+ case Material3D::TEXTURE_NORMAL:
return "TEXTURE_NORMAL";
- case SpatialMaterial::TEXTURE_RIM:
+ case Material3D::TEXTURE_RIM:
return "TEXTURE_RIM";
- case SpatialMaterial::TEXTURE_CLEARCOAT:
+ case Material3D::TEXTURE_CLEARCOAT:
return "TEXTURE_CLEARCOAT";
- case SpatialMaterial::TEXTURE_FLOWMAP:
+ case Material3D::TEXTURE_FLOWMAP:
return "TEXTURE_FLOWMAP";
- case SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION:
+ case Material3D::TEXTURE_AMBIENT_OCCLUSION:
return "TEXTURE_AMBIENT_OCCLUSION";
- case SpatialMaterial::TEXTURE_DEPTH:
+ case Material3D::TEXTURE_DEPTH:
return "TEXTURE_DEPTH";
- case SpatialMaterial::TEXTURE_SUBSURFACE_SCATTERING:
+ case Material3D::TEXTURE_SUBSURFACE_SCATTERING:
return "TEXTURE_SUBSURFACE_SCATTERING";
- case SpatialMaterial::TEXTURE_TRANSMISSION:
+ case Material3D::TEXTURE_TRANSMISSION:
return "TEXTURE_TRANSMISSION";
- case SpatialMaterial::TEXTURE_REFRACTION:
+ case Material3D::TEXTURE_REFRACTION:
return "TEXTURE_REFRACTION";
- case SpatialMaterial::TEXTURE_DETAIL_MASK:
+ case Material3D::TEXTURE_DETAIL_MASK:
return "TEXTURE_DETAIL_MASK";
- case SpatialMaterial::TEXTURE_DETAIL_ALBEDO:
+ case Material3D::TEXTURE_DETAIL_ALBEDO:
return "TEXTURE_DETAIL_ALBEDO";
- case SpatialMaterial::TEXTURE_DETAIL_NORMAL:
+ case Material3D::TEXTURE_DETAIL_NORMAL:
return "TEXTURE_DETAIL_NORMAL";
- case SpatialMaterial::TEXTURE_MAX:
+ case Material3D::TEXTURE_MAX:
return "TEXTURE_MAX";
default:
return "broken horribly";
@@ -113,69 +113,69 @@ struct FBXMaterial : public Reference {
};
// TODO make this static?
- const std::map fbx_feature_mapping_desc = {
+ const std::map fbx_feature_mapping_desc = {
/* Transparent */
- { "TransparentColor", SpatialMaterial::Feature::FEATURE_TRANSPARENT },
- { "Maya|opacity", SpatialMaterial::Feature::FEATURE_TRANSPARENT }
+ { "TransparentColor", Material3D::Feature::FEATURE_TRANSPARENT },
+ { "Maya|opacity", Material3D::Feature::FEATURE_TRANSPARENT }
};
// TODO make this static?
- const std::map fbx_texture_mapping_desc = {
+ const std::map fbx_texture_mapping_desc = {
/* Diffuse */
- { "Maya|base", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
- { "DiffuseColor", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
- { "Maya|DiffuseTexture", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
- { "Maya|baseColor", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
- { "Maya|baseColor|file", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
- { "3dsMax|Parameters|base_color_map", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
- { "Maya|TEX_color_map|file", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
- { "Maya|TEX_color_map", SpatialMaterial::TextureParam::TEXTURE_ALBEDO },
+ { "Maya|base", Material3D::TextureParam::TEXTURE_ALBEDO },
+ { "DiffuseColor", Material3D::TextureParam::TEXTURE_ALBEDO },
+ { "Maya|DiffuseTexture", Material3D::TextureParam::TEXTURE_ALBEDO },
+ { "Maya|baseColor", Material3D::TextureParam::TEXTURE_ALBEDO },
+ { "Maya|baseColor|file", Material3D::TextureParam::TEXTURE_ALBEDO },
+ { "3dsMax|Parameters|base_color_map", Material3D::TextureParam::TEXTURE_ALBEDO },
+ { "Maya|TEX_color_map|file", Material3D::TextureParam::TEXTURE_ALBEDO },
+ { "Maya|TEX_color_map", Material3D::TextureParam::TEXTURE_ALBEDO },
/* Emission */
- { "EmissiveColor", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
- { "EmissiveFactor", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
- { "Maya|emissionColor", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
- { "Maya|emissionColor|file", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
- { "3dsMax|Parameters|emission_map", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
- { "Maya|TEX_emissive_map", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
- { "Maya|TEX_emissive_map|file", SpatialMaterial::TextureParam::TEXTURE_EMISSION },
+ { "EmissiveColor", Material3D::TextureParam::TEXTURE_EMISSION },
+ { "EmissiveFactor", Material3D::TextureParam::TEXTURE_EMISSION },
+ { "Maya|emissionColor", Material3D::TextureParam::TEXTURE_EMISSION },
+ { "Maya|emissionColor|file", Material3D::TextureParam::TEXTURE_EMISSION },
+ { "3dsMax|Parameters|emission_map", Material3D::TextureParam::TEXTURE_EMISSION },
+ { "Maya|TEX_emissive_map", Material3D::TextureParam::TEXTURE_EMISSION },
+ { "Maya|TEX_emissive_map|file", Material3D::TextureParam::TEXTURE_EMISSION },
/* Metallic */
- { "Maya|metalness", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "Maya|metalness|file", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "3dsMax|Parameters|metalness_map", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "Maya|TEX_metallic_map", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "Maya|TEX_metallic_map|file", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "SpecularColor", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "Maya|specularColor", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "Maya|SpecularTexture", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
- { "Maya|SpecularTexture|file", SpatialMaterial::TextureParam::TEXTURE_METALLIC },
+ { "Maya|metalness", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "Maya|metalness|file", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "3dsMax|Parameters|metalness_map", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "Maya|TEX_metallic_map", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "Maya|TEX_metallic_map|file", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "SpecularColor", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "Maya|specularColor", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "Maya|SpecularTexture", Material3D::TextureParam::TEXTURE_METALLIC },
+ { "Maya|SpecularTexture|file", Material3D::TextureParam::TEXTURE_METALLIC },
/* Roughness */
// Arnold Roughness Map
- { "Maya|specularRoughness", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
+ { "Maya|specularRoughness", Material3D::TextureParam::TEXTURE_ROUGHNESS },
- { "3dsMax|Parameters|roughness_map", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
- { "Maya|TEX_roughness_map", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
- { "Maya|TEX_roughness_map|file", SpatialMaterial::TextureParam::TEXTURE_ROUGHNESS },
+ { "3dsMax|Parameters|roughness_map", Material3D::TextureParam::TEXTURE_ROUGHNESS },
+ { "Maya|TEX_roughness_map", Material3D::TextureParam::TEXTURE_ROUGHNESS },
+ { "Maya|TEX_roughness_map|file", Material3D::TextureParam::TEXTURE_ROUGHNESS },
/* Normal */
- { "NormalMap", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
- //{ "Bump", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
- //{ "3dsMax|Parameters|bump_map", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
- { "Maya|NormalTexture", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
- //{ "Maya|normalCamera", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
- //{ "Maya|normalCamera|file", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
- { "Maya|TEX_normal_map", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
- { "Maya|TEX_normal_map|file", SpatialMaterial::TextureParam::TEXTURE_NORMAL },
+ { "NormalMap", Material3D::TextureParam::TEXTURE_NORMAL },
+ //{ "Bump", Material3D::TextureParam::TEXTURE_NORMAL },
+ //{ "3dsMax|Parameters|bump_map", Material3D::TextureParam::TEXTURE_NORMAL },
+ { "Maya|NormalTexture", Material3D::TextureParam::TEXTURE_NORMAL },
+ //{ "Maya|normalCamera", Material3D::TextureParam::TEXTURE_NORMAL },
+ //{ "Maya|normalCamera|file", Material3D::TextureParam::TEXTURE_NORMAL },
+ { "Maya|TEX_normal_map", Material3D::TextureParam::TEXTURE_NORMAL },
+ { "Maya|TEX_normal_map|file", Material3D::TextureParam::TEXTURE_NORMAL },
/* AO */
- { "Maya|TEX_ao_map", SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
- { "Maya|TEX_ao_map|file", SpatialMaterial::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
+ { "Maya|TEX_ao_map", Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
+ { "Maya|TEX_ao_map|file", Material3D::TextureParam::TEXTURE_AMBIENT_OCCLUSION },
- //{ "Maya|diffuseRoughness", SpatialMaterial::TextureParam::UNSUPPORTED },
- //{ "Maya|diffuseRoughness|file", SpatialMaterial::TextureParam::UNSUPPORTED },
- //{ "ShininessExponent", SpatialMaterial::TextureParam::UNSUPPORTED },
- //{ "ReflectionFactor", SpatialMaterial::TextureParam::UNSUPPORTED },
- //{ "TransparentColor",SpatialMaterial::TextureParam::TEXTURE_CHANNEL_ALPHA },
- //{ "TransparencyFactor",SpatialMaterial::TextureParam::TEXTURE_CHANNEL_ALPHA }
+ //{ "Maya|diffuseRoughness", Material3D::TextureParam::UNSUPPORTED },
+ //{ "Maya|diffuseRoughness|file", Material3D::TextureParam::UNSUPPORTED },
+ //{ "ShininessExponent", Material3D::TextureParam::UNSUPPORTED },
+ //{ "ReflectionFactor", Material3D::TextureParam::UNSUPPORTED },
+ //{ "TransparentColor",Material3D::TextureParam::TEXTURE_CHANNEL_ALPHA },
+ //{ "TransparencyFactor",Material3D::TextureParam::TEXTURE_CHANNEL_ALPHA }
};
// TODO make this static?
@@ -261,7 +261,7 @@ struct FBXMaterial : public Reference {
};
struct TextureFileMapping {
- SpatialMaterial::TextureParam map_mode = SpatialMaterial::TEXTURE_ALBEDO;
+ Material3D::TextureParam map_mode = Material3D::TEXTURE_ALBEDO;
String name = String();
const FBXDocParser::Texture *texture = nullptr;
};
@@ -269,7 +269,7 @@ struct FBXMaterial : public Reference {
/* storing the texture properties like color */
template
struct TexturePropertyMapping : Reference {
- SpatialMaterial::TextureParam map_mode = SpatialMaterial::TextureParam::TEXTURE_ALBEDO;
+ Material3D::TextureParam map_mode = Material3D::TextureParam::TEXTURE_ALBEDO;
const T property = T();
};
@@ -283,12 +283,12 @@ struct FBXMaterial : public Reference {
struct MaterialInfo {
Vector textures;
- Vector features;
+ Vector features;
};
/// Extracts the material information.
MaterialInfo extract_material_info(const FBXDocParser::Material *material) const;
- Ref import_material(ImportState &state);
+ Ref import_material(ImportState &state);
};
#endif // FBX_MATERIAL_H
diff --git a/modules/fbx/data/fbx_mesh_data.cpp b/modules/fbx/data/fbx_mesh_data.cpp
index 22d0e2afbac..02897a493fd 100644
--- a/modules/fbx/data/fbx_mesh_data.cpp
+++ b/modules/fbx/data/fbx_mesh_data.cpp
@@ -110,7 +110,7 @@ struct SurfaceData {
Ref surface_tool;
OrderedHashMap lookup_table; // proposed fix is to replace lookup_table[vertex_id] to give the position of the vertices_map[int] index.
LocalVector vertices_map; // this must be ordered the same as insertion <-- slow to do find() operation.
- Ref material;
+ Ref material;
HashMap> surface_polygon_vertex;
Array morphs;
};
diff --git a/modules/fbx/data/import_state.h b/modules/fbx/data/import_state.h
index 481b3d95985..e15d8a59c84 100644
--- a/modules/fbx/data/import_state.h
+++ b/modules/fbx/data/import_state.h
@@ -67,7 +67,7 @@ struct ImportState {
bool is_blender_fbx = false;
Map> cached_image_searches;
- Map> cached_materials;
+ Map> cached_materials;
String path = String();
Spatial *root_owner = nullptr;
diff --git a/modules/fbx/editor_scene_importer_fbx.cpp b/modules/fbx/editor_scene_importer_fbx.cpp
index ff0432f4a04..faebc560e7d 100644
--- a/modules/fbx/editor_scene_importer_fbx.cpp
+++ b/modules/fbx/editor_scene_importer_fbx.cpp
@@ -530,7 +530,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
material.instance();
material->set_imported_material(mat);
- Ref godot_material = material->import_material(state);
+ Ref godot_material = material->import_material(state);
state.cached_materials.insert(material_id, godot_material);
}
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index dc0f4b5c0c8..505ab1cae85 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -2587,7 +2587,7 @@ Error GLTFDocument::_serialize_meshes(Ref p_state) {
if (surface_i < instance_materials.size()) {
v = instance_materials.get(surface_i);
}
- Ref mat = v;
+ Ref mat = v;
if (!mat.is_valid()) {
mat = import_mesh->surface_get_material(surface_i);
}
@@ -2919,20 +2919,20 @@ Error GLTFDocument::_parse_meshes(Ref p_state) {
//just add it
- Ref mat;
+ Ref mat;
if (p.has("material")) {
const int material = p["material"];
ERR_FAIL_INDEX_V(material, p_state->materials.size(), ERR_FILE_CORRUPT);
- Ref mat3d = p_state->materials[material];
+ Ref mat3d = p_state->materials[material];
if (has_vertex_color) {
- mat3d->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ mat3d->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
}
mat = mat3d;
} else if (has_vertex_color) {
- Ref mat3d;
+ Ref mat3d;
mat3d.instance();
- mat3d->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ mat3d->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
mat = mat3d;
}
int32_t mat_idx = import_mesh->get_surface_count();
@@ -3377,7 +3377,7 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
for (int32_t i = 0; i < p_state->materials.size(); i++) {
Dictionary d;
- Ref material = p_state->materials[i];
+ Ref material = p_state->materials[i];
if (material.is_null()) {
materials.push_back(d);
continue;
@@ -3398,7 +3398,7 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
}
{
Dictionary bct;
- Ref albedo_texture = material->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
+ Ref albedo_texture = material->get_texture(Material3D::TEXTURE_ALBEDO);
GLTFTextureIndex gltf_texture_index = -1;
if (albedo_texture.is_valid() && albedo_texture->get_data().is_valid()) {
@@ -3418,17 +3418,17 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
mr["metallicFactor"] = material->get_metallic();
mr["roughnessFactor"] = material->get_roughness();
- bool has_roughness = material->get_texture(SpatialMaterial::TEXTURE_ROUGHNESS).is_valid() && material->get_texture(SpatialMaterial::TEXTURE_ROUGHNESS)->get_data().is_valid();
- bool has_ao = material->get_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION) && material->get_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION).is_valid();
- bool has_metalness = material->get_texture(SpatialMaterial::TEXTURE_METALLIC).is_valid() && material->get_texture(SpatialMaterial::TEXTURE_METALLIC)->get_data().is_valid();
+ bool has_roughness = material->get_texture(Material3D::TEXTURE_ROUGHNESS).is_valid() && material->get_texture(Material3D::TEXTURE_ROUGHNESS)->get_data().is_valid();
+ bool has_ao = material->get_feature(Material3D::FEATURE_AMBIENT_OCCLUSION) && material->get_texture(Material3D::TEXTURE_AMBIENT_OCCLUSION).is_valid();
+ bool has_metalness = material->get_texture(Material3D::TEXTURE_METALLIC).is_valid() && material->get_texture(Material3D::TEXTURE_METALLIC)->get_data().is_valid();
if (has_ao || has_roughness || has_metalness) {
Dictionary mrt;
- Ref roughness_texture = material->get_texture(SpatialMaterial::TEXTURE_ROUGHNESS);
- SpatialMaterial::TextureChannel roughness_channel = material->get_roughness_texture_channel();
- Ref metallic_texture = material->get_texture(SpatialMaterial::TEXTURE_METALLIC);
- SpatialMaterial::TextureChannel metalness_channel = material->get_metallic_texture_channel();
- Ref ao_texture = material->get_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION);
- SpatialMaterial::TextureChannel ao_channel = material->get_ao_texture_channel();
+ Ref roughness_texture = material->get_texture(Material3D::TEXTURE_ROUGHNESS);
+ Material3D::TextureChannel roughness_channel = material->get_roughness_texture_channel();
+ Ref metallic_texture = material->get_texture(Material3D::TEXTURE_METALLIC);
+ Material3D::TextureChannel metalness_channel = material->get_metallic_texture_channel();
+ Ref ao_texture = material->get_texture(Material3D::TEXTURE_AMBIENT_OCCLUSION);
+ Material3D::TextureChannel ao_channel = material->get_ao_texture_channel();
Ref orm_texture;
orm_texture.instance();
Ref orm_image;
@@ -3474,7 +3474,7 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
metallness_image->decompress();
}
}
- Ref albedo_texture = material->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
+ Ref albedo_texture = material->get_texture(Material3D::TEXTURE_ALBEDO);
if (albedo_texture.is_valid() && albedo_texture->get_data().is_valid()) {
height = albedo_texture->get_height();
width = albedo_texture->get_width();
@@ -3495,39 +3495,39 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
Color c = Color(1.0f, 1.0f, 1.0f);
if (has_ao) {
ao_image->lock();
- if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED == ao_channel) {
+ if (Material3D::TextureChannel::TEXTURE_CHANNEL_RED == ao_channel) {
c.r = ao_image->get_pixel(w, h).r;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GREEN == ao_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_GREEN == ao_channel) {
c.r = ao_image->get_pixel(w, h).g;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE == ao_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE == ao_channel) {
c.r = ao_image->get_pixel(w, h).b;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_ALPHA == ao_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_ALPHA == ao_channel) {
c.r = ao_image->get_pixel(w, h).a;
}
ao_image->lock();
}
if (has_roughness) {
roughness_image->lock();
- if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED == roughness_channel) {
+ if (Material3D::TextureChannel::TEXTURE_CHANNEL_RED == roughness_channel) {
c.g = roughness_image->get_pixel(w, h).r;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GREEN == roughness_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_GREEN == roughness_channel) {
c.g = roughness_image->get_pixel(w, h).g;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE == roughness_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE == roughness_channel) {
c.g = roughness_image->get_pixel(w, h).b;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_ALPHA == roughness_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_ALPHA == roughness_channel) {
c.g = roughness_image->get_pixel(w, h).a;
}
roughness_image->unlock();
}
if (has_metalness) {
metallness_image->lock();
- if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_RED == metalness_channel) {
+ if (Material3D::TextureChannel::TEXTURE_CHANNEL_RED == metalness_channel) {
c.b = metallness_image->get_pixel(w, h).r;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_GREEN == metalness_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_GREEN == metalness_channel) {
c.b = metallness_image->get_pixel(w, h).g;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_BLUE == metalness_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_BLUE == metalness_channel) {
c.b = metallness_image->get_pixel(w, h).b;
- } else if (SpatialMaterial::TextureChannel::TEXTURE_CHANNEL_ALPHA == metalness_channel) {
+ } else if (Material3D::TextureChannel::TEXTURE_CHANNEL_ALPHA == metalness_channel) {
c.b = metallness_image->get_pixel(w, h).a;
}
metallness_image->unlock();
@@ -3561,12 +3561,12 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
d["pbrMetallicRoughness"] = mr;
}
- if (material->get_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING)) {
+ if (material->get_feature(Material3D::FEATURE_NORMAL_MAPPING)) {
Dictionary nt;
Ref tex;
tex.instance();
{
- Ref normal_texture = material->get_texture(SpatialMaterial::TEXTURE_NORMAL);
+ Ref normal_texture = material->get_texture(Material3D::TEXTURE_NORMAL);
if (normal_texture.is_valid()) {
// Code for uncompressing RG normal maps
Ref img = normal_texture->get_data();
@@ -3606,7 +3606,7 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
}
}
- if (material->get_feature(SpatialMaterial::FEATURE_EMISSION)) {
+ if (material->get_feature(Material3D::FEATURE_EMISSION)) {
const Color c = material->get_emission().to_srgb();
Array arr;
arr.push_back(c.r);
@@ -3614,9 +3614,9 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
arr.push_back(c.b);
d["emissiveFactor"] = arr;
}
- if (material->get_feature(SpatialMaterial::FEATURE_EMISSION)) {
+ if (material->get_feature(Material3D::FEATURE_EMISSION)) {
Dictionary et;
- Ref emission_texture = material->get_texture(SpatialMaterial::TEXTURE_EMISSION);
+ Ref emission_texture = material->get_texture(Material3D::TEXTURE_EMISSION);
GLTFTextureIndex gltf_texture_index = -1;
if (emission_texture.is_valid() && emission_texture->get_data().is_valid()) {
emission_texture->set_name(material->get_name() + "_emission");
@@ -3628,12 +3628,12 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
d["emissiveTexture"] = et;
}
}
- const bool ds = material->get_cull_mode() == SpatialMaterial::CULL_DISABLED;
+ const bool ds = material->get_cull_mode() == Material3D::CULL_DISABLED;
if (ds) {
d["doubleSided"] = ds;
}
- if (material->get_feature(SpatialMaterial::FEATURE_TRANSPARENT)) {
- if (material->get_flag(SpatialMaterial::FLAG_USE_ALPHA_SCISSOR)) {
+ if (material->get_feature(Material3D::FEATURE_TRANSPARENT)) {
+ if (material->get_flag(Material3D::FLAG_USE_ALPHA_SCISSOR)) {
d["alphaMode"] = "MASK";
d["alphaCutoff"] = material->get_alpha_scissor_threshold();
} else {
@@ -3642,7 +3642,7 @@ Error GLTFDocument::_serialize_materials(Ref p_state) {
}
Dictionary extensions;
- if (material->get_flag(SpatialMaterial::FLAG_UNSHADED)) {
+ if (material->get_flag(Material3D::FLAG_UNSHADED)) {
Dictionary mat_unlit;
extensions["KHR_materials_unlit"] = mat_unlit;
p_state->add_used_extension("KHR_materials_unlit");
@@ -3669,7 +3669,7 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
for (GLTFMaterialIndex i = 0; i < materials.size(); i++) {
const Dictionary &d = materials[i];
- Ref material;
+ Ref material;
material.instance();
if (d.has("name") && !String(d["name"]).empty()) {
material->set_name(d["name"]);
@@ -3677,14 +3677,14 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
material->set_name(vformat("material_%s", itos(i)));
}
- material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
Dictionary pbr_spec_gloss_extensions;
if (d.has("extensions")) {
pbr_spec_gloss_extensions = d["extensions"];
}
if (pbr_spec_gloss_extensions.has("KHR_materials_unlit")) {
- material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ material->set_flag(Material3D::FLAG_UNSHADED, true);
}
if (pbr_spec_gloss_extensions.has("KHR_materials_pbrSpecularGlossiness")) {
@@ -3699,7 +3699,7 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
Ref diffuse_texture = _get_texture(p_state, diffuse_texture_dict["index"]);
if (diffuse_texture.is_valid()) {
spec_gloss->diffuse_img = diffuse_texture->get_data();
- material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, diffuse_texture);
+ material->set_texture(Material3D::TEXTURE_ALBEDO, diffuse_texture);
}
}
}
@@ -3744,7 +3744,7 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
if (mr.has("baseColorTexture")) {
const Dictionary &bct = mr["baseColorTexture"];
if (bct.has("index")) {
- material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, _get_texture(p_state, bct["index"]));
+ material->set_texture(Material3D::TEXTURE_ALBEDO, _get_texture(p_state, bct["index"]));
}
if (!mr.has("baseColorFactor")) {
material->set_albedo(Color(1, 1, 1));
@@ -3768,10 +3768,10 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
const Dictionary &bct = mr["metallicRoughnessTexture"];
if (bct.has("index")) {
const Ref t = _get_texture(p_state, bct["index"]);
- material->set_texture(SpatialMaterial::TEXTURE_METALLIC, t);
- material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE);
- material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, t);
- material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN);
+ material->set_texture(Material3D::TEXTURE_METALLIC, t);
+ material->set_metallic_texture_channel(Material3D::TEXTURE_CHANNEL_BLUE);
+ material->set_texture(Material3D::TEXTURE_ROUGHNESS, t);
+ material->set_roughness_texture_channel(Material3D::TEXTURE_CHANNEL_GREEN);
if (!mr.has("metallicFactor")) {
material->set_metallic(1);
}
@@ -3785,8 +3785,8 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
if (d.has("normalTexture")) {
const Dictionary &bct = d["normalTexture"];
if (bct.has("index")) {
- material->set_texture(SpatialMaterial::TEXTURE_NORMAL, _get_texture(p_state, bct["index"]));
- material->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
+ material->set_texture(Material3D::TEXTURE_NORMAL, _get_texture(p_state, bct["index"]));
+ material->set_feature(Material3D::FEATURE_NORMAL_MAPPING, true);
}
if (bct.has("scale")) {
material->set_normal_scale(bct["scale"]);
@@ -3795,9 +3795,9 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
if (d.has("occlusionTexture")) {
const Dictionary &bct = d["occlusionTexture"];
if (bct.has("index")) {
- material->set_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION, _get_texture(p_state, bct["index"]));
- material->set_ao_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED);
- material->set_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION, true);
+ material->set_texture(Material3D::TEXTURE_AMBIENT_OCCLUSION, _get_texture(p_state, bct["index"]));
+ material->set_ao_texture_channel(Material3D::TEXTURE_CHANNEL_RED);
+ material->set_feature(Material3D::FEATURE_AMBIENT_OCCLUSION, true);
}
}
@@ -3805,7 +3805,7 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
const Array &arr = d["emissiveFactor"];
ERR_FAIL_COND_V(arr.size() != 3, ERR_PARSE_ERROR);
const Color c = Color(arr[0], arr[1], arr[2]).to_srgb();
- material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
+ material->set_feature(Material3D::FEATURE_EMISSION, true);
material->set_emission(c);
}
@@ -3813,8 +3813,8 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
if (d.has("emissiveTexture")) {
const Dictionary &bct = d["emissiveTexture"];
if (bct.has("index")) {
- material->set_texture(SpatialMaterial::TEXTURE_EMISSION, _get_texture(p_state, bct["index"]));
- material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
+ material->set_texture(Material3D::TEXTURE_EMISSION, _get_texture(p_state, bct["index"]));
+ material->set_feature(Material3D::FEATURE_EMISSION, true);
material->set_emission(Color(0, 0, 0));
}
}
@@ -3822,17 +3822,17 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
if (d.has("doubleSided")) {
const bool ds = d["doubleSided"];
if (ds) {
- material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
+ material->set_cull_mode(Material3D::CULL_DISABLED);
}
}
if (d.has("alphaMode")) {
const String &am = d["alphaMode"];
if (am == "BLEND") {
- material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
+ material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
+ material->set_depth_draw_mode(Material3D::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
} else if (am == "MASK") {
- material->set_flag(SpatialMaterial::FLAG_USE_ALPHA_SCISSOR, true);
+ material->set_flag(Material3D::FLAG_USE_ALPHA_SCISSOR, true);
if (d.has("alphaCutoff")) {
material->set_alpha_scissor_threshold(d["alphaCutoff"]);
} else {
@@ -3848,7 +3848,7 @@ Error GLTFDocument::_parse_materials(Ref p_state) {
return OK;
}
-void GLTFDocument::_set_texture_transform_uv1(const Dictionary &p_dict, Ref p_material) {
+void GLTFDocument::_set_texture_transform_uv1(const Dictionary &p_dict, Ref p_material) {
if (p_dict.has("extensions")) {
const Dictionary &extensions = p_dict["extensions"];
if (extensions.has("KHR_texture_transform")) {
@@ -3868,7 +3868,7 @@ void GLTFDocument::_set_texture_transform_uv1(const Dictionary &p_dict, Ref r_spec_gloss, Ref