1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-05 19:31:35 +00:00

Merge pull request #51433 from Calinou/spatialmaterial-improve-simple-parallax

This commit is contained in:
Rémi Verschelde
2021-11-16 14:43:49 +01:00
committed by GitHub

View File

@@ -776,7 +776,9 @@ void SpatialMaterial::_update_shader() {
} else {
code += "\t\tfloat depth = texture(texture_depth, base_uv).r;\n";
code += "\t\tvec2 ofs = base_uv - view_dir.xy / view_dir.z * (depth * depth_scale);\n";
// Use offset limiting to improve the appearance of non-deep parallax.
// This reduces the impression of depth, but avoids visible warping in the distance.
code += "\t\tvec2 ofs = base_uv - view_dir.xy * depth * depth_scale;\n";
}
code += "\t\tbase_uv=ofs;\n";