• Welcome to Dark Bit Factory & Gravity.
 

How does supersampling work?

Started by Gore Motel, April 25, 2014

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gore Motel

I'm back with another question: how does supersampling work?

I've got a fractal flame generator and I want to implement supersampling. This is what I've read about it:

QuoteTo increase the quality of the image, one can use supersampling to decrease the noise. This involves creating a histogram larger than the image so each pixel has multiple data points to pull from.

For example, creating a histogram with 300×300 cells in order to draw an 100×100 px image. Each pixel would use a 3×3 group of histogram buckets to calculate its value.


Ok, so let's say that I want to draw a image that's 100x100. I'd normally make my histogram kind of like this:

float Histogram[100][100];

But I want to do 3x supersampling, so I'll make it like this instead:

float Histogram[300][300];

I go over the iterations and get the coordinates of a pixel, let's call them pixelX and pixelY. I decide what color the pixel is going to have. Now the pixel has to go in the histogram, I'm guessing at (pixelX * 3, pixelY * 3), right? Since I'm doing 3x supersampling?

But then what? I'm just putting pixel data at higher indexes in the histogram. How do I get 3x3 buckets to calculate the value of a pixel?

Jim

The idea is you render 9 times (3x3) the number of pixels into the histogram (so change your algorithm to draw a 300x300 grid), then when you come to render it to the screen you use some kind of averaging algorithm that takes those 3x3 pixels and turns them into one single coloured pixel.  Simplest algorithm is to add them all together and divide by 9, but there are other possibilities.

Jim

Challenge Trophies Won:

Gore Motel

I think I'm getting there. Here is a noisy image, without supersampling (click on the thumbnail for a larger version):



Here is the same drawing (same resolution, number of iterations and functions used) with 2x supersampling:



Here is the drawing again, with 2x supersampling and a larger gamma value:



It looks like I'm losing too much detail, though.

hellfire

The typical approaches for anti-aliasing are not particularly well suited for denoising point clouds.
That's because you don't have continous surfaces or even edges.
Challenge Trophies Won: