My current solution is to use 4 dummy lights to genereate the depth- texture in all directions, then put those textures into a cubic texture, get that textzure to cg and use it to get the shadows mapped.
The problem now is, that i can't get the cubemap over to cg.
I'm now trying to display the cubic shadowmap as a normal texture, so i can see if it was transmitted correctly.
But I have now idea, if it got ttransmitted correctly or how to display as a simople 2dtexture
This is the code i use to get the shadow textures to cg:
C++
Code: Select all
//get active pass
Pass* pass = tech->getPass(0);
//get shadowtexture
TextureUnitState* tus = pass->getTextureUnitState("ShadowMap");
assert(tus);
TexturePtr * stp=new TexturePtr[6];
for(int i=0;i<6;i++){
//lightlist is cleared, only pointlight and 6 dummyspotlights are in there
stp[i]=sm->getShadowTexture((i+1));
}
//map the cubic texture to shadowmap texturepass
tus->setCubicTexture(stp,true);
Code: Select all
arguments:
uniform samplerCUBE ShadowTex : register(s2),
in float4 posi : WPOS
//posi is WPOS
return texCUBE(ShadowTex,float3(posi.x/300.0,posi.y/300.0,posi.z/300.0));
And how can i display it as a 2d texture?