Page 1 of 1

SVG Renderer questions

Posted: 08 Jan 2014, 03:15
by kaban
I was wondering, does the svg renderer in noesis actually render svg or does it rasterize and render a texture?

If it renders svg would it be possible to have it render in world space instead of screenspace without resorting to render to texture?

I ask because noesis seems to be the only svg renderer available for Unity that works and is in active development :lol:

Re: SVG Renderer questions

Posted: 08 Jan 2014, 15:22
by jsantos
noesisGUI renders directly using triangles, yes. You have the option of using a Render Texture, but the component attached to the camera renders directly to the main screen surface.

What do you mean with world space? You can apply 3d-projection to any element to apply perspective. Is that what you want?

Re: SVG Renderer questions

Posted: 10 Jan 2014, 05:54
by kaban
Yes I'd like to render it with perspective, but what I would ideally like is to be able to attach it to a gameobject and have it render whereever the gameobject is (i.e. using its transform).

More importantly could you please confirm, can noesis render an svg file? I ask because the vector (lion) demo in place is using a xaml file with vector coordinates.

Re: SVG Renderer questions

Posted: 10 Jan 2014, 19:01
by jsantos
Yes I'd like to render it with perspective, but what I would ideally like is to be able to attach it to a gameobject and have it render whereever the gameobject is (i.e. using its transform).
This is the way RenderTexture works with gameobjects. Although if you have a lot of them it can be inefficient (as discussed here viewtopic.php?f=3&t=266).

The alternative, as you said, is using perspective and updating the transform each time the gameobject moves. There are several problems with this approach:
  • Culling is not implemented. If the object is out of camera, the GUI is still sent to the GPU
  • Although the perspective can be achieved, our GUI does not interact with the zBuffer provided by Unity.
We have yet to find time to investigate all these issues and create a demo showing the different options.
More importantly could you please confirm, can noesis render an svg file? I ask because the vector (lion) demo in place is using a xaml file with vector coordinates.
Not directly (although a custom control that understand svg could be implemented) but you can convert the SVG to Xaml and render it (as shown here viewtopic.php?f=12&t=188)

Re: SVG Renderer questions

Posted: 10 Sep 2014, 15:24
by markeahogan
Hi could you go into a bit more detail about how you'd pass the position/rotation from the gameobject to the transform? I need my UI to line up 1:1 with the 3D, but culling is not important

Re: SVG Renderer questions

Posted: 11 Sep 2014, 11:34
by jsantos
Yes, there is a sample of 3D projection inside the Control Gallery (NoesisGUI\Samples\ControlGallery\Samples\Projection.xaml). That sample is using a PlaneProjection to set up the perspective transform:
<PlaneProjection x:Key="ProjMtx"
		CenterOfRotationX="{Binding Value, ElementName=CenterX}"
		CenterOfRotationY="{Binding Value, ElementName=CenterY}"
		CenterOfRotationZ="{Binding Value, ElementName=CenterZ}"
		RotationX="{Binding Value, ElementName=RotX}"
		RotationY="{Binding Value, ElementName=RotY}"
		RotationZ="{Binding Value, ElementName=RotZ}"
		LocalOffsetX="{Binding Value, ElementName=OffX}"
		LocalOffsetY="{Binding Value, ElementName=OffY}"
		LocalOffsetZ="{Binding Value, ElementName=OffZ}"
		GlobalOffsetX="{Binding Value, ElementName=GOffX}"
		GlobalOffsetY="{Binding Value, ElementName=GOffY}"
		GlobalOffsetZ="{Binding Value, ElementName=GOffZ}"/>
So basically you have to get those values from the transform of your gameobject and set them to the root container of your XAML.