SlugFiller / godot-vector2d

2D vector graphics plugin for Godot
The Unlicense
2 stars 1 forks source link

Sample SVG not rendering: official Firefox logo #3

Closed Giwayume closed 1 year ago

Giwayume commented 1 year ago

firefox_logo_2019

SlugFiller commented 1 year ago

Fixed by a1ba95e265a9c2928efff62a18aede3ca5b8c978

For this particular image, anyway. My SVG parser is really a hackjob. It doesn't really compare to yours. Your parser with my shader would probably make for pretty decent SVG rendering results. With the notable exception that my rendering model doesn't have a concept of "host coordinate system", since it's not painted inside a box, so any SVGs that try to be "responsive" would necessarily behave weird.

Giwayume commented 1 year ago

Yeah it looks like perhaps the coordinate space for some of the gradients is not being calculated correctly? Or maybe alpha values in the gradients are being treated as fully opaque?

image

Maybe it would make sense to merge these projects at some point, but I'm going to at least POC everything the mesh conversion approach can do first. I am curious if the path simplification + triangulation can be done fast enough for a sensible animation use case. So much of the code is "get it working" and not "get it running fast" right now.

SlugFiller commented 1 year ago

Odd. It's working fine for me. Did you re-import it after getting on the latest patch? Godot can be annoying on re-import. It's usually necessary to turn the plugin on and off, and delete the .import file, then switch away from Godot and switch back, and only then it re-imports. If you try the "reimport" button it will usually ask for a (completely superfluous) restart.

The issue was that it was assuming gradient stop offsets are represented as percentage, so it was dividing everything by 100 unnecessarily. Note that representing as a percentage is valid, but only if the % sign appears

Giwayume commented 1 year ago

Oh, yeah reimport worked.