"In C we had to code our own bugs. In C++ we can inherit them."
More pages: 1 2
Phone-wire AA
Tuesday, June 26, 2012 | Permalink

I have a new demo illustrating a simple but effective way to deal with the typical aliasing problem on thin geometry, in particular phone-wires which are quite common in games and typically appear as a bunch of random disconnected dots at a distance. MSAA can only reduce the problem a bit, but doesn't fully solve it. This technique solves the problem and creates wires that look natural at any distance.

Name

Comment

Enter the code below



sqrt[-1]
Tuesday, June 26, 2012

Excellent demo - simple and elegant. (as always)

Roy
Tuesday, June 26, 2012

This may sound odd because it's such a small detail, but I find it actually vastly improves the perceived quality of the entire scene.

Greg
Tuesday, June 26, 2012

Actually I didn't know such things were possible.
Currently trying to figure out the math, not sure to understand what's going on.

So, basically, you have PixelScale, which is tan(0.5*FOV)/screen_height (i guess you assume an aspect ratio > 1.0 here).

Then you compute the .w component of the projected vertex.

Then, I am not sure why you could get the pixel size at this position by multiplying w and PixelSize together...

Humus
Tuesday, June 26, 2012

It should work for any aspect ratio, because we have square pixels, so it should be the same. I'm going by the height because the fov is in the vertical direction. The math is quite intuitive if you draw the frustum from the side, and put a view-aligned plane at distance w into the frustum.

Greg
Tuesday, June 26, 2012

OK, makes sense regarding the FOV. Looking stupid once again

I think I need to exactly understand what W means in projected space, actually, what it means geometrically (apart allowing projection by dividing with w).

Humus
Tuesday, June 26, 2012

W is easy to understand. It's Z that's weird. W is just plainly the distance along the view vector. One unit in front of the camera W is 1, two units forward it's 2. But Z on the other hand is this weird scale and bias of W such that Z/W becomes 0 at the near plane and 1 at the far.

Greg
Tuesday, June 26, 2012

Really ? I understand z but thought w had some magic in it - and actually never used it for any purpose... I guess I need to have a look at my "constant screen size particles" shader again
Thanks for the explanation !

Greg
Tuesday, June 26, 2012

...looking again at my proj matrix code makes me realize that the 4th row reflects indeed what you are saying

More pages: 1 2