AnalyticalGraphicsInc/cesium — pull request #714 by kring (2013-04-29 22:08:14+00:00)
Title: Reproject imagery in the vertex shader instead of FS.

Fragment shaders on mobile devices have lousy precision, so we get serious texture smearing artifacts at medium zoom levels when using web Mercator imagery. I thought for the longest time that I would just have to do CPU reprojection on these devices, but today I realized I was missing an easy and obvious solution: do the reprojection by generating appropriate texture coordinates in the vertex shader instead of doing precision-requiring math in the fragment shader.

The performance should be nearly identical on non-mobile devices, assuming roughly equal performance of equivalent vertex and fragment programs. The only additional cost is that a larger (256x256 versus 2x2) vertex array is required, but we only need one such array for the entire app.

Eagle-eye @shunter should look at this to make sure there isn't a visual quality regression, but I'm pretty sure there's not. There probably would be a (slight) regression for larger textures, like 512x512, we don't really have any cases of that.