diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-28 18:36:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-28 18:36:59 +0200 |
commit | 492d741a3eccf2ebe5d20f16fc0c98c1917b550c (patch) | |
tree | 05b9124fe3ca96a4f6f0eb7ab3ba31e0af43ae63 | |
parent | 09254e970ad76647a2673c265769cd51ae28f616 (diff) | |
parent | 8fc96fc51aa91d3c73c90401f73bcce58aca6153 (diff) |
Merge pull request #49951 from Calinou/standardmaterial3d-height-triplanar-print-warning
Print warning in StandardMaterial3D when height and triplanar are active
-rw-r--r-- | scene/resources/material.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 092aba8b33..cb66d5724d 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -878,6 +878,20 @@ void BaseMaterial3D::_update_shader() { code += "\tvec2 base_uv2 = UV2;\n"; } + if (features[FEATURE_HEIGHT_MAPPING] && flags[FLAG_UV1_USE_TRIPLANAR]) { + // Display both resource name and albedo texture name. + // Materials are often built-in to scenes, so displaying the resource name alone may not be meaningful. + // On the other hand, albedo textures are almost always external to the scene. + if (textures[TEXTURE_ALBEDO].is_valid()) { + WARN_PRINT(vformat("%s (albedo %s): Height mapping is not supported on triplanar materials. Ignoring height mapping in favor of triplanar mapping.", get_path(), textures[TEXTURE_ALBEDO]->get_path())); + } else if (!get_path().is_empty()) { + WARN_PRINT(vformat("%s: Height mapping is not supported on triplanar materials. Ignoring height mapping in favor of triplanar mapping.", get_path())); + } else { + // Resource wasn't saved yet. + WARN_PRINT("Height mapping is not supported on triplanar materials. Ignoring height mapping in favor of triplanar mapping."); + } + } + if (!RenderingServer::get_singleton()->is_low_end() && features[FEATURE_HEIGHT_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //heightmap not supported with triplanar code += "\t{\n"; code += "\t\tvec3 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 ;-) |