Repository navigation
Conversation
Three scenes to try the 2D lights and light obstacles: a dungeon of brick walls lit by torches and a turning flashlight, lights and obstacles moving (crates and doors turning, pillars sliding), and a room crowded with hundreds of crates lit by many lights, one following the mouse. Its rendering tests take screenshots of each scene, at the start and after the lights and obstacles moved.
Contributor
Preview the game(s) changed or added in this Pull RequestThis is an automatic message displaying links to the games in this PR - double check the JSON in case of doubt. |
Drawn with 4ian/GDevelop#9401, where light obstacles turning (like the doors) cast shadows.
4ian
added a commit
to 4ian/GDevelop
that referenced
this pull request
Nov 21, 2026
## Problem On Apple GPUs (Chrome, Metal), 2D lights with a texture showed dotted lines coming out of the light, darker inside the lit area and faintly lit outside it (visible in the [2D light playground](GDevelopApp/GDevelop-examples#1129)). ## Why The GPU chooses a texture's mipmap level for each 2x2 block of pixels. On Apple GPUs, once a pixel of the block is discarded, the level chosen for the others is wrong. Light meshes are made of very thin triangles (most are thinner than 0.1 px), so almost every block had a pixel discarded before the texture was sampled. This was already the case before #9401: the light meshes are the same. ## Fix The texture is sampled before any pixel is discarded. Plain GLSL ES 1.0, no extension: it works wherever the light shader works today. ## Tests - On an M2 Pro, with the meshes of the playground: 8% of the pixels were wrong before, none after. - 0 differing pixels on the 12 rendering screenshots (playground, `lights` and `raycast-debug-view` examples) with SwiftShader. The lighting tests pass. --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's added
examples/2d-light-playground: three scenes to try the 2D lights and light obstacles (press 1, 2 or 3 to switch):Tests
rendering-screenshots/2d-light-playground.Note
The expected images are drawn with 4ian/GDevelop#9401 (merged), where the turning doors cast shadows (
moving-lights-and-obstacles-later.png). The rendering check will pass once the GDevelop build published for master includes it.