mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-12-01 01:55:40 +00:00
c039d08c03
Late christmas present. Due to the way alpha works on the model3 adding regular anti-aliasing doesn't really work. Supersampling is very much a brute force solution, render the scene at a higher resolution and mipmap it. It's enabled via command line with the -ss option, for example -ss=4 for 4x supersampling or by adding Supersampling = 4 in the config file. Note non power of two values work as well, so 3 gives a very good balance between speed and quality. 8 will make your GPU bleed, since it is essentially rendering 64 pixels for every visible pixel on the screen.
32 lines
884 B
C++
32 lines
884 B
C++
#pragma once
|
|
|
|
#include "FBO.h"
|
|
#include "New3D/GLSLShader.h"
|
|
|
|
// This class just implements super sampling. Super sampling looks fantastic but is quite expensive.
|
|
// 8x and beyond values can start to eat ridiculous amounts of memory / gpu time, for less and less noticable returns
|
|
// 4x works and looks great
|
|
// values such as 3 are also possible, that works out 9 samples per pixel
|
|
// The algorithm is super simple, just add up all samples and divide by the number
|
|
|
|
class SuperAA
|
|
{
|
|
public:
|
|
SuperAA(int aaValue);
|
|
~SuperAA();
|
|
|
|
void Init(int width, int height); // width & height are real window dimensions
|
|
void Draw(); // this is a no-op if AA is 1, since we'll be drawing straight on the back buffer anyway
|
|
|
|
GLuint GetTargetID();
|
|
|
|
private:
|
|
FBO m_fbo;
|
|
GLSLShader m_shader;
|
|
const int m_aa;
|
|
GLuint m_vao;
|
|
int m_width;
|
|
int m_height;
|
|
};
|
|
|