Author Topic: How does supersampling work?  (Read 3799 times)

0 Members and 1 Guest are viewing this topic.

Offline Gore Motel

  • C= 64
  • **
  • Posts: 45
  • Karma: 18
    • View Profile
    • Gore Motel
How does supersampling work?
« on: April 25, 2014 »
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:

Quote


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:

Code: [Select]
float Histogram[100][100];
But I want to do 3x supersampling, so I'll make it like this instead:

Code: [Select]
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?

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: How does supersampling work?
« Reply #1 on: April 29, 2014 »
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:

Offline Gore Motel

  • C= 64
  • **
  • Posts: 45
  • Karma: 18
    • View Profile
    • Gore Motel
Re: How does supersampling work?
« Reply #2 on: April 30, 2014 »
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.

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1292
  • Karma: 466
    • View Profile
    • my stuff
Re: How does supersampling work?
« Reply #3 on: April 30, 2014 »
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: