You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Improve the appearance of simple parallax in StandardMaterial3D
This uses offset limiting to avoid distortion in the distance, and makes simple (non-deep) parallax more usable overall.
This commit is contained in:
@@ -957,7 +957,9 @@ void BaseMaterial3D::_update_shader() {
|
|||||||
} else {
|
} else {
|
||||||
code += " float depth = 1.0 - texture(texture_heightmap, base_uv).r;\n";
|
code += " float depth = 1.0 - texture(texture_heightmap, base_uv).r;\n";
|
||||||
}
|
}
|
||||||
code += " vec2 ofs = base_uv - view_dir.xy / view_dir.z * (depth * heightmap_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 += " vec2 ofs = base_uv - view_dir.xy * depth * heightmap_scale;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
code += " base_uv=ofs;\n";
|
code += " base_uv=ofs;\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user