godotengine / godot

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

SVG does not render correctly in master as of PR #96167 (works in 4.3 stable) #96262

Closed aaronfranke closed 2 months ago

aaronfranke commented 2 months ago

Tested versions

System information

macOS 14.6.1 arm64

Issue description

As of PR #96167, this SVG does not render correctly. There is a defect on the left of the image.

Incorrect image:

Screenshot 2024-08-28 at 9 10 47 PM

Correct image:

Screenshot 2024-08-28 at 9 10 53 PM

Steps to reproduce

Open the below SVG in the latest Godot master branch.

Minimal reproduction project (MRP)

Here is the SVG: icon

akien-mga commented 2 months ago

Confirmed. On the other hand I don't reproduce it on https://thorvg.github.io/thorvg.viewer/ which also claims to use 0.14.7, so there might be an issue with how we're using ThorVG.

I tested intermediate ThorVG releases between 0.14.2 (our previous version) and 0.14.7, and it appears that the regression was introduced in ~0.14.6~ 0.14.5.

Edit: I was in a hurry yesterday and mistested, the regression actually seems to have happened in 0.14.5. Also tested the new 0.14.8 which doesn't fix it.

I'll open an upstream bug report later today, but CC @mgrudzinska @hermett @capnm FYI.

akien-mga commented 2 months ago

I bisected the regression in thorvg to https://github.com/thorvg/thorvg/commit/fdc45edf32820b7e0979ed7f8a48a14d2adc8103 cc @mgrudzinska.

mgrudzinska commented 2 months ago

I'm on it, reproduced

capnm commented 1 month ago

CC @akien-mga Note++: The fundamental issue is still a work in progress...

https://github.com/godotengine/godot/commit/a6ab039f2b9e2d524b45186586cc880134fbee98 image

SVG: err

akien-mga commented 1 month ago

Yeah that's why I finally opted for reverting the Bézier precision change (which was motivated by Lottie which we don't use yet), restoring the pre-regression behavior. We can wait for ThorVG to find a good solution and then confirm it works in Godot.

Edit: to be clear, the SVG you shared should also be broken in earlier versions of Godot/ThorVG, right? If it's not a regression I don't think we need to track it here, just an upstream bug report is enough.

capnm commented 1 month ago

Edit: to be clear, the SVG you shared should also be broken in earlier versions of Godot/ThorVG, right? If it's not a regression I don't think we need to track it here, just an upstream bug report is enough.

I have now tested some older stable versions; it renders correctly (-- wrong angle) in 4.1.4 but is broken in v4.2.2, along with everything that follows. As you mentioned, it's already a known issue, and I agree. You could, I suppose, produce a lot of such floating-point precision-related SVGs...

editor_screenshot_2024-09-07T120003