License schmeisence, it's game content, it wasn't part of the GPL source distribution, so it still falls under the same terms as the rest of the game content. We've honestly been over this discussion so many times both here and elsewhere that it's ancient news by now and all the old-timers are worn out by it. We were talking about it back in 2002 and it'll still be coming up in 2022. The general consensus is that unless it's explicitly GPL then it's not, and that's not going to change. Nobody wants to be a legal test case.

So - here's the reconstructed fragment shader. The only thing that needs to change is the main function.
- Code:
void main ()
{
vec4 lightProject = texture2DProj (lightImage, projCoords);
vec4 lightFalloff = texture2D (lightFalloffImage, fallCoords);
vec3 bumpMap = texture2D (bumpImage, bumpCoords).agb * 2.0 - 1.0;
vec4 incomingLight = lightProject * lightFalloff;
incomingLight *= max (dot (normalize (lightDir), bumpMap), 0.0);
vec4 diffMap = texture2D (diffuseImage, diffCoords);
vec4 specMap = texture2D (specularImage, specCoords);
float specularPower = clamp ((max (dot (normalize (halfAngle), bumpMap), 0.0) - 0.75) * 4.0, 0.0, 1.0);
specularPower *= specularPower;
vec4 finalSpec = specularPower * specMap * 2.0 * u_constant_specular;
vec4 finalDiff = diffMap * u_constant_diffuse;
gl_FragColor = (finalDiff + finalSpec) * incomingLight * Color;
}
This is 95% taken from the R200 backend, which - as the shader is entirely specified in engine code - falls under the GPL. Therefore so does this.
The only differences of note (the other 5%) are:
- normalization with math rather than the cubemap in two places.
- max (dot (x, y), 0) instead of just dot (x, y) in two places - which is more correct by the classic lighting equations (but has no visible difference in-game so far as I can see, it just seemed right to do).
What's interesting about this one is that it does a standard texture2D on the falloff texture, whereas the ARB-derived version uses texture2DProj (the original ARB shader used TXP, the original R200 backend uses a standard unprojected texture lookup via glSampleMapATI) - no visible difference.
While I could get fancy and add oodles of extra quality here (correcting that specular power would be an obvious place to start), that's not the objective. The objective is to provide GPL shaders that are as equivalent as possible to the ARB shaders.
With the GLSL backend I gave above you can use r_useGLSL 0 or r_useGLSL 1 to switch between GLSL and ARB programs at runtime, which is handy for verifying that the results you're getting are consistent.