Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
195 stars 9 forks source link

SVG Image support #137

Open sirkitree opened 6 years ago

sirkitree commented 6 years ago

Problem/Motivation

When trying to import an svg file through the file browser, it tries to render as a text file. SVG images are a desirable format due to their crispness as you scale them.

Proposed solution

Utilize an svg image library for parsing and displaying svg images.

Frooxius commented 6 years ago

Hmm I was considering SVG support before, but it's really low priority, because it behaves a bit differently in 3D than on screen. There are two approaches you can take:

1) Use SVG library to render them into a texture. However this doesn't provide much benefit, as you end up with just raster image anyway and don't get any extra crispness, you could as well convert it to a PNG ahead of time and get the same result.

In 2D software, the window and SVG is redrawn as you move and zoom around, but in 3D environment this doesn't apply, as you're redrawing every frame.

2) Convert the SVG to an equivalent(ish) mesh. This will provide the extra crispness (although there still might be extra loss, as smooth curves have to be converted to vertices), however it's quite engine specific, so I'd need to write tons of code to have a good enough coverage of the SVG standard.

You could try importing the SVG into Blender and exporting as an FBX, but there's probably going to be some information loss during that process.

Anyway thanks for the suggestion!

sirkitree commented 6 years ago

Thanks! I was hoping it'd be an easy one, but since it's not, I'm fine converting it first.

Frooxius commented 6 years ago

Doing the first method would be easy, but it wouldn't provide much benefit over converting it to a PNG beforehands, save for some convenience and ability to increase the resolution.

SVG unfortunately doesn't fit as well into a 3D pipeline as it does into traditional 2D applications.

dfgHiatus commented 2 years ago

I have a workaround for this: https://github.com/dfgHiatus/NeosSVGImporter