float L=0.1; float4 T=0; float3 NewPos; for(int i=0;i<10;i++){ NewPos=RealPos+R*L; // RealPos - current position, R- reflection T=mul(float4(NewPos,1),mat_ViewProj); // Projecting new position to screen. T.xy=0.5+0.5*float2(1,-1)*T.xy/T.w; NewPos=GetWorldPos( GBufferPositions.Load(uint2(gbufferDim.xy* T),0),T.xy,mat_ViewProjI); // Find world position L=length(RealPos-NewPos); // new distance } T.xy - texturecoord of reflected pixel