Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
gggmork

perspective/vanishing point

Recommended Posts

Does doom use "vanishing points"? I don't get how it would work if so. Say you're exactly in front of a wall exactly facing you so top/bottom lines are parallel w/ view, now you turn 0.01 degrees to the right. The lines would slightly no longer be parallel, but the slightness would mean they converge into a point 10 million miles away. You're supposed to draw a line to at point 10 million miles away? And it seems there's perspective lines converging in all kinds of directions, not just 1 or a few. Or does doom not use "vanishing point" concepts in the code?
I made a test in python and made perspective kinda work, but it wasn't 100% correct. I just drew a square off to the side then a vanishing point in the center. All 4 corners drew a line to the vanishing point. Now to make it further away I measured the distance of a particular corner to the vanishing point and moved, say, 1/8th that distance for each corner. Each corner is a different distance from the vanishing point, but they all moved and stayed in perspective that way (I made it move around the screen going in and out like a pool cue pointing closer/further toward the viewer or something) except the tip was a perfect square always instead of shifting shape so the closer side is longer. And its confusing to think how the vanishing points, if they exist as a concept, shift around as you turn or something.

Share this post


Link to post

No, vanishing points are just an abstraction to help (human) artists draw perspective-correct pictures without doing tedious geometry calculations. Doom (and all 3D graphics engines) have no use for vanishing points, instead they use projection math to translate 3D coordinates of an object into 2D coordinates on the screen for drawing.

Share this post


Link to post

Doom does not have the concept of vanishing point in the code, but they are visible in the rendering. Any 3d parallel lines will converge to a vanishing point in the 2d projection.

The most basic drawn projection has two vanishing points, but that is just to ease the burden on the human doing the drawing. Some human made drawings have dozens of vanishing points.

Actually there are infinite vanishing points.
Any 3d line will have a vanishing point in the 2d projection.
Any 3d line parallel to that will have its vanishing point at the same 2d projection point.

The vanishing points do not actually move. The parallel lines do not move and the point at infinite distance on those parallel lines does not move. Your viewpoint may move, which moves the 2d projection around. The position of each vanishing point on the 2d projection moves much less than everything else closer to the viewer. This does not consider rotating the viewpoint, the effects of which are obvious and radically different.

Share this post


Link to post

Somewhat ironically, the Doom renderer actually has problems with something you might consider the opposite of a vanishing point: when instead of vanishing to nothingness from the player's view, a wall gets incredibly large. Look in the source ports forum on topics about line wobbling for discussion of this.

Share this post


Link to post

Hmm, interesting... I wonder if Carmack was the first to think of projection math or at least use it in a game since he was a pioneer in 3d (2.5d) stuff.

Share this post


Link to post

No and no. Projection math dates back to the 17th century. The first programmer to use it to render 3D objects in a video game was Jim Bowery in his 1974 game Spasim:



John Carmack wasn't really a pioneer in 3D stuff. Everything he's done had already been done at lower framerates or on faster hardware. Carmack's genius is, and always has been, getting stuff to run fast on hardware that it really shouldn't. Doom was astounding not because it had moderately realistic 3D graphics, but because it had moderately realistic 3D graphics while running at a reasonable framerate on a 386.

Share this post


Link to post

Ultima Underworld had way more complex architecture than even Doom (demoed in 1990, released 1992) and it's what inspired Carmack to create Catacomb 3D.

Here, look at this pic (spoilered for bigness):

Spoiler

Pay attention to the screenshot over the "A bridge too far" caption. That's a 3D floor in a 2.5D engine. One thing the screenshot doesn't demonstrate however is the non-orthogonal walls that the engine also supports but the developers used sparingly. Another thing from the UW engine, this time in UW2:

Look at the geometry of that blue gem thing. Yeah, it's sloped. UW2, released in 1993.

The engine also has comparatively advanced physics. You can throw stuff and they will bounce around. If you throw frail stuff, it can be damaged. If you throw damaged stuff, it can turn into a pile of debris.

The difference is that Catacomb 3D (and later, Wolf 3D) ran in nearly full screen while UW ran in a poststamp-sized view. So while you trudge slowly in a complicated dungeon where you constantly backtrack to chat back with NPCs in UW, in the id games you run around shooting down stuff and find the exit to the next level.

Share this post


Link to post

Minor thread hijack:

Why did Carmack use polar coordinates and the insanity that it involved when similar triangles could have been used? I'm not much of a math wonk, but several months back I began investigating a 3D projection for project of mine and stumbled across this. It's fairly clean and easy to understand, although I have not attempted to perform transformations on the algorithm and do not know how accurate it is when objects begin to rotate and become increasingly skewed. Something like this seems like a much easier and cleaner solution that the stuff Carmack ultimately wound up writing for Doom and the math that was involved with the polar coordinate system seriously can't be simpler than to what I've linked above.

As far as I can tell, the only downside to similar triangles is that you're confined to a base resolution and fixed aspect ratio; essentially, objects right up against the screen have a scale of 1f, which may not be desirable. From what I can tell, Doom has both of the former problems and only seems to avoid the issue of clamping the base scale of sprites.

Share this post


Link to post

Interesting link, I was wondering how road rash II roads were made (still don't understand 100% and would have to tediously try stuff in code to see what he's talking about 100%). The faked turns seem similar to parallax scrolling. Maybe "similar triangles" works with that because the turns are fake so its not true 3d (not sure). It at least seems like multiple similar triangles would be needed for true 3d, one for the height, one for sideways distance (don't really know what I'm talking about).

There's more than one way to make "2.5d", like in doom you can't go underneath a sector and in road rash ii you can't go backwards. Another example is "sonic spheres" (a bonus game of sonic the hedgehog) where the true data seems to just be a flat plane but its just drawn curved like its on a planet (could be wrong). And road rash 2/3 (genesis) and doom are in my top 5 favorite games, so it seems the simplification of 3d into 2.5d makes for a better game.

That game Descent had 3d where you could face any direction and yaw/pitch/roll if I remember (an example of how stuff that's closer to true 3d has cumbersome controls and information overload just trying to navigate so less focus on gameplay like in doom where you can't pitch/roll, only yaw so controls can be dedicated to gameplay of fighting rather than navigating easier.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
×