shader OslCamera(
    float FocalLength = 1 [[ float min = 0.1, float max = 1000, float sliderexponent = 4]],
    output point pos = 0,
    output vector dir = 0,
    output float tMax = 1.0/0.0)
{
    float pa;
    int res[2];
    getattribute("camera:pixelaspect", pa);
    getattribute("camera:resolution", res);
    float u1 = 2 * (u - .5) * 10;
    float v1 = 2 * (v - .5) * pa * res[1] / res[0];
    pos = P;
    vector right = cross(I, N);
    dir = 2*FocalLength * I + v1 * N + u1 * right;
    dir = transform("camera", "world", dir);
}