   Cubemap Shadowmapping
  Hi,So, I'm trying to make a cubic shadowmapping implementation.  The shadowtest always returns in-shadow.  I found this nice article: here, which provides some shader code.  I have rendered it thusly, in GLSL (I've removed the lighting computations, focusing only on the simple test)://cubetex contains the cubemap//center is the location of the light//vVertex is vec4(gl_ModelViewMatrix*gl_Vertex).xyz passed from the vertex shader//the result of this test is multiplied by the standard color of the scenefloat cubemap_depthtest(samplerCube cubetex, vec3 center) {    vec3 lightdir = center - vVertex.xyz;    float distance = length(lightdir);    float shaddepth = textureCube(cubetex,normalize(-lightdir)).r;    if (distance>shaddepth) { return 0.1; }    else{ return 1.0; }}I'm probably missing something important.The result of the code is this.  The contents of the cubemap are shown, (after much deliberation in my previous thread).  Note that the spaceship squadron is not rendered with the shadows:Help?  Thanks,-G   
  Seems that I need to transform the exponential space of the depth in the shadowmap into a linear space, and then it will work!  (I've got it partially working, but incorrectly, due to the transform).  Given the near and far values, how should I do that?   ;  In this image, showing the test without the necessary depth transform, you can see that the shadowing is sorta working:Unfortunately, there are problems with the shadows that are self-evident.  For instance, the "spot" effects on the walls are errors.  Notice that the line connecting the light, a point on a spaceship, and the corresponding point in its shadow is not linear.  Obviously, the depth buffer stored in the shadowmap needs proper transforming.  Right now, the GLSL code is://doesn't work right!float depth_from_depthbuffer(float depth,float near,float far) { return ((-(far*near)/((depth*(far-near))-far))-near)/(far-near); }//used for screenshotfloat cubemap_depthtest(samplerCube cubetex, vec3 center, float near, float far) {    vec3 lightdir = vec4(transform_matrix*vertex).xyz - center;    float distance = length(lightdir);   float shaddepth = textureCube(cubetex,normalize(lightdir)).r;    //shaddepth = depth_from_depthbuffer(shaddepth,near,far);    shaddepth = shaddepth*(far-near) + near; //doesn't take into account non-linearity   if (distance>shaddepth) { return 0.1; }    else{ return 1.0; }}