Question to High Quality Antialiased Lines (Shader X7)/ Perspective divide

Christian Heckl <[email protected]>
Newsgroups gmane.games.devel.algorithms
Message-ID <[email protected]>
Hi out there,

I am currently working on rendering laser beams through billboards in a 
deferred rendering environment. I have strong aliasing issues when 
viewing these beams from afar as they are pretty thin with respect to 
the overall world geometry. The result is a "marching-ant" stipple-like 
pattern as shown in the attached image.

Inspired by "Simplified High-Quality-Anti-Aliased Lines" (Shader X7) I 
decided that keeping the projected beams from falling below a certain 
pixel threshold when viewed from afar (thus effectively making them 
slightly thicker) would very well solve my problems and be "plausible" 
enough.

Unfortunately, I cannot quite make sense of some of the steps in the 
shader code.

To correctly calculate the position of the corners of the billboard, the 
screen space vector between the start and endpoint is taken as such:

p0 = start * world_view_projection
p1 = end * world_view_projection

//some modifications to p0.y and p1.y according to aspect ratio
...
//Calc vectors between points in screen space <--- Original comment
delta2.xy = p1.xy / p1.z - p0.xy/p0.z;  //<----- I dont quite get why 
the divisor is z and not w (for the homogenization step after the 
projection which is my understanding of screen space)

delta_p.xy = delta2.xy
delta_p.z = p1.z - w1.z;

//Calc UV basis vectors
float len = length(delta2.xy);
float3 U = delta_p / len; //<---- Why would I not use normalize(p1/p1.w 
- p0/p0.w) as a basis for U?

...//offset = (U * factor_u + V * factor_v)


//Undo perspective divide since the hardware will do it // <---- 
Original Comment, though perspective divide to my knowledge is /w not /z
Output.position.xy += offset * Output.position.z; // <---- 
Output.position.z is p0.z or p1.z, I would multiply by Output.position.w 
here

Can somebody shed some light on this? It might be something obvious, I 
just don't see it right now.

Thanks in advance for any pointers,
other solutions for solving the stipple problem are also welcome! (i.e. 
do i need a higher tesselation to avoid rasterizing very long and thin 
triangles?)

Chris

P.S.: I made the two modifications and it still looks "correct" (i.e. I 
can't spot any differences).

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
aliasing_stipple.jpg (image/jpeg, 28.4 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.