MS-AA and fragment progs that use input depth values

nirradi

Newcomer
Hellos to everyone.

Multisampling anti-aliasing rasterization is known to produce a number of samples within a fragment that differ in sub pixel location, and depth values, but have the same color values since only one fragment is passed on to be shaded in a fragment program for the entire pixel

My Question is ... if there are 4 seperate depth values, then the shader must be wise to this and compute each operation on the depth value 4 times... is this true?

furthermore, if an operation reads from an incoming fragment's depth value, then ambiguity arrises.. from which sub pixel location is the depth value taken for the calculation?

phew. i hope that was clear. anyone please?
 
Your understanging is basically correct, while MSAA rendering, the shader is only ran once per colour sample and a linear combination using the multiple depth fragments computes the final colour result.

The reason no ambiguity arises is that the only place depth compare occur either know about MSAA (the standard depth compare while MSAA rendering is occuring) or if you want to manipulate the surface itself you have to deal with it explicitly. See Dx10.1 over Dx10 for the features that were added so this explicit control of the MSAA depth buffer fragments can occur inside a shader. Without explicit control of MSAA depth fragments (say using depth output in Dx9) MSAA will be effectively disabled and all subfragments will get the same depth value as output by the shader.
 
10x

do you know if GLSL has something that supports these kinds of operations with depth values in MSAA?
 
furthermore, if an operation reads from an incoming fragment's depth value, then ambiguity arrises.. from which sub pixel location is the depth value taken for the calculation?

The input depth in SV_Position.z is not taken from any of the MSAA samples' depths, but at the rasterized point where the fragment in evaluated. This is typically at the pixel center, but could be elsewhere for polygon edge pixels if you use centroid sampling. SV_Position is essentially just an interpolator like any other interpolator. You simply get the value at the sampled location.
 
Back
Top