godotengine / godotengine/godot

Lightmap baking transferring incorrect edges to adjacent faces

Open
#100,397 2 comments 1 reaction 0 assignees View on GitHub
bug topic:3d topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

v4.4.dev6.official [1f47e4c4e]

### System information

Godot v4.4.dev (aa287f7e7) - Windows 10.0.19045 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated Radeon RX 5500 XT (Advanced Micro Devices, Inc.; 32.0.11027.1003) - AMD Ryzen 7 5800X 8-Core Processor (16 threads)

### Issue description

Baked lightmaps appear to have darken edges or light leaks, both when generating UV2 or importing a model from Blender with a pre-generated UV2

No amount of tweaking settings removes the problem fully. After testing a lightmap UV generated in blender I noticed misalignment
![Image](https://github.com/user-attachments/assets/b29b8657-8732-4879-a358-86c41c96534c)

After locating and rotating the misaligned UV by 180, the texture lines up, but a darkened seam appeared
![Image](https://github.com/user-attachments/assets/fb493099-2871-454b-be84-3cb82ee5f877)

After rotating the first tris back and rotating its neighbours, the alignment is corrected and the incorrect seam is gone. The edge bleed generator correctly extends the edge
![Image](https://github.com/user-attachments/assets/d750a691-b707-4b15-887f-9a5986843822)
![Image](https://github.com/user-attachments/assets/2667ffdf-e45b-423f-ac9b-e42c0e0b2d79)

Here is another example of a suspected "leak"
![Image](https://github.com/user-attachments/assets/372f4dd6-19d9-4fdb-8eb4-3773864ac56c)
![Image](https://github.com/user-attachments/assets/ec56439e-6e18-48ab-a483-5359231e05f7)

After rotating 180, the bottom edge (in world, side edge in UV) is corrected, but the side is now transferring the incorrect edge data
![Image](https://github.com/user-attachments/assets/763d70bb-153e-44af-85b4-fe4baed9f7ac)
![Image](https://github.com/user-attachments/assets/d6463055-d044-43c9-adae-cd03d8a6ab39)

Given that the problem was transferred to the bottom edge of the UVs (left edge of wall) and not the opposite side, it might be that vertex winding order matters. Snapping to pixel centre or edge didn't seem to overly matter, only UV face orientation

### Steps to reproduce

Export a pre-lightmapped model, or auto generate light maps, setup scene and bake. (spend a few hours fiddling around with UV's in blender)

### Minimal reproduction project (MRP)

Let me know if you actually want the MRP, its a bit messy 😏

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the lightmap bake with both generated UV2 and a Blender model with pre-generated UV2, comparing the reported UV orientations and edge-transfer screenshots. Confirm the issue across the described Vulkan setup and determine whether correcting UV face orientation prevents dark seams or light leaks; a complete fix should produce aligned edges without incorrect bleed between adjacent faces.

Written by the indexing model from the issue text.

Assessment

Tech stack
blender, cpp, godot
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.