diff options
| author | Bastiaan Olij <mux213@gmail.com> | 2023-07-05 15:38:40 +1000 |
|---|---|---|
| committer | Bastiaan Olij <mux213@gmail.com> | 2023-07-06 21:13:46 +1000 |
| commit | 581d081deda4404cbbc645c8c8f9c4150ad409c5 (patch) | |
| tree | 05d5cd5fb62d4c7d5219ebba39551e9a8a388ad3 | |
| parent | b7c2fd2e9a7f01644e15fef86083a3e0e0221e4d (diff) | |
| download | redot-engine-581d081deda4404cbbc645c8c8f9c4150ad409c5.tar.gz | |
Take eye offset into account for depth in StandardMaterial3D
| -rw-r--r-- | scene/resources/material.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 372b9fea55..a2aab8e7b4 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1139,7 +1139,7 @@ void BaseMaterial3D::_update_shader() { if (!RenderingServer::get_singleton()->is_low_end() && features[FEATURE_HEIGHT_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //heightmap not supported with triplanar code += " {\n"; - code += " vec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*heightmap_flip.x,-BINORMAL*heightmap_flip.y,NORMAL));\n"; // binormal is negative due to mikktspace, flip 'unflips' it ;-) + code += " vec3 view_dir = normalize(normalize(-VERTEX + EYE_OFFSET) * mat3(TANGENT * heightmap_flip.x, -BINORMAL * heightmap_flip.y, NORMAL));\n"; // binormal is negative due to mikktspace, flip 'unflips' it ;-) if (deep_parallax) { code += " float num_layers = mix(float(heightmap_max_layers),float(heightmap_min_layers), abs(dot(vec3(0.0, 0.0, 1.0), view_dir)));\n"; |
