Here's the shader code necessary to do lights with cube map projections and 3D (spherical) attenuation. Keep in mind that all projection textures must be cube maps, no 2D projection textures can be used, not even for projected lights. To use projected lights, use a cube map where +/-X, +/-Y, and +Z faces are completely black. -Z will be the projection face. Falloff textures are not used so they don't need to be defined in the light's material. And just use "cubeMap" instead of "map" in the light's material.
Let me know if you have any question.
Code:
# note: lightFallTC = fragment.texcoord[2]
# lightProjTC = fragment.texcoord[3]
# calculate point light tc
MOV R1, lightProjTC;
MOV R1.z, lightFallTC.x;
MAD R1.xyz, R1, 2.0, -1.0;
# calculate projected light tc
MOV R2, lightProjTC;
MOV R2.z, -1.0;
RCP R2.w, lightProjTC.w;
MUL R2.xy, R2, R2.w;
MAD R2.xy, R2, 2.0, -1.0;
# sample projection cube map
TEX lightCube, R1, texture[3], CUBE;
TEX lightProj, R2, texture[3], CUBE;
# calculate attenuation (x = point, y = projected)
DP3 R1.x, R1, R1;
POW R1.x, R1.x, 0.5.x;
MOV R1.y, lightFallTC.x;
ADD_SAT R1.xy, 1.0, -R1;
MUL R1.xy, R1, R1;
MUL lightCube, lightCube, R1.x;
MUL lightProj, lightProj, R1.y;
# if w > 1.0, light = projected, else light = point
SLT R1.x, 1.0, lightProjTC.w;
CMP atten, -R1.x, lightProj, lightCube;
*Edit: Uploaded a test map showcasing cube map projection and ambient cube lighting. It's recommended to load it in the editor.
http://sikkpin.fileave.com/ambientcube_test.rar