SVG resolution when using b64 strings


I’m using the viewer api to create textures.

When I use an svg in a base 64 string (data:image/svg+xml;base64,${btoa(base64)}) the resolution is super low. I’ve seen the issue brought up on the forum but maybe svgs are not recognized when in a base 64 string? How could I get a decent resolution?

In a kind of related note, is support for object urls on the roadmap?

As SVG is a vector graphics, there is no raster size predefined, and for performance reason the viewer limit the raster resolution of svg to 2048.
It’s overridable using an url option svg_size: ?svg_size=1 or in api initialisation option

svg_size: 4096,
I’m surprised 2048 is not enough though, as most screen are lower than that, and that’s the case when texture are displayed right in front of the 3D camera?
I would double check the UV layout to make sure there is no waster texture space before going to higher resolution, as it greatly impact performance and portability

I’m using the texture on a decal so 2048 should really not be a problem indeed.

Yet this is what I see:

Maybe the alpha masking is the problem? I wouldn’t think so because the orange/black transition looks pixelated as well.

For reference, the svg file looks clean and there is not white space around the graphic.

You may need to use the opacity channel in blending mode instead of the masking channel, if you have alpha gradients on the borders.

Thanks Rémy!

Unfortunately, there is still the same issue.

It’s less noticeable because of the blending but the pixels on the edge are big when they should be a lot smaller at 2048. I don’t think this is a transparency issue since there is a similar effect on the inside edge of the branches.

I was able to reproduce the exact issue in a codepen, I’m sending you the link. It looks like using an svg url works fine but using a base 64 encoded string produces the pixelated result.