Parallax and Perspective
Really there is a lot going on, and the 3-D effects are calculated or filmed with certain factors in mind. Most of this is based on the viewer being a set distance from the screen and assuming that the viewer has 20/20 vision.
It's a matter of the two eyes seeing slightly different images and making a composite of the two. Your brain is making the calculations to combine the visions.
When a computer tries to model this, the calculations are usually done on the flat. I would think it would be a matter of changing the calculations to match to the curved viewing surface if you were going to go that route.
I agree that the lack of peripheral vision does have to come into play for any true 3-d surround kind of effect. I think that I see your point and the viewing surface would need to be curved in order to facilitate true surround 3-d. I fear that this would mean that each viewer/user would have to have their own surround 3-d monitor (for lack of a better word) in order to see the 3-d surround world as intended; as any viewer that was not in the exact point of optimal viewing would have a distortion of the optical effect.
So for larger audiences, having a bigger screen that is father away would increase the number of people that would be closer to the optimal viewing point. Also, decreasing the curve of the screen would also increase the number of people that are able to view the effect with less distortion. If the screen is curved then you are not only talking about a distance from the screen center, but now all the effects must be calculated from the curvature which means that the distance that you move a way left/right - up/down which already effects the center point would amplify as you are moving further toward one side (curve) of the screen toward another side (curve) of the screen. The calculations for the effect being based on the optimal viewing point are are not able to compensate for the viewer that is not at the optimal viewing point.
I think that the peripheral vision side-to-side is more important and probably able to implement in general; however, I see your point of having the scope of vision also extending upwards and downwards.
The question that I really see is how much do you want to extend the field past 180 degrees, because people will turn/tilt their heads.
But back to your question, I really don't know the particulars of that, but I think that I may have addressed some of it in what I had to say. maybe...
Another thing you have to be aware of, is that it's more important to "look" right in simulation rather than "be" right.
Our brains adjust for an awful lot of stuff to make everything look right. They won't do the same for a simulated image (since in reality it is flat and only a few feet away). Thus, it needs to be faked to look like how we think it should look.
Dunno if that's what you're driving at or not.
It's a matter of the two eyes seeing slightly different images and making a composite of the two. Your brain is making the calculations to combine the visions.
|
Realistically speaking, the only way to achieve true depth perception is to make it so that each eye sees the same scene from a slightly different angle, allowing the brain to calculate parallax and assume distance. Again, 3D glasses are one way, but a very BAD one. I believe the Virtual Boy tried something like this, but its abysmal commercial history would not suggest great success. Pretty much short of true 3D holographic projection or Matrix-style direct brain feed (neither of which seems to be anywhere near existence), we'll have to do with a 3D projected image onto a 2D screen. Mind you, a "2D screen" doesn't have to mean flat. Radial coordinates are easily capable of producing surfaces that are described in 2D, but are shaped as spheres in 3D space.
I agree that the lack of peripheral vision does have to come into play for any true 3-d surround kind of effect. I think that I see your point and the viewing surface would need to be curved in order to facilitate true surround 3-d. I fear that this would mean that each viewer/user would have to have their own surround 3-d monitor (for lack of a better word) in order to see the 3-d surround world as intended; as any viewer that was not in the exact point of optimal viewing would have a distortion of the optical effect.[/quote]
I have, actually, heard of people attempting to simulate immersive 3D by actually sticking the viewer in the centre of hemispherical screen and projecting a panoramic view on the whole thing. Point of fact, the boys at Prototype This used that in their "virtual diving" prototype. However, this comes with several... Problems. For one, when we look, our "centre of vision" is wherever our eyes point, whereas when we look at a screen, that centre is the centre of a screen. That's why we don't see severe 3D distortion in real life - our clear vision is in the centre of the eye and the sides where distortion takes effect aren't as sensitive.
However, when a screen goes much beyond 45 degrees off centre, the distortion begins to get REALLY nasty. In fact, old players of Quake 2 and Quake 3 might have seen the so-called "fish eye effect," where you push your FOV (Field Of View, I believe) much past 90. The area of clear, undistorted view becomes small and smushed in the centre, with large, distorted, stretched images filling much of the rest of the screen. It makes it pretty hard to actually SEE anything in detail, but it gives you great peripheral vision, helping the spastic twitch players react better or something. I tend to turn back after the "hard to see in" part.
The question that I really see is how much do you want to extend the field past 180 degrees, because people will turn/tilt their heads. |
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
Another thing you have to be aware of, is that it's more important to "look" right in simulation rather than "be" right.
Our brains adjust for an awful lot of stuff to make everything look right. They won't do the same for a simulated image (since in reality it is flat and only a few feet away). Thus, it needs to be faked to look like how we think it should look. Dunno if that's what you're driving at or not. |
Practically speaking, in a perspective, EVERY set of parallel lines appear to converge into infinity on both ends of the lines. The trick is that, for any lines NOT parallel to the plane of the viewer (e.i. the plane between the horizon and the vertical), one convergence spot is in front of the viewer and the other behind. Since the game only ever renders the front of the viewer, it doesn't need to worry about where lines would intersect in the back, so it draws them straight and converging in the one point you CAN see. Lines parallel to the plane of the viewer do converge in two spots which should be at the edge of the visible angle, but since most games don't render anything even close to panoramic view, you never get to see those points of convergence, so these lines are drawn straight, not worrying about them ever converging anywhere.
This could also be a convention because of how minuscule the curve produced by this would be. Without going into too much mathematics, with a view angle of 90 degrees (or 45 degres off centre), you see 1/8 of what you'd see with a 180 degree field of view. As well, the fact that distortions increase as you go off-centre means that the distortions in the small field you actually get to see are fairly benign. Benign enough to just ignore, as that means you just calculate the relative displacement of points and then draw straight lines between them, whereas otherwise you'd have to draw entire curves, point by point, which I assume would be vastly more costly in terms of resources.
I'd actually sit down and write this up, but I'm sure other, smarter people have written it up before me better than I ever could with my knowledge and capability.
But that still doesn't answer the primary question, though - is this convention done because that's how our eyes see (e.i. we don't see this displacement) or is it done because it's easier to render?
*edit*
I should revise my last calculation. A 90 degree field of view does indeed come up to half of a 180 degree arc, but I should not that not all games use a FOV of 90. Still, a lot of games do use lower values (the 90 I got was from Quake 3 Arena), and even then, that's still a small part of the total screen area.
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
But that still doesn't answer the primary question, though - is this convention done because that's how our eyes see (e.i. we don't see this displacement) or is it done because it's easier to render?
|
That photo is taken with a fisheye lens. Our brains then convert that image into the "flattened" version. If the images we were to get on a computer screen were "fisheyed", it would look something like that photo, which is to say, wrong.
Think of it like this: Our brains are equipped with the mechanisms to adjust any visual distortions due to perspective or parallax. If you distort the image in the computer screen, it's the equivalent to making a "fisheyed" world, where parallel lines arc strangely. We as gamers might be able to adapt to it eventually, but it won't look like the real world. From a practical viewpoint, what you're proposing is the equivalent of making a bowed and bulging fence so that it looks straight to the eye. The only difference is that with your proposed system, the bulge would move with your viewpoint.
My story arcs: #2370- Noah Reborn, #18672- The Clockwork War, #31490- Easy Money
Sartre once said, "Hell is other people." What does that make an MMO?
For the sake of keeping the thread informed, allow me to explain what light is according to human perception...
There is a type of subatomic particle called a photon, which accounts for all radio signals, lights, your microwave oven, and all other types of electromagnetic radiation. For all intents and purposes, photons move through physical space in spirals with varying amplitudes and periods away from their source--producing an overall "ray" trajectory. Imagine an elongated spring... that's the path traveled by a photon.
Photons with a certain range of periods (frequencies) can be perceived by our eyes. Such frequencies are referred to as "visible light." There are cells on the backs of our eyes on the inside that are responsible for the perception of light. These cells compose what is called the retina, and they are stimulated directly by photons. The amplitude of a photon (the radius of the spiral) is responsible for the brightness of the light, and the period (frequency) is responsible for its color. The retinal cells are configured to respond to both properties, and are so much larger than photons that it takes maybe 100 photons to adequately stimulate any single retinal cell.
When retinal cells are stimulated by photons, they send nervous signals to the brain indicating that light has been perceived.
What's more, 3D games tend to display a field of view that basically has no peripheral vision. If I'm not mistaken, in games we see about a 90 degree arc, whereas in real life we can see almost a full 180.
|
In real life, the field of view angle is greater because our retinas are curved, rather than flat like a computer screen. Rays of light entering our eyes at an extreme angle can still be percieved; while on a computer, such rays would miss the viewport rectangle altogether by shooting off to the sides. This is not a matter of perspective calculation. The math is correct on the computer screen as it is modeled after the real-life math that stimulates our eyes. The difference is that the computer's "retina" is a rectangle, where our eyes' retinas are, for all intents and purposes, hemispheres.
Incidentally, increasing the FOV mathematically will result in the center of the image being "pinched in," while the periphery becomes more stretched out. This can be disorienting, and is occasionally used for artistic flare. Decreasing the FOV results in a binocular-like zoom in, which is far superior to the typical method of actually moving the viewpoint closer to the object you want to zoom in on.
So here is my question: I know that a line above the horizon in space, when viewed through a sphere and translated onto a flat surface, translates into an upward arc. Does it do the same in the human eyes? If it does, then I challenge the validity of 3D graphics. If it doesn't... Then I'm not really sure.
|
The same is done on a computer screen, since the same math is applicable in both situations. Our eyes and our computers do not operate any differently in that regard.
Practically speaking, in a perspective, EVERY set of parallel lines appear to converge into infinity on both ends of the lines. The trick is that, for any lines NOT parallel to the plane of the viewer (e.i. the plane between the horizon and the vertical), one convergence spot is in front of the viewer and the other behind. Since the game only ever renders the front of the viewer, it doesn't need to worry about where lines would intersect in the back, so it draws them straight and converging in the one point you CAN see. Lines parallel to the plane of the viewer do converge in two spots which should be at the edge of the visible angle, but since most games don't render anything even close to panoramic view, you never get to see those points of convergence, so these lines are drawn straight, not worrying about them ever converging anywhere.
|
The point here is that a single, fully-encompassing image is produced that accurately reflects proper perspective regardless of the angle you look at it with. This boggled my mind initially, since I saw no way that parts of the image way up in the cube's corner would not be distorted when you looked directly at it, but it's true: there is no distoriton, and this is because of the way perspective (and line convergence) works. The only other geometric shape that produces the same result (and, indeed, identical pixels after rendering) is a sphere.
In any case, if you look at the six 2D images of a sky box texture, you'll find that no straight lines become curved.
Keep in mind that 3D graphics are designed to mimic what we see in the real world, not how images are projected onto the backs of our eyes.
If you're really motivated enough to try an experiment, do this. Get a large, clear, hard surface that you can set up in front of you somewhere where there are lines parallel and perpindicular to a direction you're looking in. Get a dry-erase marker, close one eye (since most monitors aren't 3D yet), and look straight ahead. With the marker, use your peripheral vision to trace lines over the parallel and perpindicular lines you see past the window in front of you. When you're done, open both eyes, step back, and look to see how straight those lines are.
If the perpindicular lines are straight, then 3D graphics has it right, they should be straight on the screen because that's how you see things in reality.
We've been saving Paragon City for eight and a half years. It's time to do it one more time.
(If you love this game as much as I do, please read that post.)
I'd really like an FOV slider for CoH.
Think of it like this: Our brains are equipped with the mechanisms to adjust any visual distortions due to perspective or parallax. If you distort the image in the computer screen, it's the equivalent to making a "fisheyed" world, where parallel lines arc strangely. We as gamers might be able to adapt to it eventually, but it won't look like the real world. From a practical viewpoint, what you're proposing is the equivalent of making a bowed and bulging fence so that it looks straight to the eye. The only difference is that with your proposed system, the bulge would move with your viewpoint.
|
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
In real life, the field of view angle is greater because our retinas are curved, rather than flat like a computer screen. Rays of light entering our eyes at an extreme angle can still be percieved; while on a computer, such rays would miss the viewport rectangle altogether by shooting off to the sides. This is not a matter of perspective calculation. The math is correct on the computer screen as it is modeled after the real-life math that stimulates our eyes. The difference is that the computer's "retina" is a rectangle, where our eyes' retinas are, for all intents and purposes, hemispheres.
|
It further opens the question of variables. Other than field of view angel (or angles - horizontal and vertical), you'd also need to account for the distance between the central point and the flat. Practically speaking, this distance may or may not be irrelevant, as a central raytrace onto a perpendicular plane should scale without distortion, but placing the flat too far from the centre runs the risk of placing it in front of geometry you really ought to be able to see. Which, by the way, explains why it's possible to shove your face through objects in some less refined FPS games. Hmm...
Since photons effectively travel as rays away from the source of light, there will only ever be an X and Y coordinate when they collide with the retina. "Light has landed here, and it is this color." In this context, our retinas are 2-dimensional and euclidian math needs not apply. Any straight-line objects will project straight-line light, which are in turn percieved as straight lines by our retinas. The same is done on a computer screen, since the same math is applicable in both situations. Our eyes and our computers do not operate any differently in that regard. |
Furthermore, I cannot accept the proposition that a straight line traced onto a sphere's surface translates into a straight line. There can be no straight lines on the surface of a sphere, because the entirety of a sphere's surface is curved, so by the very definition of the shape, all you have is curves. Granted, in radial coordinates, those CAN be formulated as straight lines, but even if you traced multiple straight lines onto a sphere, even centrally through its core, they would still look like curves from the outside, and the only time they would ever look like straight lines would be if you looked from the very centre of the sphere outwards. However, as we've already discounted wraparound bubble screens as awesome but impractical, we're back to the stand-by of linearly tracing what's on a sphere onto a flat surface, such as that of a computer screen.
As anyone who's done any work whatsoever with maps knows, stretching the map of the spherical globe over a flat square sheet causes significant distortion. In the case of maps, the stretching is axial, stretching the points at the poles into rings the size of the equator and essentially stretching the globular map into a cylindrical map, which then incised and slplit. European maps tend to split mid-Pacific, with the Americas on the left, Europe and Africa in the middle and Asia on the right, and American maps I've seen tend to put the US in the middle and the rest of the world off to the right.
Point is, as humans, we see light in the form of beams traced through the centre of our eyeballs and imprinted upside down and back-to-front on the back of the eyeball. Anything you trace onto a sphere can no longer be called "straight," as such straight lines transcribe into curves. Transcribing that to a flat sheet linearly retains those curves and draws them as arcs on the flat. This is demonstrabe, and it is mathematically provable.
But that's not the real problem. The real problem is that we don't sit inside our own eyes, looking at the projections on the back. We take the signals as they land, and how we interpret them is, thereafter, not a subject of mathematics, but much more so of neurology. The actual question is - do WE see lines as actual lines, with our brains taking the kinks out of the curves as they land in post, or do we actually see them curved, but can't notice it because the curves are too far in our imprecise peripheral vision?
At this point, I'm willing to concede it's probably the former, which is why central rendering onto a flat surface may be a more realistic representation of WHAT we see, even if it's not in the slightest similar to HOW we see (because those lines that ought to converge on the other side simply won't, even if they should). As such, and as with any simulation, it's not a question of simulating mechanics, but rather emulating an experience. An acceptable break from reality, perhaps?
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
Incidentally, increasing the FOV mathematically will result in the center of the image being "pinched in," while the periphery becomes more stretched out. This can be disorienting, and is occasionally used for artistic flare. Decreasing the FOV results in a binocular-like zoom in, which is far superior to the typical method of actually moving the viewpoint closer to the object you want to zoom in on.
|
There is a rendering technique called a sky box which renders a full 360-degree scene around the camera (point of view)...
The only other geometric shape that produces the same result (and, indeed, identical pixels after rendering) is a sphere. |
OK, then I'm missing something crucial about how these things are raytraced onto the screen.
|
I always assumed it was traced, at least mathematically, onto a sphere which was then plotted onto a flat.
|
Given E, a position in R3 for the eye, Q, a position in R3 in the plane of projection, n the normal to the plane of projection, and origin O:
eqn := (E - Q) · n qn := (Q - O) · n en := (E - O) · n ( eqn - E.x n.x -E.y n.x -E.z n.x -E.x ) Persp(E, Q, n) := ( -E.x n.y eqn - E.y n.y -E.z n.y -E.y ) ( -E.x n.z -E.y n.z eqn - E.z n.z -E.z ) ( qn E.x qn E.y qn E.z en )
placing the flat too far from the centre runs the risk of placing it in front of geometry you really ought to be able to see. Which, by the way, explains why it's possible to shove your face through objects in some less refined FPS games. Hmm...
|
As anyone who's done any work whatsoever with maps knows, stretching the map of the spherical globe over a flat square sheet causes significant distortion. In the case of maps, the stretching is axial, stretching the points at the poles into rings the size of the equator and essentially stretching the globular map into a cylindrical map, which then incised and slplit.
|
http://www.fimfiction.net/story/36641/My-Little-Exalt
The reason you usually don't see vertical or horizontal lines converging to infinity is because of how perspective is calculated. The size of an object being displayed in a game is (usually, there are always exceptions) inversely proportional to its distance from a viewer. Since a horizontal object has little change in distance when you're far away from it to begin with, you might not be able to tell. You'd need to be at the base of something really big and look up to get appreciable results.
And in 3D applications, both skyboxes and skyspheres are used frequently. Both boxes and spheres can produce anomalies at the geometric boundaries if the texture isn't appropriate. For a skybox, the edges and corners of the box need to be continuous in order to avoid discontinuities. For a skysphere, the poles need to be continuous. Of course, the box is also simpler geometry. And many games are constructed such that you would never see the poles of the sphere.
|
For one thing, true raytracing never happens in a realtime application such as a game, because raytracing is sloooooow. |
No. Perspective projection maps points in R3 to points in R2, directly. There's no sphere involved. With the exception of peripheral vision, this is realistic. (Or, rather, produces realistic results) Given E, a position in R3 for the eye, Q, a position in R3 in the plane of projection, n the normal to the plane of projection, and origin O: Code:
eqn := (E - Q) · n qn := (Q - O) · n en := (E - O) · n ( eqn - E.x n.x -E.y n.x -E.z n.x -E.x ) Persp(E, Q, n) := ( -E.x n.y eqn - E.y n.y -E.z n.y -E.y ) ( -E.x n.z -E.y n.z eqn - E.z n.z -E.z ) ( qn E.x qn E.y qn E.z en ) |
It's probably my lack of understanding of your notation, combined with a language barrier as I am, admittedly, less familiar with mathematical terms in English than I ought to be, that causes me to fail to read your equation. I'm assuming you're talking about either a basis/origin shift of the the entire 3D space, or some kind of relative coordinate system, for which there was a theorem I never managed to quite fully remember, that's basically a linear shift followed by I believe three specific rotations. I'm assuming that's where the Normal comes into play, to align the "third" axis against, but I'm completely unable to follow the calculation itself.
On a side note, I only mention tracing to a sphere and then to a flat as a convenience of explanation. I can give you a completely algebraic function to translate between the coordinates of a point in 3D space and the image of this point exactly as I have described, though the calculation I have might not be very friendly to real-time computation. However, doing this would require a LOT of work on my part to put it in a presentable fashion and write up enough description, to where I'd rather not do it unless someone really cares to know. Hence why I say I use the term "raytracing" only loosely, as it comes down to a singular, rather unsightly function of three variables. Simple, but unsightly.
It depends on the map projection type. A Mercator projection map preserves angles and the shapes of small objects, but introduces distortions in area. Because Mercator is a conformal transformation, it became the standard for naval navigation, but was never meant to be "the" world map. A Hobo-Dyer projection maintains correct relative area, but distorts shape. A Fuller Dymaxion projection maintains size and shape relations, but direction and distance becomes confused. |
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
The reason you usually don't see vertical or horizontal lines converging to infinity is because of how perspective is calculated. The size of an object being displayed in a game is (usually, there are always exceptions) inversely proportional to its distance from a viewer. Since a horizontal object has little change in distance when you're far away from it to begin with, you might not be able to tell. You'd need to be at the base of something really big and look up to get appreciable results.
|
As far as I'm concerned, Basilisk's pic comes the closest to how things ought to look IF we had a wide enough field of view. Remember - that pic sees everything. It sees both the shooter's feet and the sky directly above, as well as both ends of the pier the shooter is standing on. That is some SERIOUS perspective. It demonstrates what I was getting at - lines that parallel to the horizon very much do converge in infinity on BOTH sides of the camera, and I have a bit of a hard time seeing how a brain could interpret an image like that as straight lines. But then again, that's a curved imprint projected to a flat surface, a brain interpreting the curve directly may try and rationalise straight lines as straight. The problem is... How do you rationalise two straight lines intersecting in two places and still see them as straight?
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
You define E as a position in R3, or three-dimensional space, for the eye, yet a position in three-dimensional space requires three variables. Even if we read E as a three-dimensional vector, you still need to note its coordinates with something. Same for Q, N and O, by the way, as I assume they're all treated as vectors, but no parameters for their coordinates are given.
|
Point B subtracted from point A results in a vector from A to B. I use E - Q, E - O, and Q - O in my matrix. The eqn, en, and qn variables are just in my post to prevent horizontal scrolling in the code box. If O is in fact {0, 0, 0} (in most systems that's a given, but it's not required for the projection math), then E - O is a vector containing the coordinates of E, but vectors and points are not the same thing.
And, to be honest, I'm actually a little lost as to what you'd need a normal vector for in this, as to the best of my knowledge, that's mostly useful in an analytical context where shapes are given as continuous formulas, rather than discrete collections of points in a 3D space.
|
1. Two points in the plane (with the implicit vector between the two points; see #2)
2. A point in the plane and a vector in the plane (giving the location and orientation of the plane)
3. A point in the plane and a vector normal to the plane (again, giving the location and orientation of the plane)
In the perspective calculations, I used the third definition, because I need the dot product of that normal with a few different vectors present in the problem. I could manage with one of the other two representations of the plane, but that would complicate the equations, since I'd then have to calculate the normal.
The matrix I posted is the expanded form of a more common representation, which is displayed as a 2x2 matrix (rather than the 4x4 matrix I posted), where the first element of the first row is a 3x3 matrix, the second element of the first row is a column vector in R3, and the first element of the second row is a row vector in R3.
Looking back at my post, I think I made a couple of mistakes with respect to the origin (for example, I should have used O - E, rather than -E), but since we're not composing a rendering algorithm at the moment, it was mostly for demonstrative purposes.
http://www.fimfiction.net/story/36641/My-Little-Exalt
Here, I cannot agree in the slightest. First of all, as light can be classed as both a wave and a particle, then a beam of light is, at least to my understanding, more appropriate to model as a vector originating from the point we are interested in and passing through the centre of the "eyeball." Obviously, in real life light never reflects quite as perfectly as it does in ideal models, and as such scatters, needing for the lens to focus it onto a single spot. That's why our eyes need to focus and can't really focus on multiple things at the same time. Computer software only really models ideal reflection, and as such no-one has the need to focus on anything. Even in games that do feature focusing, such as F.E.A.R. 2, that's still done via pixel shaders and full screen effects, rather than as a part of raytracing verticals.
|
Furthermore, I cannot accept the proposition that a straight line traced onto a sphere's surface translates into a straight line.
|
I'm glad we're all thinkers. (-:
That's not what I said. I said the straight line projected onto our retinas is perceived as a straight line because the brain interprates the retina as a 2D surface. In the case of the straight light becoming curved on the surface of the retina: if anything, our retinas themselves distort perception to retain proper interpratation of straight objects.
|
One thing I CAN state as a fact is that the difference between what our eyes actually detect and what our brain perceives from that information are not really necessarily directly related. By and large, the brain sees by recognising, such that the visual information only suggests what might be there, with the brain forming a picture of what it THINKS is there, and there are a whole variety of infinitely curious disorders that depicts the depths to which this difference can pronounce itself. All of that is to say that I am willing to admit that we perceive straight lines as straight, even if we do not necessarily SEE them as straight.
I'm glad we're all thinkers. (-: |
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
E, Q, and O are points; n is a vector. You'll notice in my matrix that I use things such as E.x and n.z; this is how I'm denoting the various components of the structure. O, as the origin, is generally considered {0, 0, 0}, but origin is really arbitrary.
|
I'm not sure why you consider origin to be arbitrary, since it gives you your base vectors by which everything in the space is defined, but I suppose you could just mean that it's easy enough to transform the space by shifting the origin to match the orientation and size of the given "camera."
Point B subtracted from point A results in a vector from A to B. I use E - Q, E - O, and Q - O in my matrix. The eqn, en, and qn variables are just in my post to prevent horizontal scrolling in the code box. If O is in fact {0, 0, 0} (in most systems that's a given, but it's not required for the projection math), then E - O is a vector containing the coordinates of E, but vectors and points are not the same thing. |
There are three ways to define a plane: 1. Two points in the plane (with the implicit vector between the two points; see #2) 2. A point in the plane and a vector in the plane (giving the location and orientation of the plane) 3. A point in the plane and a vector normal to the plane (again, giving the location and orientation of the plane) |
The matrix I posted is the expanded form of a more common representation, which is displayed as a 2x2 matrix (rather than the 4x4 matrix I posted), where the first element of the first row is a 3x3 matrix, the second element of the first row is a column vector in R3, and the first element of the second row is a row vector in R3. |
I apologise if I'm dragging this out or becoming irritating, but this is actually interesting to me
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
I'm assuming that either you mean "three points" in the primary, or you're neglecting one of the simplest ways to define one. Just two points between them define a whole cluster of possible planes, essentially rotated around the line between the two points. As far as number two goes, if you're talking about a point in the plane and a vector originating from that point, you run into the same problem - more than one plane can fit that description.
|
See, this is what's been tripping me up from the very start. I can't wrap my head around this matrix, as I'm not sure what it actually means. Your subsequent explanation does make some more sense, but I still lack a notation for what the variables actually mean. I can kind of see what you're talking about in how you break it down, basically as a 3x3 element followed by a 3x1 element on the first row and a 1x3 element followed by a 1x1 element on the second row. The problem is you define three out of the four elements in the description, and even then only as their natures, rather than what they are intended to represent.
|
Perspective projection is not well-defined for every point (if the line EP is orthogonal to n, then it will never intersect the plane), and it is not well defined for every vector (vectors store direction, not position).
The equation defining Pnew is:
Since Pnew lies on the line EP, there is some constant c such that Pnew = P + c (E - P)
Since Pnew also lies in the plane, Pnew - Q must be perpendicular to n; therefore, (Pnew - Q) · n = 0
Making the substitution, we get (P - Q) · n + c (E - P) · n = 0, therefore
and
Because perspective projection is not a linear transformation, it requires a 4x4 matrix instead of a 3x3 matrix, and the point being transformed needs to be homogenized (the point {x, y, z} becomes {x, y, z, 1}). Because perspective projection is a rational function rather than an affine transformation, the fourth column of the 4x4 matrix cannot be {0,0,0,1}. Instead, the denominator weights are stored in the fourth column.
Homogenous coordinates {x, y, z, w} represent the rectangular coordinates {x / w, y / w, z / w}. Given point P = {x, y, z} and 4x4 transformation matrix A = aij:
xnew = a11 x + a21 y + a31 z + a41
ynew = a12 x + a22 y + a32 z + a42
znew = a13 x + a23 y + a33 z + a43
wnew = a14 x + a24 y + a34 z + a44
This results in the homogenous coordinates {xnew, ynew, znew, wnew}, which represents the point {xnew / wnew, ynew / wnew, znew / wnew}
Using homogenous coordinates and the previous equation for Pnew, you can move the denominator to w, and so
Pnew = {(((E - Q) · n)(P - O) + ((Q - P) · n)(E - O), (E - P) · n}
= {(((E - Q) · n)(P - O) + ((Q - P) · n)(E - O), (O - P) · n + (E - O) · n}
Observe:
Where * represents matrix multiplication, vectors are treated as row vectors, n^T is the transpose of n (in other words, n as a column vector), and I is the 3x3 identity matrix.
From the above, the numerator of Pnew is
and the denominator is
Therefore, with the convention that the fourth homogenous coordinate and the fourth column is the denominator,
http://www.fimfiction.net/story/36641/My-Little-Exalt
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
The image of a point P under perspective projection from the eye point E to the plane defined by point Q and normal n is the intersection of the line defined by E and P with the plane:
Perspective projection is not well-defined for every point (if the line EP is orthogonal to n, then it will never intersect the plane), and it is not well defined for every vector (vectors store direction, not position). |
One quick note. You mention the "product" of two vectors, but neglect to mention whether you're talking about vector or scalar product, which threw me off at first. Where I come from, we denote basic number multiplication with just a dot (e.i., just .), so what you originally posted I read to be number multiplication, which confused me when you mentioned a vector product. I've read up on it before, so I know that what I call a "scalar product" you'd likely call a "dot product," by virtue of it being denoted by the dot operator. That makes sense of things when you mention that the dot product of a vector belonging to a plane and that plane's normal vector should be zero. If my geometry is correct, the dot product of two perpendicular vectors ought to give one's length times the other's length times the cosinus (which I assume you'd call "cosine") between the two vectors, which for a 90 degree angle would be zero. OK, that much makes sense.
Since Pnew lies on the line EP, there is some constant c such that Pnew = P + c (E - P) |
As for why it may not matter...
Homogenous coordinates {x, y, z, w} represent the rectangular coordinates {x / w, y / w, z / w}. Given point P = {x, y, z} and 4x4 transformation matrix A = aij: |
Yeah, I wasn't a stellar pupil in university, but at least I tried Honestly, I'd have stuck to much more basic trigonometry that would have given me answers based on the points coordinates, but... Say, here's something:
From what I can glean, you end up with the location of Pnew in three dimensions as it lies on the view plane. However, what we want after printout is the coordinates of that point as seen within the 2D plane itself from an origin that is the orthogonal image of point E (our viewpoint) down onto the plane itself. I honestly don't know (not without probably a full day's worth of thought) how this could be done without even more transformations, but transforming the space to tralnslate and rotate its basis to match the origin of the perspective might help a great deal, both in cutting out a step in vector subtractions and in actually allowing us to use coordinate values as actual line lengths (something which is highly unwieldy with vectors, as it produces the square root of a sum of squares) as well as in allowing us to come to direct values for x and and y which we can directly plot onto a flat without transformation.
I'll see if I can't work on that if I get some free time at work tomorrow.
Samuel_Tow is the only poster that makes me want to punch him in the head more often when I'm agreeing with him than when I'm disagreeing with him.
|
If I'm reading this correctly, the plane you are projecting TO lies on the other side of point P from the viewpoint E, is that correct? I always assumed it was the other way around, that the plane we were imprinting on was between the eye and the point, and we were imprinting on it "backwards towards the eye. Either way, I can work with this. The graph helps.
|
OK... I'm a bit confused here, though I'm not sure it really matters. What I'm getting out of your notation is that every vector mentioned purely by itself is a radial vector, such as O->P (I lack the ability to put the arrow over the letters, so this will have to do). Now, from mentioning they are part of the same line, I assume you mean the image equals the old line plus itself times a scalar. However, as it's noted, it turns into O->Pnew = O->P + c(O->E - O->P), which would actually give you Pnew = P + c(P->E). First of all, wouldn't you want the vector E->P instead (or did I good up somewhere) and secondly... I honestly don't quite follow how that follows from their being on the same line. Technically, that would, to my mind, entail that E->Pnew = E->P +c*E->P. That, of course, doesn't discount what you described, but maybe I'm just too rust to properly follow.
|
The sum of a point and a vector is a point translated by a vector (A + v = B; B is A translated by v)
E - P is a vector. c is a scalar. Scalar times a vector is a vector in the same direction with greater magnitude. So, E - P = v1 (a vector), c v1 = v2 (another vector), P + v2 = Pnew (a point)
I really, honestly HATE working with homogenous coordinates. I basically passed all my exams by avoiding having to, and sticking to the basics. I know they help immensely setting up complex transformations exactly like this one, but if I want to have any shot at reading them, I'm going to have to sit down and do some serious reading. I just don't remember anything about that particular notation.
|
And yes, I did up my display images in Mathematica
http://www.fimfiction.net/story/36641/My-Little-Exalt
One quick note. You mention the "product" of two vectors, but neglect to mention whether you're talking about vector or scalar product, which threw me off at first. Where I come from, we denote basic number multiplication with just a dot (e.i., just .), so what you originally posted I read to be number multiplication, which confused me when you mentioned a vector product. I've read up on it before, so I know that what I call a "scalar product" you'd likely call a "dot product," by virtue of it being denoted by the dot operator.
|
In my equations above, a simple space between two variables (or two parenthesized equations next to one another with no separating figures) means scalar multiplication (scalar times a vector, or product of two scalars). The center dot symbol ( · ) I've been using for dot product. And the asterisk (*) I use for matrix product.
http://www.fimfiction.net/story/36641/My-Little-Exalt
This is going to be an odd, esoteric one, but it does have some relevance which I will explain later.
Parallax, as near as I can tell, is the "side to side" motion of objects relative to a moving observer, as seen though what I can only describe as a "spherical perspective." Basically, the fact that, as you move by them, nearby objects move more than faraway objects. This relative displacement creates one of the basic definitions of perspective - that lines parallel to the direction you are looking appear to converge in the centre, or as though they would converge if they were infinitely long. This is the basis of what makes 3D graphics even remotely workable as a tool to create games in.
Here's where things get complicated, though - we always seem to represent straight lines in the world as straight lines on the screen, at least in games Specifically, we draw horizontal lines above and beyond the horizontal as straight lines on the screen. That's easy enough to check. Pick any horizontal line in town, say one of the many tram lines, and just... Look at it. Stand so that the tram line would be perpendicular to your eyes and you'll note that, on the screen, it is drawn as a straight line, side to side. This is a point at which I start to wonder if that is actually how things are. And the conclusion I've reached, in short, is that, no, that is not how it should be.
See, here's the fun thing parallel lines going in ANY direction, when viewed through a spherical perspective, seem to converge in in infinity, even lines perpendicular to the direction we are looking at. Of course, we don't tend to see that in such lines because the field our eyes can clearly see in is about the size of a silver dollar held at an arm's length, so it's incredibly hard to see what happens to lines pretty much on the far side of your peripheral vision. What's more, 3D games tend to display a field of view that basically has no peripheral vision. If I'm not mistaken, in games we see about a 90 degree arc, whereas in real life we can see almost a full 180.
Now, I'll spare you the boring maths I've done to convince myself of these things, and get straight to the things I DON'T understand about it, which are why I created this thread in the first place. Firstly, any kind of computer graphics that try to simulate real eyesight are going to diverge one way or another, because human eyes are spherical, whereas a screen is flat, and the transition between the two causes distortion. I am very much convinced that, on a computer screen, straight lines in space always transition into subtle arcs on-screen. That much is easy to prove. The real question is, do they do so in our eyes? I honestly don't know. As I said, I can't test it on myself, as I my peripheral vision is not clear enough, and while it's easy to work with a flat sheet, trying to prove lines and arcs on a spherical shape isn't as straightforward, as I'm not sure the geometric definitions work quite the same.
So here is my question: I know that a line above the horizon in space, when viewed through a sphere and translated onto a flat surface, translates into an upward arc. Does it do the same in the human eyes? If it does, then I challenge the validity of 3D graphics. If it doesn't... Then I'm not really sure.