Page 1 of 1

[Unity]Problem with SVG

Posted: 22 Sep 2014, 17:13
by Mikael Gyth
Hello.

I have been trying to use a SVG (Converted to XAML in Inkscape). I believe I have done this as it should be done as per the documentation. However the resulting shapes rendered in game looks horrible.
Image
As you can see from the image the top looks drastically worse than the bottom. The top is from Unity3D and the bottom is from Blend editor window.

Here is the code used to generate these images:
<Viewbox x:Name="Gears" HorizontalAlignment="Left" Margin="6,4,0,0" VerticalAlignment="Top" Grid.RowSpan="2">
				   <Canvas Name="svg2" Width="32" Height="23">
				   <Canvas.Resources/>
				   <Canvas Name="gears">
					  <Canvas.RenderTransform>
						 <TranslateTransform X="0" Y="0"/>
					  </Canvas.RenderTransform>
					  <Path
						 Name="bigGear"
					
						 Data="m 22 0 c -0.033 5.2e-4 -0.068 0.001 -0.103 0.004 -2.260 0.153 0.097 3.161 -1.974 4.078 -2.071 0.917 -2.715 -2.848 -4.348 -1.277 -1.632 1.570 2.105 2.358 1.108 4.393 -0.997 2.034 -3.910 -0.435 -4.151 1.817 -0.241 2.252 3.128 0.452 3.672 2.652 0.543 2.199 -3.275 2.178 -2.012 4.059 1.263 1.880 2.689 -1.662 4.519 -0.326 1.830 1.335 -1.109 3.775 1.066 4.403 2.176 0.628 0.990 -3.003 3.250 -3.157 2.260 -0.153 1.578 3.604 3.649 2.686 2.071 -0.917 -1.171 -2.936 0.461 -4.507 1.632 -1.570 3.524 1.749 4.521 -0.285 0.997 -2.034 -2.784 -1.497 -2.543 -3.750 0.241 -2.252 3.823 -0.926 3.279 -3.126 -0.543 -2.199 -3.095 0.642 -4.358 -1.237 -1.263 -1.880 2.333 -3.168 0.503 -4.504 -1.830 -1.335 -1.959 2.483 -4.135 1.855 -2.142 -0.618 -0.306 -3.824 -2.405 -3.777 z m 0.485 6.302 c 2.008 0 3.634 1.628 3.634 3.636 0 2.008 -1.626 3.636 -3.634 3.636 -2.008 0 -3.636 -1.628 -3.636 -3.636 0 -2.008 1.628 -3.636 3.636 -3.636 z"
						 Fill="#10FFFFFF"/>
					  <Path
						 Name="smallGear"
					
						 Data="m 11.0 9.0 c -0.022 -0.010 -0.046 -0.022 -0.070 -0.032 -1.562 -0.660 -1.000 2.142 -2.694 2.055 -1.693 -0.087 -0.853 -2.817 -2.474 -2.320 -1.620 0.496 0.611 2.284 -0.740 3.305 -1.352 1.020 -2.465 -1.610 -3.386 -0.188 -0.920 1.421 1.937 1.358 1.559 3.009 -0.378 1.651 -2.923 0.348 -2.713 2.029 0.209 1.681 2.357 -0.201 3.129 1.307 0.772 1.508 -2.014 2.144 -0.772 3.298 1.242 1.154 1.674 -1.669 3.236 -1.009 1.562 0.660 -0.160 2.937 1.532 3.025 1.693 0.087 0.207 -2.355 1.828 -2.851 1.620 -0.496 1.764 2.356 3.116 1.335 1.352 -1.020 -1.355 -1.939 -0.434 -3.361 0.920 -1.421 2.867 0.672 3.245 -0.978 0.378 -1.651 -2.284 -0.616 -2.494 -2.297 -0.209 -1.681 2.627 -1.326 1.854 -2.835 -0.772 -1.508 -2.146 0.996 -3.388 -0.158 -1.222 -1.136 1.084 -2.655 -0.333 -3.332 z m -1.800 4.369 c 1.341 0.677 1.879 2.313 1.202 3.653 -0.677 1.339 -2.312 1.877 -3.654 1.199 -1.341 -0.677 -1.880 -2.313 -1.203 -3.653 0.677 -1.339 2.313 -1.876 3.655 -1.198 z"
						 Fill="#63C3C3C3"/>
				   </Canvas>
				</Canvas>
				</Viewbox>
I hope anyone can shed some light on this for me, I have used shapes that I have created before in Noesis and they have looked very good compared to this.

Re: [Unity]Problem with SVG

Posted: 22 Sep 2014, 20:55
by Mikael Gyth
I just noticed that the images look like they should when I change AA mode to PPAA. (Witch I never have had to do before).

Re: [Unity]Problem with SVG

Posted: 22 Sep 2014, 21:14
by jsantos
Hi!

Yes, to get a fine quality you need to

1. Activate MSAA in your game

or

2. If MSAA is not a valid option for your game you need to enable PPAA (PerPrimitive Antialiasing) that is an emulation of MSAA. It works fine in most of the scenarios.