As of May 31, 2023, we have updated our Code of Conduct.
20 votes
Accepted

Does a sphere projected into 2D space always result in an ellipse?

Assuming a perspective projection and a view point external to the sphere, then the 'boundary' formed by the view point and the circle on the sphere which forms the horizon WRT the view point, will be ...
Simon F's user avatar
  • 4,151
15 votes

Does a sphere projected into 2D space always result in an ellipse?

This is more like a long comment to @SimonF's answer that I'm trying to make somewhat self contained. All cuts of cone are possible, hyperbola, parabola and ovals. This is easy to test by drawing ...
joojaa's user avatar
  • 8,317
14 votes

Does a sphere projected into 2D space always result in an ellipse?

Projection systems are used to convert a 3D shape to a planar (2D) shape. According to the type of projection system, different results and shapes like rectangles, pies, ellipses, circles, ... can be ...
Iman Nia's user avatar
  • 283
11 votes
Accepted

How am I able to perform perspective projection without a near plane?

The near and far planes of a viewing frustum aren't needed for simple 3D→2D projection. What the near and far planes actually do, in a typical rasterizer setup, is define the range of values for the ...
Nathan Reed's user avatar
  • 24.4k
11 votes

Does a sphere projected into 2D space always result in an ellipse?

SimonF's reasoning basically convinced me, but I decided to do a sanity check. I loaded up a UE4 level that happens to have some spheres, like this one: I set the camera FOV up to 160 degrees to give ...
Nathan Reed's user avatar
  • 24.4k
10 votes
Accepted

Perspective Correct Texture Mapping

You are on the right track but what you need to do is to calculate u/w and v/w, and also 1/w for each vertex, which you interpolate linearly in screen space in your rasterizer. Then for every pixel ...
JarkkoL's user avatar
  • 3,596
9 votes
Accepted

What's the difference between orthographic and perspective projection?

Orthographic projections are parallel projections. Each line that is originally parallel will be parallel after this transformation. The orthographic projection can be represented by a affine ...
joojaa's user avatar
  • 8,317
7 votes
Accepted

Is my perspective math correct?

Identifying your axes in both figures and adding the camera position to your first figure would help you understand what's going on. You could also have a single variables for all your points, ...
Soravux's user avatar
  • 371
7 votes

How am I able to perform perspective projection without a near plane?

In this case, the geometry of similar triangles ABC and ADE is used to determine the height of D via the solution of DE. It is obvious that if the near plane is at 0 (AE=0), then a division by 0 ...
Nicol Bolas's user avatar
  • 9,364
6 votes
Accepted

Render with camera perspective off-center

Yes, you can use an off-axis projection matrix. This is what I use in my code (note: I shift the centre upwards, not left as you do in your example.) ...
Bram's user avatar
  • 260
5 votes
Accepted

Calculate aspect ratio from 2D shape in 3D space

The ratio is with a quick and dirty visual measurement $665:501$ which is approximately $5:4$. You can measure it by taking the ratio of the vanishing angles $\alpha/\beta$ (see picture 1) because we ...
joojaa's user avatar
  • 8,317
5 votes
Accepted

Why is the back of a perspective frustrum larger than the front?

It might help to think of it this way: Both the near plane and the far plane are the size that will fit onto the screen you are viewing on. The further away something is, the bigger it can be and ...
trichoplax is on Codidact now's user avatar
4 votes

What is this triangle sub-division scheme called?

Instead of subdividing until reaching certain edge length on screen, you should look into GPU Gems 2 article "Adaptive Tessellation of Subdivision Surfaces with Displacement Mapping" by Michael ...
JarkkoL's user avatar
  • 3,596
4 votes
Accepted

Why does this gl_FragDepth calculation work?

What you are missing is, that in OpenGL's NDC space (i.e. clip space after division by w) all 3 coordinates are in the range $[-1,1]$. So ...
Christian Rau's user avatar
4 votes
Accepted

Supporting multiple camera types in a deferred renderer without specializing the shaders or in the shaders

Projective transformations (represented by 4×4 projection matrices) are invertible. You can go from NDC coordinates back to view space using the inverse of the projection matrix, in the same way that ...
Nathan Reed's user avatar
  • 24.4k
4 votes
Accepted

Is placing z value of vertex in w enough to achieve perspective projection in OpenGL?

The projection matrix distorts the view frustum (the volume the camera can see) into a unit cube. So everything with all coordinates in the range -1 to 1 after projection is potentially visible, and ...
russ's user avatar
  • 2,332
4 votes
Accepted

OpenGL - How to increase view space coordinate range in X and Y axis

I was converting the angle to radians twice guys. Moral of the story is to take breaks when coding.
gallickgunner's user avatar
3 votes

Why is the back of a perspective frustrum larger than the front?

It is bigger because it fills the same view and it ts further away. It would be smaller if it wouldn't fill the same view but then it wouldn't fill the camera view and it wouldnt work. So the inverse ...
joojaa's user avatar
  • 8,317
3 votes
Accepted

Computing perspective directly

Copying this from another thread where i posted this as the answer but as Wyck suggested, the correct answer is the first one. There is the whole derivation of it but I'll be discussing a brief ...
gallickgunner's user avatar
3 votes
Accepted

Do straight lines always remain straight when projected with a perspective camera?

"A not so simple approach". I may have messed a little bit too much with grouping the terms, do forgive my elementary math skills, it's a side effect of using tools like wolfram and mathematica too ...
lightxbulb's user avatar
  • 1,951
3 votes
Accepted

Interpolate vertex attributes with $z$ AFTER homogeneous divide

The $Z$ of NDC space is related to $1/Z_\text{view}$ but not the same. With a typical projection matrix, they're related by an affine remapping, $$ Z_\text{NDC} = a \, \frac{1}{Z_\text{view}} + b $$ ...
Nathan Reed's user avatar
  • 24.4k
3 votes
Accepted

Why perspective division ( div by w) when applying the inverse to a perspective transformation?

The way homogeneous coordinates (x, y, z, w) work is that if you multiply the vector by any nonzero value, it still represents the same point in 3D projective space. These different xyzw ...
Nathan Reed's user avatar
  • 24.4k
3 votes

Rendering Hypercentric Perspective

You can approximate the view of a hypercentric camera with an ordinary 3D perspective camera if you are able to manipulate the projection matrix, and/or reverse the direction of the depth test. In a ...
Nathan Reed's user avatar
  • 24.4k
3 votes
Accepted

Existence of vanishing point

My first question is how we can say it doesn't exist, but when we see real image of railway track they intersects at X? Because human vision only sees a perspective on reality. It may appear to cause ...
Nicol Bolas's user avatar
  • 9,364
2 votes
Accepted

Perspective correct interpolation of normal values

Perspective correct interpolation of normals works just as it does any color or coordinate or other linearly varying attribute. Each component of each varying vector is interpolated independently as ...
GroverManheim's user avatar
2 votes
Accepted

Calculate vanishing point

Here's a hint to get you started: Parallel lines include the line through the camera. So really all you need is the direction from the camera to the vanishing point on the view plane. Then create ...
ratchet freak's user avatar
2 votes
Accepted

Getting from the default view volume to an image on the screen

The mapping from NDC space to screen space is orthographic. The x is mapped linearly from [-1, 1] to [0,viewport width], same with y and viewport height. This mapping happens after the projection ...
ratchet freak's user avatar
2 votes

Creating a vanishing point perspective shader

It should be possible to do this properly by using a modified projection matrix for your entire scene that has its far plane at infinity, as detailed here. That should allow you to properly render ...
Quinchilion's user avatar
2 votes

Why is the line from the camera to vanishing point parallel to the other parallel lines?

FYI every set of parallel lines will have their own vanishing point. The reason why there is usually only a single vanishing point (the most obvious one) talked about in an image is due to aesthetic ...
ratchet freak's user avatar
2 votes
Accepted

Inverse value in a Perspective Matrix

There is the whole derivation of it but I'll be discussing a brief overview. This is for the perspective projection where the line joining the eye and the center of the projection/image plane is ...
gallickgunner's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible