Jump to content
Our response time is longer than usual currently. We're working to answer users as quickly as possible and thank you for your continued patience.

SVG Origin Changes


Recommended Posts

I recently updated Designer to the latest version and now I notice that my SVG Origin when exporting is wrong and I can't find a way to change it. I import the svgs into Unity and use the SVG Origin as the basis for positioning/pivoting. This used to work fine in a recent version but once updating to 1.10.5 it no longer works. My SVG Origin always ends up in the top left.
Here is the sample file that works correctly when imported into Unity:
SVGTest_Import.svg

Even if I don't change anything at all and just re-export from Designer it still changes. Here's the resulting output file that has a bad origin, and a diff of the imported vs exported:
SVGTest_Export.svg
image.thumb.png.785724e825824fdc02e56c68d387682b.png

Here's what the origin looks like for the SVGTest_Import.svg (correct version)
image.png.34dafb0b5f7a7892bb781f819be14751.png

Here's what the origin looks like for the SVGTest_Export.svg (broken)

image.png.b1fd11ce44198e85803002f4c3ec326a.png

Link to comment
Share on other sites

Hi Lee, Thanks! :)

I did try toggling "set viewbox" and it did not fix it. Also for what it's worth I tried rolling back to a bunch of different versions (not every one, but all the way to 1.6.5) and couldn't get the expected behavior back which was very odd. I know it worked, at least with other svg files, because I was bragging up AD and using it regularly since we were having so many issues with SVG Origins in Illustrator. AD was the only reliable tool we had found to allow us to edit svg files and have usable sizing and origin still. Sorry for the confusion on that though.

The other downside is that even if I try to compensate for the behavior and move things to the top left then much of the symbol is out of the artboard/document area and it gets clipped out so that isn't a workaround either. 

 

Thanks again

Jared

Link to comment
Share on other sites

  • Moderators

As a 3d artist I understand. I believe this to be by design, as SVG's are essentially designed for web use. In most (if not all) 2d vector design programs the origin tends to default to standard specification of SVG at the top left of the page/object and moving down and right, whereas generally 3d software defaults to the geometric centre of the item.

The SVG you have is a little unusual, it looks like it was generated from a 3d app (the leftmost circle is made from lots of tri's etc), I'm assuming this is why it's origin is set at the centre.

Affinity Designer has toggleable origin behaviour, so I don't believe it's exporting this with the file, and resorting to the default (top left)

I'll investigate further to see if I can find a solution, in the past I've generally accepted it's a norm to have to adjust origins post export in the destination 3d application.

Lee

Link to comment
Share on other sites

Yeah I get that those defaults make sense and could be expected. It's just odd to me that svg origin is a usable feature of the standard and yet it's not well supported/controlled in most apps, even Illustrator (Illustrator is even worse as it messes up the sizing too). I would hope that at a minimum AD just wouldn't adjust it and would leave it as imported.

You are correct that this svg came from a 3d app. Our pipeline uses CAD dwg files, and converts them to svg for use as vector graphics in our Unity app. The origin is very important for our use case, we can't just default to center because we have a lot of other data for asset offsets within the space of how it was setup in the dwg. So 0,0,0 needs to be maintained so we can properly connect/render content together. Almost like joints/bones in 3d skeletal rig.

As a test I manually edited the matrix transform for this exported test and when I changed 47, 47 to 0, 0 it fixes the issue but this isn't something we'll be able to do for all our content. Just hoping it helps any debugging if you guys can keep looking into it. Also I had seen a feature request somewhere where another AD user highlighted the value in setting the SVG Origin. I think AD would provide another huge benefit over Illustrator or other competition by handling origins more intuitively.
image.png.a79efb4fecd832fcf9b7f5e990faf23b.png

Link to comment
Share on other sites

  • Moderators

It may be worth adding a post in the suggestion forum for additional export options for origins on SVG's.

I don't know if there are ways to set origins en masse in unity (like blender's set origin to geometry, which works on multiple selections at once) but maybe that's a good workaround?

The problem with assigning it as a bug is, that "fixing" it, would change behaviour for other workflows.

Lee

Link to comment
Share on other sites

The only bug fix I would hope could be considered is that when importing an svg it's origin ends up being modified when exported. It'd be great if that was maintained somehow. So essentially just keeping any matrix transforms that happen internally consistent with what's imported.

I agree with being able to set the origin as a bigger ask involving other workflows. I'll chime in on the other feature request for it that I found and hopefully add some traction there.

I haven't seen a way to set origins in Unity, but unfortunately it won't be something we could do anyway. We'll have to either find a different app to edit svg files with, or more gross, we'll have to work back from the dwg side and roll the changes all the way through to svg again. We have over 600 assets that run through this pipeline so unfortunately it needs to be a bit more streamlined of an approach.

Thanks for all the replies and suggestions though :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

Please note there is currently a delay in replying to some post. See pinned thread in the Questions forum. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.