godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.42k stars 21.26k forks source link

Shader breaks TileMapLayer Terrain connection #96490

Open neepsnikeep opened 2 months ago

neepsnikeep commented 2 months ago

Tested versions

System information

Windows 11 Godot 4.3 stable, compatibility mode

Issue description

As soon as the shader is doing anything, the terrain borders break. The tiles surrounded by each other seem to work correctly, but the connection tiles to transparency are way off, as you can see here:

https://github.com/user-attachments/assets/c36ace9c-926c-4f7b-a350-4c61143d7642

Applying the shader material is working fine, as long as there is no actual code in the shader. I do call set_cells_terrain_connect by code, but it does look the same as in the editor.

https://github.com/user-attachments/assets/1101235a-35c0-4f8f-963a-b987cae3a488

Same in the old version using a TileMap

https://github.com/user-attachments/assets/22538627-8c06-48a2-ae22-98a1aae4a8d9

What's happening here?

Steps to reproduce

Minimal reproduction project (MRP)

N/A

neepsnikeep commented 2 months ago

Quick fix: Get the texture color and assign the rgb values.

vec4 tex_color = texture(TEXTURE, UV);
COLOR = vec4(tex_color.rgb, 0.5);

Why is this neccessary...? Shouldn't COLOR be that initially?