Cg vs. GLSL
We've been receiving some requests of why we go with Cg rather than the 'industry standard' GLSL for our high-level shading language... Here are my thoughts about it:

There really is little difference from the coding perspective. The languages are pretty much the same. The main thing is in distribution & compatibility:

ATI really likes GLSL - The code Cg generates is optimized for NVidia cards, and there is not a lot they can do about it. The could make their own backend, but I think they have better things to do.

GLSL is not available now. It is not available for the Mac 'cept in beta OpenGL drivers. Even when they ship it, I have little hope it will be backported to older OS X versions - Apple doesn't do that. Not sure exactly what the status is for windows - I think it's available, but that doesn't mean we can count on people having it.

For the future, the main thing is not to have to rewrite too many shaders. Let's look ahead into the future when Unity holds complete supremacy:

Macs: In the ideal world, GLSL. It's a bit nicer, its potentially faster on ATI cards. In the real world, we don't want to make Tiger-only games. Does anyone know of a GLSL to ARB_FRAGMENT_PROGRAM converter? That would be nice. Then we could run GLSL if available and fall back to ARB_FRAGMENT otherwise.

Sony is backing Cg for PlayStation3. End of story. Want to do cool shading on PS3? Use Cg.

XBox360: That will be a DirectX port of Unity. That means HLSL (DirectX's high-level shading language). Cg is close to that than GLSL, so again, Cg wins.

Window based machines: Currently we'll use OpenGL, so that'll be the same story as Macs. XBOX360 meand DirectX, so then we get a case much cloase to XBox360. (Cg)

I'm not totally sold on Cg. The language has a number of 'issues', the compiler is buggy, it's not cool. It does however work. And we can make it work across the board.
|