05-08-2013 04:45 PM
void main()
{
vec2 uv = texCoords.xy;
vec2 theta = (uv - LensCenter.xy) * ScaleIn.xy;
float rSq = theta.x * theta.x + theta.y * theta.y;
vec2 rvector = theta * (HmdWarpParam.x + HmdWarpParam.y * rSq +
HmdWarpParam.z * rSq * rSq + HmdWarpParam.w * rSq * rSq * rSq);
// Note: In the unmodified shader this is LensCenter.xy + Scale.xy * rvector
// Since we do not shift the projection center in the projection matrix, we use the
// screen center instead
vec2 tc = (ScreenCenter.xy + Scale.xy * rvector);
//*** Adjust 0.5,0.5 according to how you render
if (any(bvec2(clamp(tc, ScreenCenter.xy-vec2(0.50,0.5), ScreenCenter.xy+vec2(0.50,0.5))-tc)))
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
else
gl_FragColor = texture2D(albedoMap, tc);
}
05-08-2013 05:42 PM
05-09-2013 10:43 AM
05-09-2013 01:38 PM
"xix" wrote:
... In fact I'm taking the script kiddie approach of just tweak numbers and shit and then see what works 🙂 I'm not sure that coming at this from the "just copy reality" direction is the right way. ... Personally I'm not sure the warping is actually all that important, the stuff ahead is mostly flat and the bits to the side that the warping fixes are less about detail and more about movement. So the distortion probably doesn't have to be that perfect and in fact blurring stuff at the edges rather than distorting may even be a better idea...
05-09-2013 09:52 PM
06-04-2013 11:15 PM
06-04-2013 11:42 PM