summaryrefslogtreecommitdiff
path: root/scene/resources/material.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/material.cpp')
-rw-r--r--scene/resources/material.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index df5bbe9e6c..dc29102492 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -694,6 +694,8 @@ void SpatialMaterial::_update_shader() {
}
code += "\t\tbase_uv=ofs;\n";
+ code += "\t\tif(base_uv.x > 1.0 || base_uv.y > 1.0 || base_uv.x < 0.0 || base_uv.y < 0.0)\n";
+ code += "\t\t\tdiscard;\n";
if (features[FEATURE_DETAIL] && detail_uv == DETAIL_UV_2) {
code += "\t\tbase_uv2-=ofs;\n";
}
@@ -2106,10 +2108,10 @@ void SpatialMaterial::_bind_methods() {
SpatialMaterial::SpatialMaterial() :
element(this) {
- //initialize to right values
+ // Initialize to the same values as the shader
set_albedo(Color(1.0, 1.0, 1.0, 1.0));
set_specular(0.5);
- set_roughness(0.0);
+ set_roughness(1.0);
set_metallic(0.0);
set_emission(Color(0, 0, 0));
set_emission_energy(1.0);