I use cubemap lighting for objects in a demo i'm working on, and to get round the problem of taking multiple samples from a cubemap, I wrote this function...
vec3 _getPCFCubeMap( samplerCube sampler, vec3 normal, float scale ){ mat3 matrix_rotation; vec3 rotated_normal; vec3 a = vec3(0.0); float pcf_step = (90.0/16.0)*scale; pcf_step+= pcf_step*0.5; // convert to radians scale=pcf_step*0.01745329252f;; float angle[7]; angle[0] = -3.0*scale; angle[1] = -2.0*scale; angle[2] = 1.0*scale; angle[3] = 0.0*scale; angle[4] = 1.0*scale; angle[5] = 2.0*scale; angle[6] = 3.0*scale; for(int j=0;j<3;++j){ for(int i=0;i<7;++i){ if(j==0){ // rotation around z matrix_rotation[0] = vec3(cos(angle),-sin(angle),0); matrix_rotation[1] = vec3(sin(angle),cos(angle),0); matrix_rotation[2] = vec3(0,0,1); vec3 rotated_normal = matrix_rotation*normal; a += textureCube(sampler,rotated_normal).rgb*dot(rotated_normal, normal); } if(j==1){ // rotation around y matrix_rotation[0] = vec3(cos(angle),0,sin(angle)); matrix_rotation[1] = vec3(0,1,0); matrix_rotation[2] = vec3(-sin(angle),0,cos(angle)); vec3 rotated_normal = matrix_rotation*normal; a += textureCube(sampler,rotated_normal).rgb*dot(rotated_normal, normal); } if(j==2){ // rotation around x matrix_rotation[0] = vec3(1,0,0); matrix_rotation[1] = vec3(0,cos(angle),-sin(angle)); matrix_rotation[2] = vec3(0,sin(angle),cos(angle)); vec3 rotated_normal = matrix_rotation*normal; a += textureCube(sampler,rotated_normal).rgb*dot(rotated_normal, normal); } } } a/=21; return a;}
I'm rotating the normal by a given degree when doing the pcf sampling on the cube map. Hope that helps.