[ Ray Tracing ] Cam distance doesnt seem to affect traced scene as I`d expect
Members - Reputation: 979
Posted 30 August 2012 - 08:24 AM
Heres after putting the spheres 10 farther away ( z + 10 ):
And here is, after resetting spheres Z (as in the first pic), and putting the cam 10 farther from the shapes (cam z - 10):
While writing this post I had a guess, thing is what affect real cam distance is not the cam, but the world window..
Im generating rays from a giving cam position, to a world window that always lays on z = 0, so in reality, I should be moving this frustum(is it really a frustum?) thing alltogether, not just the cam pos... Is that right?
Members - Reputation: 489
Posted 30 August 2012 - 12:59 PM
What you need to do is move the focal point AND the plane together. This will move the camera, and keep the focal length of the camera the same. Moving forward and back will be the easiest case, just add/subtract from z. But you when rotate the camera, you will need to rotate the image plane with it, and then you will need to break out the matrix math.
Alternatively, you can keep the camera position & 'world window' stationary, and just use a matrix to translate and rotate the world around the camera. Similar to how OpenGL has a 'stationary' camera looking down -z, and you rotate the world around it. It's probably the easiest to deal with. There's bazillions of optimized matrix library classes out there that you can use for this.
Crossbones+ - Reputation: 8135
Posted 30 August 2012 - 07:49 PM
So yeah, the focal plane should be moving along with the camera, otherwise it doesn't make much sense. Think of the focal plane as "window into the world", you want it to always be in front of your eyes, otherwise if you walk away from it you'll be seeing less and less of the world (as you noticed in your experiments as the result seems to "zoom in"), just as you'll see less of the outside world if you walk away from your window.
The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.
- Pessimal Algorithms and Simplexity Analysis