-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visible seams between GridMap tiles (sometimes only with MSAA enabled) #16337
Comments
Also happens on mesh edges, maybe related to unfiltered textures? |
There is a cell_scale property you can use, with some values like 1.001 that will get rid of these problems. |
Maybe we should document this better? |
Try disabling |
@reduz cell_scale is only relevant to grid map right? I have the same issue on an imported dae mesh. @Bauxitedev I deleted the generated meshes, removed the "compress" attribute from the import settings and reimported the mesh - sadly, the issue remains. |
Are you using a texture atlas? With MSAA, the primitive doesn't have to cover the center of the pixel to be visible, but shading is calculated at the center of the pixel regardless. This can cause interpolated vertex attributes (such as UVs) to instead be extrapolated for a point slightly off the edge of the primitive. This is an issue with MSAA in general, not Godot. Try moving your UVs slightly inward so extrapolated UV coordinates will still use the same texel. |
@Bauxitedev I disabled vertex compress by default because many were having issues with it, left compress of other stuff @TomWor If you are using a recent master, i fixed this by disabling vertex compression by default |
@reduz Would love to test, but my current build of master closes the game window instantly on play. Works fine with the current 3.1 alpha though (not counting the MSAA issue). |
What is the state of this issue? |
This still happens for me using 3.1 Beta 10, using a texture atlas and uncompressed meshes. |
I think I can confirm that @randomness128 is right at least about the issue I'm facing. |
@TomWor Is the issue lessened if you slightly expand/shrink your meshes but keep the textures at the same size? |
Does this still happen in latest 3.2 builds? If so, does it happen with both GLES2 and GLES3? |
Reproduction Project: Very obvious seams, only when MSAA is enabled. |
@EzraT Is the issue lessened if you slightly expand/shrink your meshes but keep the textures at the same size? |
@Calinou No, not really, as far as I can tell that just introduces more problems, z-fighting flickering or physical seams between the meshes, along with the texture seams discussed here. |
I'm unsure if its related, but I'm also getting some jittery artifacts along seams only with MSAA disabled. I'm hesitant to report this example as an actual issue, as I haven't ruled out external causes (assets, GridMap settings, Camera, etc) for the odd artifacting displayed here. You can see it here just to the left of the player. The seams become permanently visible with MSAA enabled very similarly to examples that have already been provided. Both the video in the link above as well as the attached image were taken while running 3.2.3.rc1 on win10 with a GTX 1080 Ti. My GridMap settings in the attached media have a cell size of Vec3(2, 2, 2), and cell scale of 1. Our game intends to make fairly heavy use of the GridMap node, so this is a bit of a sticking point for us. We've tried slightly increasing cell scale to 1.001 as well as modifying cell size by small increments as well, but unfortunately they didn't seem to help. |
Try adding a green plane (with the same color as the grass) below the GridMap floor to make seams less visible. |
Both issues occurred when someone tried MSAA in my Minecraft-like demo:
The error renders the same size in screen space, so if a correction were to be done, it would have to support all view distances by not looking weird at close range and not happening again when far away. In my case this happens within the meshes, which are chunks of voxels, where voxels are not necessarily cubes and can have been UV-mapped in Blender, so finding an easy algorithm to automate a fix that would work at any view distance doesn't sound straightforward. |
Several workarounds are mentioned in the above comments, outside of disabling MSAA and using another antialiasing solution. |
I'm not using MSAA and I can't using antialiasing as it's a retro game. I'm using gridmaps with MeshInstance boxes that are 1 * 1 * 1 and use ShaderMaterials, not atlases. It only happens really when I move around, is there a fix for this? |
I had a similar issue, I tried rotatin the gridmap along the y axis a couple of degrees and that helped reduce the number of lines |
I have this too. The meshes are made with perfect snap in blender, but gridmap often places them with gaps. Disabling MSAA did not help. Scaling also doesn't help, since that straight up makes the planes missalign, though I would expect them all to remain centered - is the problem with how GridMaps determine cell center? |
Can confirm that it's still a problem on 4.2.1. I haven't tested 4.3's rcs yet, so I don't know if a change there may have magically fixed it. I've tried everything people have suggested here and nothing really fixes it, or even noticeably reduces its effect Hopefully this can get figured out and fixed soon 2024-03-03.11-09-31.mp4 |
I've discovered that there was a issue with blender that was causing it in my case. Even if based on the default cube and snapped to it, verteces are NOT in perfect positions. Instead, each vertex should be given position manually in the tool tab (key N to see). Assigning them manually fixed it in my case. |
I wish i could say it was a blender issue for me, but it's also visible on the default box mesh made in Godot itself |
so a friend of mine has discovered something that might help with fixing this. apparently this occurs only when the meshes that are next to each other have side-facing geometry. if i just have a plane, this doesn't happen |
Thanks, I use plane meshes to cover up the worst looking of these that occur, but for games built with cubes with sides that are darker/lighter or have different textures the problem still remains. |
It feels like that kinda forces the marching cubes approach, where there is only the geometry actually needed for the total shape. I suppose the cubes need to be separated into individual planes, and you combine planes instead of blocks. Would definately make it more of a hassle. |
I am experiencing this issue in Godot 4.2.2 I am using a texture atlas on my gridmaps, however, I am not using MSAA of any kind, and MSAA is completely disabled. The gridmaps use a MeshLibrary (.tres) created in Godot based off of a .glb file exported from Blender. These meshes in my gridmap snap together perfectly fine in Blender, but not in Godot. If it would be helpful, I used this tutorial here. He even mentions this issue with the gaps at the end of the video. I have tried:
I've also noticed that most of these artifacts are most visible at the periphery of the Player's vision, as you can see in the attached images. It's really most noticeable though, when the player is moving around. |
This is an unrelated issue, and one that will happen on any real-time engine that uses mipmaps for rendering. You need to add padding between the textures in the texture atlas so that mipmaps don't cause different textures to blend together. How much padding you need to add depends on the individual tile size, but typically, you want at least 4 pixels on each side. These pixels should repeat the base texture as usual (or at least use the average color of the texture). You can troubleshoot whether mipmapping is the cause by disabling mipmaps on the atlas texture in the Import dock. This will cause textures to become grainy at a distance, but if the cause is indeed due to the texture atlas, the lines should be gone. |
I tried disabling mipmaps on the atlas texture, however, the lines are unfortunately not gone. |
Do lines disappear if you switch the material filter mode to Nearest in the BaseMaterial3D properties? (If the material was imported from Blender, you need to change the filter mode in Blender, or assign an external material from Godot.) |
That was it! I had my stuff set to cubic, rather than Closest, which is what I believe it's called in Blender. After switching to Nearest there are no gaps! If you wouldn't mind, could you explain to me a bit further why changing the filtering mode to Closest fixed this? I assume it has something to do with the atlas and the bleed you said before? Additionally, I was using the Cubic filter in order to make my texures blurry and not so pixelated. Is there a way to have both? |
This is still due to a lack of padding between tiles in the atlas. When you use linear filtering, the edge of each tile will read from the nearest four pixels for linear interpolation. On each edge, two of those pixels will be from a different tile, possibly with a color that is very different. This is what leads to the visible line on tile edges.
Yes, you need padding on the edges of your atlas tiles. |
How can I do this without losing the ability to "tile" my gridmap pieces, so that they line up with the texture of the next gridmap over? I think I might be misunderstanding how to do this. I appreciate your patience with me, I have to apologize, I'm very new to Godot, and Blender for that matter. |
I'm having a similar issue with For example, with a perspective camera and low FOV (5 degrees): There's some more comments and media in a Twitter thread here: https://x.com/PineMach/status/1841918893478273349 |
Is hard to see. You need to open the image full size. There are no visible seams with MSAA Disabled but with 2x or higher I start seeing seams and edges of 3D meshes.
My guess is the texture or mesh is shrunk by a small factor in order to produce the edge aliasing.
I use a Gridmap is a cell size 1 , 1 , 1 and the tiles are all designed to be exactly 1 x 1 x 1 and the UV maps are made exactly to the dot for 64 x 64 textures.
This is on latest Godot 3.0 release
The text was updated successfully, but these errors were encountered: