Why do 3d games not use real circles?
February 8, 2015 8:38 PM   Subscribe

Why do 3D games draw circles, cylinders, and other round objects as a series of short straight lines instead of a single curved line? For example, these balloons, and balls on railings in Bioshock Infinite, and the wheels on this car in Project Cars.

I assume calculating and displaying 3D circles is some degree more complex than straight lines, but I can't remember seeing a real circle in even recent very high end 3D games, whereas I remember seeing ray-traced orbs on 33-MHz Pentiums 20 years ago.
Extra question: I find jagged wheels on cars, etc. very illusion-breaking. Is this something that is likely to be included in games in the near future, or is the required processing power still far off?
posted by bakerybob to Computers & Internet (14 answers total) 2 users marked this as a favorite
 
Pretty simple, really: Triangles are less computationally expensive than real curves.
posted by Cool Papa Bell at 8:45 PM on February 8, 2015 [5 favorites]


I think hardware acceleration doesn't support curves.
posted by Chocolate Pickle at 8:45 PM on February 8, 2015


All 3D accelerated videocards render triangles only. Everything they draw must be a triangle, or made up of small triangles.

Ray tracers, especially shitty student demos, draw spheres because they are the easiest shape to hit test (mostly because they have no sense of rotation / orientation).

In other words, both situations are examples of that technology doing the easiest possible shape.
posted by ryanrs at 8:46 PM on February 8, 2015 [5 favorites]


Even super-high-end animation, like Pixar movies, uses triangles. Actually, they use subdivision surfaces that can generate triangles at varying levels of detail depending on how close the subject is to the viewer. However, they are typically specified so that every pixel on screen has enough triangles (also known as "facets") that you can't tell the difference between that and a smooth curve.

It's all a question of how much detail you're willing to wait for the GPU to render. More triangles means less frame rate, which for other people is more illusion-breaking. Certain operations have to be done per triangle, and the triangles take up space in the GPU memory that could be used for textures.
posted by wnissen at 9:45 PM on February 8, 2015 [3 favorites]


I'm not entirely sure exactly what you are asking about. First thing is that modern computer graphics are almost always rendered onto an N by M grid of pixels, where these pixels are rectangular (and occasionally even square).

(And I say "almost" because while 99.999999% of all CGI today is rendered to pixels, someone will probably point at some pure vector output device that someone has used for some purpose. That technology goes way back, think "oscilloscope", so you could render nice non-pixelated curves with it).

So the pixel thing is part of it. The stuff that people are saying about triangles is at the next level: inside of a game or whatever, you'll have many objects, which are usually surfaces, and (these days) modelers and modeling software takes advantage of fast CPUs and hotrod graphics adapters to model these surfaces as meshes composed of lots of triangles. Triangles are computationally easier to deal with than, say, rectangles. For instance, if you ignore the degenerate case of three points on a line, all triangles are flat surfaces with easily computable normals. Not so for all shapes defined by four points.

You're not alone in finding jagged edges on wheels and so forth to be annoying. An amazing amount of work has been done in the past few decades to perform "anti-aliasing" to try to make the jaggies as unobtrusive as is possible. But there are limits on how far you can go with this, based on the rectangular nature of pixels and also the amount of computation required to anti-alias a pixel.
posted by doctor tough love at 10:47 PM on February 8, 2015 [2 favorites]


Seconding what everyone is saying. Triangular polygonal meshes are much faster to compute, and graphics cards have been optimized to use 3-dimensional meshes made out of triangular faces (as opposed to quads, etc). For games, in which real-time rendering is crucial, the vast majority of graphics will probably be mesh-based.

In other realms, such as 3d modeling, you may find non-mesh-based modeling platforms. See: NURBS. So with NURBS, you can get 'real' circles and curves. On the other hand, it's computationally intensive, which is why it works for 3d modeling tools/environments.
posted by suedehead at 11:02 PM on February 8, 2015 [1 favorite]


If the game designers had made those wheels with a higher polygon count (i.e. split the model into more, smaller triangles) then the wheels would look perfectly round. However when the polygon count for the total scene gets too high, the framerate starts to drop, so compromises have to be made.
posted by w0mbat at 3:45 AM on February 9, 2015 [1 favorite]


If I recall, the Sega Saturn rendered with quadrilaterals instead of triangles which made it difficult to port titles over from other consoles.
posted by RonButNotStupid at 4:38 AM on February 9, 2015


I can't remember seeing a real circle in even recent very high end 3D games, whereas I remember seeing ray-traced orbs on 33-MHz Pentiums 20 years ago.

From Wikipedia:
[Ray tracing] is capable of producing a very high degree of visual realism, usually higher than that of typical scanline rendering methods, but at a greater computational cost. This makes ray tracing best suited for applications where the image can be rendered slowly ahead of time, such as in still images and film and television visual effects, and more poorly suited for real-time applications like video games where speed is critical.
posted by EndsOfInvention at 6:11 AM on February 9, 2015


FYI, this is Driveclub, a PS4 game from last year. This is what the game actually looks like, as you're playing it. I challenge you to find discernible polygons in that shot.

If you don't have a PS4, Project CARS will be coming to PC/PS4/XB1 later this year, and offers a similar level of fidelity.

Making photorealistic cars is totally doable at this point, although you may be looking at things like GTAV or similar open world games where there isn't the "budget" for that level of detail on ever object.
posted by Oktober at 7:40 AM on February 9, 2015 [3 favorites]


As mentioned, the technology to do this exists in the pre-rendered 3D world, as NURBS.

In practice, it's not terribly common for similar reasons that vector graphics aren't terribly common in graphic design -- it's much more straightforward to work with pixels/polygons, and memory is cheap.

Ray-tracing (where you saw your perfect spheres) is a much different technology from the scan-line rendering usually used today (in both pre-rendered graphics and games). Game engines in particular are very heavily optimized, and having special cases for spheres etc. would only slow things down for a questionable increase in visual quality. There are also a lot of rendering effects you can apply to polygons that wouldn't necessarily work on Platonic solids.

I should mention, though, that the Quake 3 engine did have a special curved-surface feature. See this 15-year-old Gamasutra article. As far as I know the technique didn't catch on at all. I'm pretty sure Quake 3 just converted the curved surfaces to polygons on level load, so you wouldn't get any improved detail up-close or anything.

With regard to modern games, they only have a certain number of polygons to work with per scene. Increasing the polygons on spheres (like in the Bioshock Infinite screenshot) would double or triple (or more) the number of polygons for each one of these objects, for a questionable increase in visual quality. It's only really noticeable in a high-res screenshot, and these are games that were designed to be played at 1080p (if that) on a TV.
posted by neckro23 at 9:29 AM on February 9, 2015


Argh, I potatoed my link. Here's a GIS of really pretty Project CARS shots.
posted by Oktober at 12:51 PM on February 9, 2015


Heh, I'm tickled at how this question made most people jump right to "triangles".

FWIW, ray-tracing isn't limited to Platonic solids - back in the 80s it seemed like everyone in the field was embroiled in an effort to figure out how to ray-trace everything. SIGGRAPH publications were filled with papers on how to ray-trace fractals and trees and water and anything you could think of. It was like if you wanted a thesis topic, you'd take "Efficient Ray Intersection for ______" and fill in the blank with something random, like "bunny rabbits".

Ray-tracing does tend to be computationally expensive (although it parallelizes fairly nicely, and due to its nature it automagically handles some otherwise complex phenomena like reflection and refraction and shadows). But in gaming, real-time performance tends to win out over everything else. And Doom and Quake sorta paved the way towards the modern-day collection of clever hacks and short-cuts that became embodied in hardware on countless graphics adapters. Which leads to one of the other things that ray-tracing handles fairly well, which is anti-aliasing. When you move to shader rendering, you get aliasing. And so developers made more hacks to deal with it, and it works okay except that you tend to lose some sharpness from the image. But in many games you've got so much shit whipping about on the screen - it's hard to tell.

Somebody mentioned NURBS, which are cool, but are primarily celebrated as a mathematical tool that allows designers and modelers to do just about anything you can imagine with a surface. NURBS can be ray-traced, and I'm pretty sure that they're used in almost all modern games - after they've been converted to a triangular mesh. I'm fairly sure that you could make a modern graphics card render NURBS directly, but I don't think most / any games do it because *shrug* it's a non-standard thing that doesn't really add lots to the gameplay.

Incidentally, one area that has benefitted greatly from NURBS is the sex toy industry [NSFW].
posted by doctor tough love at 2:50 PM on February 9, 2015


Thanks everybody, for the clear and easy to understand answers. I didn't realize that video cards only render in triangles!
It had always seemed to me that if it was possible at all to render 3D circles on a PC 20 years ago, it should be trivially easy to do it in real-time these days, but the above fact answers my question as to why it isn't done in high-end games.
Also interesting that even animated movies, which don't require any real-time rendering whatsoever, don't use real circles. I understand that even the massive numbers of triangles required to simulate a circle or curve at high definition are more computationally efficient than a true circle or curve would be.
posted by bakerybob at 4:29 PM on February 11, 2015


« Older How do we tell his family that we are having a...   |   How far back can I trim this tree? Newer »
This thread is closed to new comments.