diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-11-27 17:47:02 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-11-27 17:47:33 -0300 |
commit | ed0af051116938064fbe3ef464fa41689684e796 (patch) | |
tree | 7dc6869799ddebebb9a2ed2ee2d03a5c5fb82527 | |
parent | d992eb1b25e3612293d6c72cd462a99cd5a0e4a3 (diff) |
Switch to textureLod for parallax offset, avoids errors on UWP.
-rw-r--r-- | scene/resources/material.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 286840656b..79f642a09b 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"; |