Anti-aliasing in openGL
Hi,
Im completely new to open gl, but ive seen some really nicely rendered shapes, and am wondering how you go about getting them to look smoother.
Im currently rendering planes using gridshape in order to make a cube. Then im using handle to rotate all of the planes and sketch to draw the 3D object. I was wondering if there is a way to anti-alias the planes in order to get rid of the jaggedy edges, or wether there is any way of smoothing or shading the shapes so that they look 'nicer'.
Thanks in advance
Jamie
hello alexanderthomas,
you could try to send a fsaa 1 message to your [jit.window]
if your grafic card support this mode, it shoud work.
best,
will
here the info from the [jit.window] help
Full scene anti-aliasing (FSAA) when rendering 3d graphics, can be turned on/off with the fsaa message. Support for full scene anti-aliasing depends on your graphics card, current graphics card settings, and available VRAM. Please consult the documentation or technical specs for your graphics card for more information. By default, full scene anti-aliasing is turned off.
Hi will,
Thanks for the quick reply,
Unfortunately I dont think this is possible as I am using jit.gl.sketch to render the plane to a named floating window and not a jit.window.
Thanks though
Jamie
named floating windows are made with jit.window. are you thinking of in patcher windows which are jit.pwindow? if so you can still send the pwindow fsaa 1
either way fsaa should work if your graphics card supports it.
Ahh, Ive got it now. Thanks
Looks a lot smoother, is there any more processing that can be done , say to round the edges slightly or something as there still seems to be a lighter outline when rotated slightly
Thanks for the help.
Much appreciated
Jamie
can you post a patch that demonstrates what your talking about, Im not sure if I follow
alexanderthomas wrote on Sat, 04 April 2009 13:49
Looks a lot smoother, is there any more processing that can be done , say to round the edges slightly or something as there still seems to be a lighter outline when rotated slightly
The jit.gl.gridshape object (and some others) also take the antialias 1 message. It helps most in wireframe or points modes (poly_mode 1 1 or poly_mode 2 2). In points mode it turns square points into round ones, which I was quite pleased to discover as they look much nicer. However when the points get large (point_size) things do slow down considerably compared to the square ones, since it's doing a lot of extra calculations to render them.
Not sure how the fsaa and antialias messages interact/overlap/interfere with each other...?
oh cool, the round points thing I did not know, thats great!
Thanks for all of the help. The antialias 1 message doesn't seem to do anything when i send it to gridshape. I think the problem lies with the lighting/shading as I think the edges of the faces behind are slightly visible but are not being affected by the lighting.
Here is a simple example. Its not quite so obvious in this one as I have a live camera feed behind the real patch, but hopefully you'll get what I mean.
Many Thanks
Jamie
you could try capturing your scene to a texture, and applying a blur to the texture. check out Max5/examples/jitter-examples/render/slab/jit.gl.slab.gauss6x-example.maxpat for a good blur slab to use.
search for "capture to texture" or "render to texture" or "scene process" for more information.
alexanderthomas wrote on Sat, 04 April 2009 16:25Thanks for all of the help. The antialias 1 message doesn't seem to do anything when i send it to gridshape. I think the problem lies with the lighting/shading as I think the edges of the faces behind are slightly visible but are not being affected by the lighting.
Try this modified patch. The antialias seems only noticeable when in wireframe or points mode, though the fsaa seems to help when in solid mode. Also the line_width and point_size commands differ slightly if antialias is on or off...if it's on, then fractional changes affect things, but if it's off, it seems to increment only by integer amounts.
I think you can modify it to draw the gridshapes directly, without using jit.gl.sketch, which may be slowing things down? Not sure but it runs sluggishly here compared to other similar patches I've had. If you don't use the sketch, you can attach the handle to jit.gl.render directly, though there's a setting you need to change---"inherit_transform"---so it doesn't go "all wacky". It takes a little fiddling.
Im using four cubes in the main patch, so I think thats why I ended up using sketch. Is this still the cheapest way? Im definitely looking for ways to optimize it too. For now I think fsaa has done the job.
Thanks for all the help
Jamie