So with the above you could potentially reverse it - get the offset you want, add to s,t, then re-generate a vector?

That sort of defeats the purpose of using cubemaps over a flat texture in the first place.

It sounds like a simple problem at first. “Oh, I’ll just offset the vector a little bit.” But then you start thinking more specifically about it and it gets weird. Right now I am thinking I will offset the vector by a 3D coordinate based somehow on the vector…like (1-x,1-y,1-z) or something.

Well, I took the easy way out and just did this, and it looks fine:

```
vec4 cubecoord = vec4( lightdir, max(max(abs(lightdir.x),abs(lightdir.y)),abs(lightdir.z)) );
float zFar = gl_LightSource[0].linearAttenuation;
float zNear = 0.1;
float a = zFar / ( zFar - zNear );
float b = zFar * zNear / ( zNear - zFar );
cubecoord.w = a + b / cubecoord.w;
#if LW_SHADOWQUALITY==3
shadowcolor = shadowCube( texture3, cubecoord ).x;
#endif
#if LW_SHADOWQUALITY==2
float ps = 8.0 / gl_LightSource[0].quadraticAttenuation;
shadowcolor = shadowCube( texture3, cubecoord ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(ps,ps,ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(-ps,ps,-ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(-ps,-ps,-ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(ps,-ps,ps),cubecoord.w) ).x;
shadowcolor /= 5.0;
#endif
#if LW_SHADOWQUALITY==1
float ps = 8.0 / gl_LightSource[0].quadraticAttenuation;
shadowcolor = shadowCube( texture3, cubecoord ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(ps,ps,ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(-ps,ps,ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(ps,-ps,ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(ps,ps,-ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(-ps,-ps,ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(ps,-ps,-ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(-ps,ps,-ps),cubecoord.w) ).x;
shadowcolor += shadowCube( texture3, vec4(cubecoord.xyz + vec3(-ps,-ps,-ps),cubecoord.w) ).x;
shadowcolor /= 9.0;
#endif
```