   Getting World Space From View Space
  i'v been reading MJP reconstructing depth, and because i can't sample multisaple depth(dx10 :D) i decided to try implementedand it does't work :D, well at least for shadows[they eat that position, but it still seems wrong]i'm using Linear View Space depthhere's the image http://img697.imageshack.us/img697/3699/csmr.jpgRenderOutput.wPosition = mul(input.Pos,mNewWorld );//first by worldOutput.vPosition = mul(Output.wPosition, g_mViewProj);//then by viewprojOutput.vTexcoord = input.Tex; float4 WorldVS=mul(Output.wPosition, g_mView);Output.Depth=WorldVS.z; //ViewDepth.z;//for generating depthoutput in MRT in pixel shader[R32_FLOAT]screen.Depth.x =Input.Depth.x/MaxDepth; where MaxDepth is far clip from my camerai'm drawing fullscreen triangle and try my best to reconstruct itVS for quad renderingfloat FSQ_GetFrustumRayIndex(in float2 texCoord){return texCoord.x + (texCoord.y * 2);}PS_QUAD VS_QUAD(float4 iPos: POSITION){PS_QUAD OUT;OUT.Pos = float4(iPos.x, iPos.y, 0.5f, 1.0f);OUT.Tex.xy = iPos.zw;float RayIndex=FSQ_GetFrustumRayIndex(-OUT.Tex.xy);OUT.FrustumRay = FrustumCorners[ RayIndex ].xyz;};then in pixel shader for quad renderingm_mShadow is Shadow ViewProj matrixDepthMapSampler is the texture from Render shaderfloat depth=DepthMapSampler.Sample( g_samLinear, IN.Tex.xy).r;float4 PosVS=float4(IN.FrustumRay*depth,1);float4 PosWS=mul(PosVS,InvView);PosWS.w = 1.0 / PosWS.w;PosWS.xyz *= PosWS.w;float4 vTexShadow=mul(PosWS,m_mShadow);this method works somehowi'v checked it by muling to InverseView, then By View Again, Then Dividing by FarClipbut something is wrong either in PosVS or vTexShadow  because shadows(CSM) seems to dislike it very much, and projected in the wrong place(i'm happy they projecting!!!!!)my question is(aside from using hardware buffers or z/w) on what should i divide to obtain correct World Space Position?p.s. i'v integrated cascaded shadow maps, and wanted to try doing them in deffered but failedp.s.s. sorry for my englishUploaded with ImageShack.us[Edited by - e3d_ALiVE on May 19, 2010 1:49:41 PM]