JHG Posted October 3, 2022 Share Posted October 3, 2022 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 Here's what the origin looks like for the SVGTest_Import.svg (correct version) Here's what the origin looks like for the SVGTest_Export.svg (broken) Quote Link to comment Share on other sites More sharing options...
Dan C Posted October 4, 2022 Share Posted October 4, 2022 Hi JHG, welcome to the forum. Could you share your export preferences for the SVG? Does toggling "set viewbox" fix the issue? Lee Quote Link to comment Share on other sites More sharing options...
JHG Posted October 4, 2022 Author Share Posted October 4, 2022 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 Quote Link to comment Share on other sites More sharing options...
Dan C Posted October 4, 2022 Share Posted October 4, 2022 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 Quote Link to comment Share on other sites More sharing options...
JHG Posted October 4, 2022 Author Share Posted October 4, 2022 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. Quote Link to comment Share on other sites More sharing options...
Dan C Posted October 5, 2022 Share Posted October 5, 2022 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 Quote Link to comment Share on other sites More sharing options...
JHG Posted October 5, 2022 Author Share Posted October 5, 2022 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.