[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Centroid sampling makes conformance tests fail?

On Wed, Jun 20, 2012 at 11:03 PM, Nicolas Capens <nicolas@transgaming.com> wrote:
Do you think that to avoid any gotcha's ANGLE should avoid centroid sampling if possible? Or is there any other workaround to ensure that people can safely use anti-aliasing without any unexpected artifacts?
Let me first quickly respond to the idea to do point sprites by not doing point sprites but some form of instancing. Please be aware that people have already using WebGL point sprites compactness (one vertex per sprite) to display hundreds of thousands of realtime updated particles. Changes that severely impair the performance of the method would be undesirable.
Yet there is an issue with point sprites in that their size is often severely limited (especially on D3D and on low-end devices). For this reason many people implement point sprites with two triangles per sprite, it frees them from those size limitations. However it increases the vertex count by 6 (as due to the limitation of short indices into buffers, only drawArrays is a viable choice to draw hundreds of thousands of sprites).
If we could retain the semantic compactness (one vertex per sprite) while getting rid of its size limitations by shunting it to 2 triangles per sprite, and if the performance impact of that would not be too severe, I feel this would be universally welcome by users of webgl.

So regarding the centroid sampling, I don't know how HLSL specifies this exactly, but in GLSL (for desktop OpenGL) there are sampling specifiers to varyings. They usually default to centroid sampling, but can be switched over to nearest and other modes. It is usually preferred to use centroid sampling varyings in order to avoid artifacts, so I'm not sure globally disabling centroid sampling will achieve less artifacts.