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

Some SVGs are not displayed since 4.3.beta3 #96491

Closed
antimundo opened this issue Sep 2, 2024 · 7 comments · Fixed by #96658
Closed

Some SVGs are not displayed since 4.3.beta3 #96491

antimundo opened this issue Sep 2, 2024 · 7 comments · Fixed by #96658

Comments

@antimundo
Copy link

Tested versions

  • Reproducible in v4.3.beta3, v4.3.stable, v4.4.dev1
  • Not reproducible in v4.2.2.stable, v4.3.dev1, v4.3.dev3, v4.3.dev5, v4.3.beta1, v4.3.beta2

System information

Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - AMD Radeon RX 6800 (Advanced Micro Devices, Inc.; 31.0.24033.1003) - Intel(R) Core(TM) i5-7600K CPU @ 3.80GHz (4 Threads)

Issue description

I tried upgrading a project from Godot 4.2.2 to Godot 4.3, which I made using a lot of SVGs but all textures that used .svg doesn't show anymore in the game.
No console errors, and the game runs fine, is just that the .svg textures are not been displayed.

If I open it with Godot 4.3 the .svg textures are not been displayed. Same with Godot 4.3.beta3 and later versions.
imagen

If I open the project on Godot 4.2.2 it works just fine. Same with Godot 4.3.beta2 and previous versions.
Captura de pantalla 2024-09-02 203305

I tested different Godot versions, and it seems to be reproducible in Godot 4.3.beta3 and later versions. But not reproducible (works fine) in Godot 4.3.beta2 and previous versions. (I'm always deleting the .godot folder after each test)

The version I open the project first is the key to reproduce the error

For some reason, if I delete the .godot folder, and then open and import the project with 4.3.beta2 (which works fine), and after that, I open it again with 4.3.stable everything seems to work fine.
The same way, if I delete the .godot folder, and then open and import the project with 4.3.stable and then I go back to 4.3.beta2 the sprites don't appear.

Seems like it all depends on which version I open the project with first. If it's Godot 4.3.beta2 or earlier it works just fine, if it's Godot 4.3.beta3 or later the sprites don't appear.

Only with .svg files

Other files, like .png seems to work fine, this is happening just with .svg files to me.

Steps to reproduce

Clone or download this Godot Project "Poder Solar": https://github.com/antimundo/poder-solar
Open it in Godot 4.3
See how most sprites are not been displayed.

Minimal reproduction project (MRP)

The project is open source and available at:
https://github.com/antimundo/poder-solar

@antimundo antimundo changed the title SVGs not SVGs are not been displayed Sep 2, 2024
@fire fire changed the title SVGs are not been displayed SVGs are not displayed Sep 3, 2024
@fire
Copy link
Member

fire commented Sep 3, 2024

Can you try using this https://www.thorvg.org/viewer to help us isolate if it's a Godot Engine bug or a Thorvg bug?

@antimundo
Copy link
Author

Can you try using this https://www.thorvg.org/viewer to help us isolate if it's a Godot Engine bug or a Thorvg bug?

Seems like the SVGs are not showing there either... But they look perfectly normal if I open them with Firefox, Google Chrome, or Inkscape.

They even look look fine if I upload them here on GitHub:

power_plant

@akien-mga akien-mga added this to the 4.4 milestone Sep 3, 2024
@akien-mga akien-mga changed the title SVGs are not displayed Some SVGs are not displayed since 4.3.beta3 Sep 3, 2024
@akien-mga
Copy link
Member

I can confirm the issue, which seems to have been introduced in ThorVG 0.13.8. I'll bisect and report it upstream.

As a side note, for some reason I can't open the MRP properly in 4.2.2-stable. That's pretty weird.

@akien-mga
Copy link
Member

I reported the regression upstream: thorvg/thorvg#2706

The root cause of the issue is that your SVG icons include text nodes which you're not actually using to display text. Removing them should fix your issue.

ThorVG (the library we use for SVG) should still handle them gracefully though and ignore the text node, but for now the latest version has a stricter interpretation of the spec.

@akien-mga
Copy link
Member

akien-mga commented Sep 3, 2024

The root cause of the issue is that your SVG icons include text nodes which you're not actually using to display text. Removing them should fix your issue.

To do this, you can optimize the SVGs with a tool like e.g. svgo, which will remove unused stuff from them (to reduce disk usage and clutter, but in this case it will also work around this bug).

npm install svgo
find -name "*.svg" -exec node_modules/.bin/svgo {} \;
rm -rf node_modules

@antimundo
Copy link
Author

The root cause of the issue is that your SVG icons include text nodes which you're not actually using to display text. Removing them should fix your issue.

To do this, you can optimize the SVGs with a tool like e.g. svgo, which will remove unused stuff from them (to reduce disk usage and clutter, but in this case it will also work around this bug).

npm install svgo
find -name "*.svg" -exec node_modules/.bin/svgo {} \;
rm -rf node_modules

Indeed, removing that text node fixed the issue :)) thanks you so much for the advice! I hope this is fixed since it was very confusing that these SVGs were displayed on other apps but not Godot.

(By the way I don't understand why is there a text node on the SVGs, I don't remember adding any text to the SVGs on Inkscape (?))

@capnm
Copy link
Contributor

capnm commented Sep 6, 2024

(By the way I don't understand why is there a text node on the SVGs, I don't remember adding any text to the SVGs on Inkscape (?))

In Inscape, I usually keep the working copy (it includes a lot of internal configuration stuff; in your case, I guess empty <text ... ></text>-tag lines) and save the intended result as a 'plain'-SVG copy.

I did a quick check with Godot v4.4.dev 835808e and TVG v0.14.9. It fixes all your files but still has issues if the text tag includes characters.

Files for further investigation: mrp-svg_text-tests-godot.zip

Fixed in thorvg/thorvg#2716
CC @fire

akien-mga added a commit to akien-mga/godot that referenced this issue Sep 17, 2024
Fixes godotengine#96491.

Update fix for godotengine#96262 to a simple revert of the problematic commit,
as the upstream fix is still being debated and caused other issues.

Also include fix for upstream regression 2715 added in 0.14.9.

(cherry picked from commit a6ab039)
RadiantUwU pushed a commit to RadiantUwU/godot that referenced this issue Sep 30, 2024
Fixes godotengine#96491.

Update fix for godotengine#96262 to a simple revert of the problematic commit,
as the upstream fix is still being debated and caused other issues.

Also include fix for upstream regression 2715 added in 0.14.9.

(cherry picked from commit a6ab039)
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