From ed0af051116938064fbe3ef464fa41689684e796 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 27 Nov 2017 17:47:02 -0300 Subject: [PATCH] Switch to textureLod for parallax offset, avoids errors on UWP. --- scene/resources/material.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 286840656b2..79f642a09b4 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -653,16 +653,16 @@ void SpatialMaterial::_update_shader() { code += "\t\tvec2 P = view_dir.xy * depth_scale;\n"; code += "\t\tvec2 delta = P / num_layers;\n"; code += "\t\tvec2 ofs = base_uv;\n"; - code += "\t\tfloat depth = texture(texture_depth, ofs).r;\n"; + code += "\t\tfloat depth = textureLod(texture_depth, ofs,0.0).r;\n"; code += "\t\tfloat current_depth = 0.0;\n"; code += "\t\twhile(current_depth < depth) {\n"; code += "\t\t\tofs -= delta;\n"; - code += "\t\t\tdepth = texture(texture_depth, ofs).r;\n"; + code += "\t\t\tdepth = textureLod(texture_depth, ofs,0.0).r;\n"; code += "\t\t\tcurrent_depth += layer_depth;\n"; code += "\t\t}\n"; code += "\t\tvec2 prev_ofs = ofs + delta;\n"; code += "\t\tfloat after_depth = depth - current_depth;\n"; - code += "\t\tfloat before_depth = texture(texture_depth, prev_ofs).r - current_depth + layer_depth;\n"; + code += "\t\tfloat before_depth = textureLod(texture_depth, prev_ofs, 0.0).r - current_depth + layer_depth;\n"; code += "\t\tfloat weight = after_depth / (after_depth - before_depth);\n"; code += "\t\tofs = mix(ofs,prev_ofs,weight);\n";