|
![](/i/fill.gif) |
On 10/06/2016 07:10 PM, Orchid Win7 v1 wrote:
> On 10/06/2016 07:06 PM, Orchid Win7 v1 wrote:
>> (You never know, maybe there's a file named camera.c or something...)
>
> There is, in fact, a camera.cpp file.
Sadly, it contains the data structures for *describing* the camera, but
nothing whatsoever to do with *casting rays*.
It seems *that* is in tracepixel.cpp. Looking into it further, it seems
that TracePixel::CreateCameraRay() has a giant switch-block for every
possible camera type, but they all end with JitterCameraRay(). This,
seemingly, is where the focal blur stuff happens.
In full:
void TracePixel::JitterCameraRay(Ray& ray, DBL x, DBL y, size_t ray_number)
{
DBL xjit, yjit, xlen, ylen, r;
Vector3d temp_xperp, temp_yperp, deflection;
r = camera.Aperture * 0.5;
Jitter2d(x, y, xjit, yjit);
xjit *= focalBlurData->Max_Jitter * 2.0;
yjit *= focalBlurData->Max_Jitter * 2.0;
xlen = r * (focalBlurData->Sample_Grid[ray_number].x() + xjit);
ylen = r * (focalBlurData->Sample_Grid[ray_number].y() + yjit);
// Deflect the position of the eye by the size of the aperture, and in
// a direction perpendicular to the current direction of view.
temp_xperp = focalBlurData->XPerp * xlen;
temp_yperp = focalBlurData->YPerp * ylen;
deflection = temp_xperp - temp_yperp;
ray.Origin += deflection;
// Deflect the direction of the ray in the opposite direction we
deflected
// the eye position. This makes sure that we are looking at the
same place
// when the distance from the eye is equal to "Focal_Distance".
ray.Direction *= focalBlurData->Focal_Distance;
ray.Direction -= deflection;
ray.Direction.normalize();
}
Good luck *ever* figuring out what the hell any of it means, of course...
Post a reply to this message
|
![](/i/fill.gif) |