[Development] Antialiasing

Samuel Rødal samuel.rodal at digia.com
Fri Oct 5 14:51:09 CEST 2012


On 10/05/2012 02:28 PM, Wehmer, Matthias wrote:
> Hi Samuel,
>
> I will try to make myself clearer, sorry for that unclear information.
>
> The shaders I’m talking about are those, that I implemented in my custom
> Qml plugin via the QSGSimpleMaterial class. There I have implemented two
> custom versions of the vertex and the fragment shader, whereby the later
> is just coloring the scene. OpenGL itself is involved in such a way as I
> use it to pass a texture to the fragment shader, but the geometry for
> example is created with the methods and objects given by Qt, i.e. I use
> a QSGGeometryNode and attach my geometry to it and simply draw a
> Line_Strip between them.
>
> The setAntialiasing() method I talk about is the one from the QQuickItem
> class.

Yep, this was implemented recently and is a way to get antialiasing 
without using multisample buffers (since those consume a lot of memory). 
It does antialiasing in the fragment shader, by adding a set of 
triangles around the shape (in the case of a Rectangle), and doing a 
fade-out of the material around the edges. I believe it needs to be 
implemented by each item / node somehow.

>  From my understanding this method should turn on some kind of
> postprocessing, that is antialise the scene after it is drawn by the
> SceneGraph. Obviously this doesn’t work for my custom widget, although
> all other items are antialiased. So either I understand this option and
> its consequences wrong or I need to implement some postprocessing on my
> own. For that I would need access to the scene (in form of a texture)
> after it has been drawn by the SceneGraph. Is there a possibility for
> that? Do you see my problem and what I understand wrong? I’m kinda
> struggling right now, because the whole rendering mechanism seems to be
> a black box for me. :D

It is not a postprocessing feature. I'd suggest to have a look at how 
the Rectangle element implements the antialiasing.

Of course, you can also use multisampling by doing setSamples(4) or 
similar on the QQuickView's surface format.

--
Samuel



More information about the Development mailing list