Lets say we have our data...loads and loads of x,y,z values, which we've either read in from a file or generated them....now how do we go about rendering these points to the screen so that we get a 3D appearance? Well there are two main ways...orthographic and perspective... in orthographic we just throw the z value away and would more or less render to the screen... well thats the simple explanation.
In perspective, we divide our x and y values by there z value in essence....its a slight bit more complicated but that a basic theory. We will have to take some things into account for our final version, such as Field of view and screen size.... but just hold on to your pc, and we'll get you through it :)
You see 'perspective' all the time in the real-world - just look around - roads, train tracks or anything on the horizon - it gets smaller as it gets further away.
Compute Graphics - 3D to 2D (with perspective
The perspective projection is accomplished on the output screen when we take the 3d coordinates and convert them to 2d by dividing the x and y coordinates by the z - giving realistic perspective effect.
In technical terms - people call this the perspective divide - and is the relationship between the camera and the objects in the scene.
1. Original Point:
(x, y, z)
2. After Perspective Divide:
(x/z, y/z)
While inverse-square law applies to many physical phenomena like light intensity, sound, and gravity, where the effect diminishes with the square of the distance. However, in graphics and perspective projection, we only divide by z to simulate how our eyes perceive depth and distance. If you were to divide by \(z^2\) instead of \(z\), the perspective effect would be incorrect - and objects would appear much smaller at greater distances than they should, making the perspective distortion too extreme and unnatural. The objects would shrink too quickly as they move away from the camera, leading to an unrealistic and visually jarring effect.
Visitor:
Copyright (c) 2002-2025 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.