Adds simple example scene for aliasing artifacts
This commit is contained in:
parent
cc78c886c8
commit
9580b96868
1 changed files with 97 additions and 59 deletions
40
ex6.cpp
40
ex6.cpp
|
@ -8,8 +8,11 @@
|
||||||
#include "primitive/sphere.h"
|
#include "primitive/sphere.h"
|
||||||
|
|
||||||
#include "renderer/simplerenderer.h"
|
#include "renderer/simplerenderer.h"
|
||||||
|
|
||||||
#ifdef SUPERRENDERER_FOUND
|
#ifdef SUPERRENDERER_FOUND
|
||||||
|
|
||||||
#include "renderer/superrenderer.h"
|
#include "renderer/superrenderer.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "shader/materialshader.h"
|
#include "shader/materialshader.h"
|
||||||
|
@ -17,8 +20,41 @@
|
||||||
#include "light/ambientlight.h"
|
#include "light/ambientlight.h"
|
||||||
#include "light/pointlight.h"
|
#include "light/pointlight.h"
|
||||||
#include "light/spotlight.h"
|
#include "light/spotlight.h"
|
||||||
|
#include "shader/flatshader.h"
|
||||||
|
|
||||||
int main() {
|
void renderAliasingScene()
|
||||||
|
{
|
||||||
|
FastScene scene;
|
||||||
|
scene.setBackgroundColor(Color(0.5f, 0.5f, 1));
|
||||||
|
|
||||||
|
// Set up the camera
|
||||||
|
PerspectiveCamera camera;
|
||||||
|
camera.setPosition(Vector3d(0, 0, 0));
|
||||||
|
camera.setForwardDirection(normalized(Vector3d(1, 0, 0)));
|
||||||
|
camera.setUpDirection(normalized(Vector3d(0.0f, 1.0f, 0.0f)));
|
||||||
|
camera.setFovAngle(75.0f);
|
||||||
|
|
||||||
|
auto orange = std::make_shared<FlatShader>(Color(1, 0.8f, 0.2f));
|
||||||
|
auto sphere = std::make_shared<Sphere>(Vector3d(5, 0, 0), 3, orange);
|
||||||
|
|
||||||
|
scene.add(sphere);
|
||||||
|
|
||||||
|
// build the tree
|
||||||
|
scene.buildTree();
|
||||||
|
|
||||||
|
// Render the scene
|
||||||
|
SimpleRenderer renderer;
|
||||||
|
renderer.renderImage(scene, camera, 64, 64).save("aliasing.png");
|
||||||
|
|
||||||
|
#ifdef SUPERRENDERER_FOUND
|
||||||
|
SuperRenderer sr;
|
||||||
|
sr.setSuperSamplingFactor(4);
|
||||||
|
sr.renderImage(scene, camera, 64, 64).save("aliasing_super.png");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
FastScene scene;
|
FastScene scene;
|
||||||
scene.setEnvironmentMap(std::make_shared<Texture>("data/TychoSkymapII.t5_04096x02048.png"));
|
scene.setEnvironmentMap(std::make_shared<Texture>("data/TychoSkymapII.t5_04096x02048.png"));
|
||||||
|
|
||||||
|
@ -85,5 +121,7 @@ int main() {
|
||||||
sr.renderImage(scene, camera, 1024, 768).save("result_super.png");
|
sr.renderImage(scene, camera, 1024, 768).save("result_super.png");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
renderAliasingScene();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue