Three.js: SVGLoader: Unable to load SVG file. Many details lost.

Created on 30 Sep 2019  路  5Comments  路  Source: mrdoob/three.js

I had loaded a svg file in my computer,but the svg path didn't render a correct order,many details were been keeped out.and the shape looks like strange.
map1.svg.zip

Bug Examples

Most helpful comment

SVG rendering is a _can of worms_

For others, that is slang for "SVG rendering is complicated" -- I assume due to the rendering order.

All 5 comments

I can confirm that the imported SVG does not correct:

Result of `SVGLoader:

image

SVG preview on Mac:

image

Just to see if it shows up, I've manually modified the file and reset the position of the central group that contains most of the missing details (it has id = "12F鍘熷"), and effectively it is there.

So it is not a problem of the parsing, but the rendering order. SVG rendering is a can of worms and that's why we transferred the painting out of the loader, to the user.

itisthere


Besides that, it seems that strokes are broken due to past commits: The example shapes "Tiger", "Three.js" and "Caps and joins" give the following error and all of them have missing strokes:
THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.

The example webgl_geometry_text_stroke.html seems to be still right.

I will investigate previous commits.

SVG rendering is a _can of worms_

For others, that is slang for "SVG rendering is complicated" -- I assume due to the rendering order.

About the strokes not rendering, I've found it happens only in Firefox. In chrome it renders OK. I will file an issue.

I counted the area of each mesh first, and then let the larger one load first

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bandit picture Bandit  路  3Comments

zsitro picture zsitro  路  3Comments

jack-jun picture jack-jun  路  3Comments

yqrashawn picture yqrashawn  路  3Comments

boyravikumar picture boyravikumar  路  3Comments