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/Skeleton2D rendering bug when the polygon's rest pose is outside the viewport #81983

Closed
SaffronStreams opened this issue Sep 20, 2023 · 2 comments · Fixed by #84451
Closed

Comments

@SaffronStreams
Copy link

Godot version

4.1.1.stable

System information

Windows 10

Issue description

Using Skeleton2D and Bone2D to animate Polygon2D can lead to the Polygon2D no longer being shown, probably being culled, when it is actually still supposed to be on the screen.

Minimum project, everything is shown:
image

Zooming in a little makes the lower leg and foot getting culled
image

Rotating the hips Bone node also makes all the leg nodes getting culled.
image

This was also an issue in Godot 3 that then luckily got fixed: #35726

It has the same behavior so a similar solution might solve the problem in 4 as well?

Steps to reproduce

Add some Polygon2D nodes, attach a texture to them and use UV points to put it on screen. Add a Skeleton2D with some bone2Ds. Connect the UV of the Polygon2D to the bones
image
This has been set up in minima project.

Now move the bones around a bit, move the root node around on the screen so it gets to the edge. You will see the Polygon2D's getting culled before they are off the screen.

Minimal reproduction project

MinimumCulling.zip

@lawnjelly
Copy link
Member

lawnjelly commented Sep 20, 2023

See also #76184, #74656, #78177 .

BTW I did the fix in 3.x (#75612), and did spend some time trying a similar fix in 4.x, but this area has diverged significantly between the two versions. The reason for the bug is similar but the fix would need to be tailored for 4.x, and would need more time invested.

@SaffronStreams
Copy link
Author

The old workaround (using the new Class names) still works once the game is running:

func enlarge_all_visual_rects(): var custom_rect = Rect2(Vector2.ZERO, Vector2(1500,1500)) for polygon in _node_under_which_your_polygons_are.get_children(): print("check: " + polygon.name) RenderingServer.canvas_item_set_custom_rect(polygon.get_canvas_item(), true, custom_rect)

However, this does not work in the editor, unless you use "@tool" to load/run your scene in the editor, but that's not ideal when you're dealing with characters subject to gravity for instance.

Is this impacted by the new SkeletonModificationStack perchance?

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.

3 participants