View Full Version : CSS texture artifacts: I have a theory

10-19-04, 03:23 PM
I just remembered Valves statements about centroid sampling and Source.

When using hardware not capable of centroid sampling (or the shaders used to "emulate" centroid sampling) pretty severe texture artifacts would be seen along texturecracks and polygon borders in certain cases.

Now since the 66.xx drivers we've had just those type of artifacts in CSS.

So today I remembered what Valve said and I disabled FSAA and presto: no more artifacts.

So perhaps centroid sampling ('cause I assume nVidia doesn't need the shader on the GF6 now that they support "real" centroid sampling) is somehow borkjed in the current drivers.

Oh well, perhaps all this is very self-explanatory. :retard:

10-19-04, 03:34 PM
I have no idea what "centroid sampling" is but it sounds good ;)

10-19-04, 04:06 PM
I have no idea what "centroid sampling" is but it sounds good ;)

Not that it actually explains what centroid sampling is (I'm too tired to do it myself) but it does give some insight with regards to the issue:

Dio @ B3D has a nice explanation:
"Centroid sampling takes the sample from the average position of the samples covered for a particular pixel, rather than the average of all samples. This guarantees that the position at which the sample occurs is inside the polygon. The result is the same as centre sampling for pixels that have all samples covered.

If the polygon is at a sharp angle to the camera and non-centroid sampling is in use, the interpolator can generate a value way outside the polygon, and sampling the texture coordinate at this point will read from an area not covered by the polygon. With paged textures, this error can be very visible. However, centroid sampling causes minor edge artifacts in certain circumstances, so it is preferred only to enable centroid sampling on textures that would see (the much worse) artifacts without it."

In short:
If a texture has, say, two different color patterns in it and your FSAA is about to take a sample of something along an surface edge that has a texture applied to it with only one of the two color patterns you want to make sure you sample the correct color (ie only one of the two). Centroid sampling does that for you (ie makes sure you sample the correct part of the texture)
I'm not sure that makes any sense, I tried to (pardon) dumb it down as much as I could. :)

Gaah I had a very good picture to illustrate the problem in the folder from the 6800 launch but I just threw that in the bin a few days ago and for once I was a good boy and emptied out my trash. ;)