diff options
| author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-03-15 18:57:31 +0100 |
|---|---|---|
| committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-06-22 00:57:22 +0200 |
| commit | 281e0e6a5bae7165185ed32c65a96b16bfd621ce (patch) | |
| tree | 57d21bec67327e901bef95d01c21b017825407a3 | |
| parent | 8a6c1e8f5232ff3b3a5eac024d590e7479b29e90 (diff) | |
| download | redot-engine-281e0e6a5bae7165185ed32c65a96b16bfd621ce.tar.gz | |
Allow BaseMaterial3D height/dither fade to work with Compatibility rendering
Compatibility is based on OpenGL ES 3.0, so the height shader
(including deep parallax) and distance fade dither modes work
just fine with no adjustments required.
| -rw-r--r-- | scene/resources/material.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 65b97acabf..b2567e431b 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1337,7 +1337,7 @@ void fragment() {)"; } // Heightmapping isn't supported at the same time as triplanar mapping. - if (!RenderingServer::get_singleton()->is_low_end() && features[FEATURE_HEIGHT_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { + if (features[FEATURE_HEIGHT_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { // Binormal is negative due to mikktspace. Flipping it "unflips" it. code += R"( { @@ -1637,21 +1637,20 @@ void fragment() {)"; // Use the slightly more expensive circular fade (distance to the object) instead of linear // (Z distance), so that the fade is always the same regardless of the camera angle. if ((distance_fade == DISTANCE_FADE_OBJECT_DITHER || distance_fade == DISTANCE_FADE_PIXEL_DITHER)) { - if (!RenderingServer::get_singleton()->is_low_end()) { - code += "\n {"; + code += "\n {"; - if (distance_fade == DISTANCE_FADE_OBJECT_DITHER) { - code += R"( + if (distance_fade == DISTANCE_FADE_OBJECT_DITHER) { + code += R"( // Distance Fade: Object Dither float fade_distance = length((VIEW_MATRIX * MODEL_MATRIX[3])); )"; - } else { - code += R"( + } else { + code += R"( // Distance Fade: Pixel Dither float fade_distance = length(VERTEX); )"; - } - code += R"( + } + code += R"( // Use interleaved gradient noise, which is fast but still looks good. const vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189); float fade = clamp(smoothstep(distance_fade_min, distance_fade_max, fade_distance), 0.0, 1.0); @@ -1661,7 +1660,6 @@ void fragment() {)"; } } )"; - } } else { code += R"( // Distance Fade: Pixel Alpha |
