Switch to textureLod for parallax offset, avoids errors on UWP.
This commit is contained in:
parent
d992eb1b25
commit
ed0af05111
1 changed files with 3 additions and 3 deletions
|
@ -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";
|
||||
|
||||
|
|
Loading…
Reference in a new issue