Skip to content

Commit e9fe197

Browse files
committed
Fix stray pixel artifacts when BaseMaterial3D Deep Parallax is enabled
Mipmaps for the heightmap seem to cause issues with the parallax occlusion mapping algorithm used.
1 parent d79ff84 commit e9fe197

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scene/resources/material.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,9 @@ void BaseMaterial3D::_update_shader() {
708708
}
709709

710710
String texfilter_str;
711-
// Force linear filtering for the heightmap texture, as the heightmap effect
711+
// Force linear filtering with no mipmaps for the heightmap texture, as the heightmap effect
712712
// looks broken with nearest-neighbor filtering (with and without Deep Parallax).
713+
// Mipmaps also result in stray pixel artifacts when Deep Parallax is enabled.
713714
String texfilter_height_str;
714715
switch (texture_filter) {
715716
case TEXTURE_FILTER_NEAREST:
@@ -722,19 +723,19 @@ void BaseMaterial3D::_update_shader() {
722723
break;
723724
case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
724725
texfilter_str = "filter_nearest_mipmap";
725-
texfilter_height_str = "filter_linear_mipmap";
726+
texfilter_height_str = "filter_linear";
726727
break;
727728
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
728729
texfilter_str = "filter_linear_mipmap";
729-
texfilter_height_str = "filter_linear_mipmap";
730+
texfilter_height_str = "filter_linear";
730731
break;
731732
case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC:
732733
texfilter_str = "filter_nearest_mipmap_anisotropic";
733-
texfilter_height_str = "filter_linear_mipmap_anisotropic";
734+
texfilter_height_str = "filter_linear";
734735
break;
735736
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC:
736737
texfilter_str = "filter_linear_mipmap_anisotropic";
737-
texfilter_height_str = "filter_linear_mipmap_anisotropic";
738+
texfilter_height_str = "filter_linear";
738739
break;
739740
case TEXTURE_FILTER_MAX:
740741
break; // Internal value, skip.

0 commit comments

Comments
 (0)