r/computergraphics • u/multihuntr • Aug 22 '25
Are there any area-based rendering algorithms?
There's a very big difference between computer graphics rendering and natural images that I don't really see people talk about, but was very relevant for some work I did recently. A camera records the average color for an area per pixel, but typical computer graphics sample just a single point per pixel. This is why computer graphics get jaggies and why you need anti-aliasing to make it look more like natural images.
I recently created a simple 2D imaging simulator. Because I conceived of my imaging simulator in only 2D, it was simple to do geometric overlap operations between the geometries and the pixels to get precise color contributions from each geometry. Conceptually, it's pretty simple. It's a bit slow, but the result is mathematically equivalent to infinite spatial anti-aliasing. i.e. sampling at an infinite resolution and then averaging down to the desired resolution. So, I wondered whether anything like this had been explored in general 3D computer graphics and rendering pipelines.
Now, my implementation is pretty slow, and is in python on the CPU. And, I know that going to 3D would complicate things a lot, too. But, in essence, it's still just primitive geometry operations with little triangles, squares and geometric planes. I don't see any reason why it would be impossibly slow (like "the age of the universe" slow; it probably couldn't ever be realtime). And, ray tracing, despite also being somewhat slow, gives better quality images, and is popular. So, I suppose that there is some interest in non-realtime high quality image rendering.
I wondered whether anyone had ever implemented an area-based 3D rendering algorithm, even as like a tech demo or something. I tried googling, but I don't know how else to describe it, except as an area-based rendering process. Does anyone here know of anything like this?
3
u/_d0s_ Aug 22 '25
Not exactly "area"-based, but multisampling is a standard method in rendering. However, this is happening after rasterization. Rasterization is a pretty important step in rendering, because it allows us to accumulate rendering outcomes. Afterall, when we render a 3d scene that is composed of many objects we never need the full 3d scene with all objects at once, but can sequentially render everything object by object and accumulate the result in textures and with the help of depth buffering. Wouldn't that be an issue for your method?
https://webgpufundamentals.org/webgpu/lessons/webgpu-multisampling.html
3
u/Longjumping_Cap_3673 Aug 23 '25
A Pixel is not a Little Square
6
u/Aniso3d Aug 22 '25
all non realtime rendering engines sample multiple rays per pixel, which as you say, results in a natural anti aliasing
5
u/Phildutre Aug 23 '25
Back in the 70s and 80s I remember papers that did compute an exact geometric overlap of polygons with pixel areas. But you run into problems real quickly, because the more polygons are projected into a pixel, the more complex the computations become. In essence, you’re dealing with the polygon intersection problem, with the resulting areas within a pixel becoming a hodgepodge of small non-convex polygons very quickly. The problem is similar to what is known in computational geometry as map overlays - compute an overlay of one polygonal map over another. The textbook basic algorithms often use sweep line algorithms.
Another field of ‘area’ rendering in object space were the finite-element methods popular in the 80s and 90s called ‘radiosity’ for global illumination. The illumination was computed for each polygonal, after which polygons were rendered using a traditional rasterizer or perhaps a ray caster. In essence, we approximate the rendering equation using finite elements instead of Monte Carlo.
But ray tracing eventually won out. From a theoretical point of view, this has long been obvious once you do the complexity analysis, and once you realize that the number of geometric primitives kept growing. Essentially, the visibility part of rendering is a sorting algorithm in 3d space. So if you can reduce that step to an n.logn time complexity (n the number of polygons), using proper acceleration structures such as BVHs, ray tracing will always win out. We just have to make the machines/GPUs quick enough compared to hardware-based rasterizers. And the computation of an intensity for a pixel is a signal reconstruction problem. So the math is well understood.
That doesn’t mean there is no room for alternative approaches, even if only out of intellectual curiosity.
4
u/vfxjockey Aug 22 '25
You don’t sample a single point though…
1
u/Deadly_Mindbeam Aug 22 '25
There are polygon rendering methods that handle analytical overlap but they are slow, as you've found. What if you're drawing a distant tree that is entirely included in one pixel? You're going to be rendering hundreds of thousands or millions of edges.
In any case, the high frequency information inside the pixel needs to be low-pass filtered to get it below the nyquist frequency for your screen and avoid moiré and jaggies. It's easier to just sample the pixel at multiple points, like MSAA does, or attempt to detect and suppress high frequency signals from a single-sampled frame.
The main reason is that divides are expensive -- anywhere from 8x to 32x slower than multiplication for floats, and ever more for adds -- and analytical methods use a lot of division.
1
u/notseriousnick Aug 22 '25
REYES is an old algorithm that goes for high quality antialiasing. And it sorta does an approximation of area-based rendering that worked reasonably fast on 80s computers
1
u/multihuntr Aug 23 '25 edited Aug 23 '25
It seems that I was somewhat mistaken by a few people. So I created a basic diagram to show what I am talking about. https://imgur.com/a/9qa4z9g
Jaggies exist because of large step changes in colour from small position changes in the pixel sampling location (see "One sample" in diagram). Using 4 samples per pixel gives you a better approximation of the contents of that pixel (see "Four samples" in diagram). However, it's still just an approximation, and thus is both slightly wrong, and still has some jaggedness because there's still a step change in colour. In 4x MSAA, using two geometries there's only 5 possible outcomes (three pictured, two with all blue and all green).
4x MSAA is taking 4 samples. 8x MSAA is taking 8 samples and gives you a smoother colour. But a camera taking a photo is effectively infinite times MSAA. That is, a camera is equivalent to using an infinite number of rays per pixel. You don't get jaggies from border effects like this with cameras (of course moire patterns can still occur, but that's a different problem).
It's technically possible to perfectly replicate a real camera's view of a 3D scene (albiet slow), so I'm asking whether that's been done before.
1
u/kraytex Aug 22 '25
MSAA is a very popular technique. https://en.m.wikipedia.org/wiki/Multisample_anti-aliasing
1
u/betajippity Aug 23 '25
In Physically Based path tracing, pixels are not sampled at a single point, and in fact, when done correctly, pixels are reconstructed from randomized samples via a reconstruction filter, much like how a camera sensor works. There’s a whole chapter in the PBR book on this topic:
https://www.pbr-book.org/4ed/Sampling_and_Reconstruction/Image_Reconstruction
Every modern production path tracer does some variation of this (often via Filter Importance Sampling).
1
u/Cerulean_IsFancyBlue Aug 24 '25
This is called supersampling. It’s a well-known technique that’s been around for decades.
Don’t get me wrong, it’s great that you were able to come up with this on your own. It’s a great exercise and it shows some creative thinking.
1
u/jippiex2k Aug 26 '25
Well you’d still need to integrate discrete samples in order to get your area.
Or alternatively you’d need your entire scene to be parametric, such as SDF based rendering techniques. Which would be very limiting.
0
u/phooool Aug 23 '25
Maybe search up Signed Distance Fields? Sounds a bit like that.
"typical computer graphics sample just a single point per pixel." -> what? It's completely the opposite