Game Development Community

Anti-Aliasing Has No Effect on 3D Objects in T3D - RESOLVED

by Philip J. Stroh · in Torque 3D Professional · 05/06/2010 (1:00 pm) · 13 replies

In Torque 3D 2009 Pro 1.1 Beta 1, when I set $pref::PostEffect::EdgeAA equal to 1 in the pref.cs file, it has no effect on edge smoothing of objects in the simulation. Also, if I set the Anti-Aliasing parameter in the video::mode string ($pref::Video::mode = "1152 864 false 32 60 8";) in the pref.cs file to anything other than 0 or 1, then when I load the simulation everything is black (the background, the objects, etc.).

Is there a way to use Anti-Aliasing in T3D to smooth the edge of 3D objects? Or is this a limitation of T3D?

I am using the NVIDIA GeForce GTX 280 graphics card.

Also, I have tried overriding the Anti-Aliasing settings directly through the graphics card, but it did not have any effect.

About the author

Companies I worked for: VTSG: F16 simulations. Simigon: Primarily F16 simulations. Veraxx: 2D simulation called the TEN. Valador: DON, plus new Torque projects. I served in U.S. Marine reserves for a little more than 9 years in an infantry unit.


#1
05/06/2010 (2:25 pm)
You cannot use driver-based MSAA in Advanced Lighting. It uses deferred lighting and thus is incompatible with traditional MSAA (Basic Lighting will actually use AA if you set in the prefs).

I haven't checked it, but seems the EdgeAA post effect is broken in 1.1b.
#2
05/07/2010 (8:49 am)
Thanks Manoel. You were right, AA works with Basic Lighting. It does not work with Advanced Lighting however. Does anyone know how to get AA to work with Advanced Lighting?
#3
05/07/2010 (9:26 am)
Like I said, AL uses deferred rendering. This works by rendering depth and normals to buffers, which are then used to compute lighting. Traditional MSAA cannot be used to AA normals/depth because this causes incorrect values. With DX10/10.1/11 it is possible to perform AA deferred rendering, but it'll take a while until T3D gets a DX11 renderer.

The edge AA post effect should apply a small blur effect on the edges, but I don't know why it's not working right now.

Recently Pandemic published an article on the AA technique they're using for The Saboteur PS3, with is based off an Intel paper. It is a post processing effect, and I believe a modified it can be implemented via shaders.
#4
05/10/2010 (6:47 am)
Edge AA still works, but you have to do some work... delete the client's prefs.cs and set the related option to 'true' in defaults.cs (core/client)
#5
05/10/2010 (10:09 am)
Thanks Aaron, that worked for 2 of my computers, but one of them when I change the edgeAA variable to true and set the anti-alias to 2,4 8, or 16, the simulation is completely black. The computer where it does not work uses an NVIDIA GeForce GTX 280. The 2 computers where it did work use NVIDIA GeForce GTX 280M. Any ideas?
#6
05/10/2010 (10:45 am)
Well given how flakey the nvidia drivers have been I'd try a few diffrent driver versions.
#7
05/10/2010 (12:10 pm)
Edge AA is separate from the antialiasing level prefs, don't use them together! Enabling MSAA will break the rendering of the G-buffers used by AL, thus why everything is black.
#8
05/10/2010 (7:41 pm)
Thanks Manoel. You are right. I got it to work just using the Edge AA. Thanks for your help.
#9
06/05/2010 (11:01 am)
This issue was logged. TQA-224
#10
06/20/2010 (6:38 am)
Torque3D is based on the light prepass render pipeline.The MSAA should work in the Advanced lighting mode. It must be a bug if MSAA not works.
#11
06/20/2010 (7:44 am)
@Heron: T3D doesn't allow MSAA in the 2nd pass, but one could enable it with some source changes. But using MSAA with light pre-pass yelds varying results since the light buffer is still aliased: you'll only see anti-aliasing in areas where the lighting doesn't change much.

Coincidently, I've been hacking the Edge AA shader today trying to come up with a better post-processing AA loosely based on the Intel article. I got a part of the algorithm down:
i47.tinypic.com/5x8ub4.jpg
Right now it only works for one kind of edge slope (the zoomed-in areas). I still need to come up with a way to determine the slope directions, but I have some ideas already.

BTW, this is the idea:

1) Generate an edge mask. The EdgeDetectPostEffect already does this in a very convenient way (I just changed it to work at full res instead of quarter res): it marks the pixels where the aliasing "step" with full value and the other edge pixels with smaller values. This information is vital for my idea to work. The edge mask creates a 2-pixel wide mask around the edges, so I have the polygons in both sides of the edge.

2) determine if the edge at that pixel is predominantly horizontal or vertical, and if it's going down or up (for horizontal edges) or left or right (for vertical edges). This is the step I'm not performing right now (my shader is hardcoded for one edge type).

3) For each pixel on the top (horizontal edge) or left (vertical edge), sample along a straight line (up, down, left or right, depending on the edge type) a fixed number of edge mask samples until a full aliasing step is found (full white), then store the distance to that sample. The distance is then used to calculate how much the pixel will blend with the neighbor pixel on the same edge (1 pixel below for horizontal edges and 1 pixel to the right for vertical edges). This is what I'm doing now.

Sounds complicated, but should be pretty fast (on hardware that would be able to run MSAA).
#12
06/21/2010 (7:24 pm)
Manoel,thanks for your interpretation, i've got it.
Edit:After take some reviews for the Wolfgang Engel's "Render Design",the second render pass is normal lighting pass, Msaa do should work here,I will review t3d's sourcecode and tell you the result.
#13
08/02/2010 (4:15 pm)
Fixed in 1.1 Beta 2