Need guidance Vector Graphics 2.0.0_Converting UInt16 to UInt32

I need help with modifying the capability of VectorGraphics 2.0.0 to handle vertices more than 65535 vertices, as the SVG file I am importing presents the following error “Vertex array is too large. A sprite mesh may not have more than 65535 vertices.” I tried modifying the SVGImporter.cs and the SVGImporterEditor.cs code to handle from UInt16 to UInt32, but the vector utils code has to be changed.

regards,
Farmaan

This may be an internal limitation for sprites that you can’t overcome by modifying the importer.

65k vertices for an SVG sounds like an awfully complex SVG. You’re best adviced to optimize the SVG or perhaps split it into multiple (overlaying or tiling) parts.

And unless you need the SVG natively in Unity, perhaps to modify it, you can simply export it as PNG and use that as sprite. The SVG Importer is mainly a convenience just like importers for .blend or .psd files provide the use of original source files at the cost of extra import time and often much bigger source files in the project.

I haven’t tried tiling yet, will try it. Converting it into PNG will compromise the image as it gets converted from Vector Based to Raster Based. My application requires of me to zoom in/scale up on the image as much as possible to place some points at the intersection. The thing is, when I zoom in/scale up on the imported PNG image within the application it is very pixelated which is not what I want. is it possible, if there is an other way to retain the quality of the image even if it is scaled or zoomed?

Yes my SVG is pretty complex as it is high resolution image of a building blue print drawing. So details cannot be compromised, if I use Adobe Photoshop or Inkscape to reduce the number of vertices within the image it seems to compromise the image.

Yes, commonly you’d have some form of “level of detail”. In its simplest form, assuming you have a zoom ratio of 2x, you can save the PNG twice. One is the max resolution for when you are zoomed in, the other is the zoomed out version with half the resolution.

You can also skip the second half-resolution image but this may introduce aliasing artifacts unless the image is carefully designed and the zoom ratio is a multiple of 2 (eg 2x, 4x, 8x), or a shader is used to downscale the image in a way that minimizes aliasing artifacts.

Hmm how big is that image in pixels?

8k resolution (8192x8192) is the most you should have in a single texture on desktop GPUs or else you’re already be incompatible with nearly 8% of all desktop GPUs.

Note that an 8k texture consumes a whopping 256 MB VRAM in uncompressed RGBA32 format. So the limitation is much more that of the GPU’s RAM than whether it can actually handle textures of a given size.

The PNG I used is of the 8400x6000 pixels. But this is when everything is barely in quality when I go into my application. Have to add that my application is VR. So the quality is still uncomfortable to me when I use it wearing the glasses.

That is why i moved to vector based rendering. your idea for iterating the zoom ratio for an image is something that I will try.

This then makes it more than 8k in other words it requires the hardware to support 16k textures.

It’s also HUGE specifically for VR!
At most what you can reasonably use for VR is 4k, unless you have a very very specific use case and full control over performance metrics and the targeted hardware, then perhaps 8k for specific textures only. That’s assuming PC VR, not mobile VR (Quest).

Check the texture import settings. Unity by default limits the texture “max size” to 2k no matter the size of the imported texture.

Got it, I will check that out.

Out of curiosity are there any other vector based rendering assets besides Vector Graphics 2.0.0 or PDFRenderer from your knowledge. Yes, I tried using PDFRenderer as well, the thing is it takes more time render after zooming in/scaling up the viewport which was also not favorable.

There may be others but I doubt any of them are suitable for VR development since rendering textures is still the fastest method around.

There is at least Shapes which does the shape rendering via shaders but I don’t know whether this will import SVG graphics. May be workable with a conversion script though.

Not sure how experienced you are with VR development, but every time someone starts making a VR game themselves for the first time, they’re always baffled at how low resolution it is or how much aliasing there is. It’s really hard to appreciate the effort that goes into making VR rendering look smooth and sharp (specifically text) and that’s despite the low resolution of VR glasses.

By “low resolution” I’m aware that the glasses often render at 2,000 or more pixels but you put those right in front of your eyes effectively with magnifying glasses, thus 2k VR looks more like 480p on a standard monitor.

Interesting, I will be sure to try out your suggestions.

Thank you very much you have been a very big help.

It will be awesome if this thread is active even after today, will it be? I want to be able to communicate if in case I have any questions in the future.

1 Like

Threads don’t get closed immediately. Even if the thread is closed after some time (months I believe) you can still reply but it will create a new thread “in reference to” and link back to the original thread.

1 Like