Skip to content
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

Polygon2D clipping generates spurious elements inside masked area #90793

Closed
grunthos-dev opened this issue Apr 17, 2024 · 2 comments · Fixed by #90821
Closed

Polygon2D clipping generates spurious elements inside masked area #90793

grunthos-dev opened this issue Apr 17, 2024 · 2 comments · Fixed by #90821

Comments

@grunthos-dev
Copy link

Tested versions

Reproducible in: 4.3-dev5, 4.2.1-stable, 4.1.3-stable

System information

Godot v4.1.3.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.5152) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)Godot v4.1.3.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.5152) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)

Issue description

I am trying to use Polygon2D clipping to mask out an area of the screen. See picture.

When I make a test scene, the clipping polygon (selected) correctly masks the Godot icon. But there are undesired scaled copies of other elements in the scene inside the clip area (green and grey polygons). As you pan the background of the editor around these copies shift around like there is some transform effect.

PolygonClippingMaskBugAnnotated_17Apr2024

Steps to reproduce

  1. In a 2D scene, create a white Polygon2D with points in a rough circle, called PolygonA.

  2. Drag the Godot sprite Icon.svg into the viewport so that it overlaps an edge of PolygonA.

  3. Make the icon sprite a child of PolygonA and set PolygonA's Clip Children to Clip Only.

  4. This correctly masks the sprite so that it is only visible inside the mask area.

  5. Now add a new Polygon2D, called PolygonB, to the scene, move it above PolygonA in the hierarchy. Set it to green and add some points in a rectangle that will encompass PolygonA.

  6. You will now see the bug. There is an undesired scaled copy of PolygonB inside the clip area of PolygonA. It also shows any other scene elements inside this clip area, if they are above PolygonA in hierarchy.

  7. If you use MMB to pan the editor background, the scene copies move around.

Minimal reproduction project (MRP)

PolygonClippingMaskBug.zip

@aaronp64
Copy link
Contributor

Might be related to #89689

@grunthos-dev
Copy link
Author

grunthos-dev commented Apr 17, 2024

Looks similar since the elements inside have a squashed ratio like mine.

This other bug report also makes a good point - it only happens with the Mobile renderer..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants