diff --git a/ex4.cpp b/ex4.cpp index ee1154a..81ef935 100644 --- a/ex4.cpp +++ b/ex4.cpp @@ -11,7 +11,6 @@ #include "primitive/sphere.h" #include "shader/brdfshader.h" - #include "shader/lambertshader.h" #include "shader/mirrorshader.h" #include "shader/phongshader.h" @@ -22,6 +21,8 @@ #include "light/pointlight.h" #include "light/spotlight.h" +#include "post_processing/bloom.h" + int main() { // Let's create a simple scene... SimpleScene scene; @@ -84,11 +85,17 @@ int main() { // focalLength = the area which is in focus DOFRenderer renderer(0.2, 100, 10.0f); - // Use DOFRenderer to raytrace + // Use DOFRenderer to raytrace !!! careful more pixels lead to insane rendering times Texture image = renderer.renderImage(scene, camera, 1024, 1024); - // save image + // Use post-processing Bloom effect + Bloom bloomEffect = Bloom(image.getImage()); + Texture imageWithBloom = image; + imageWithBloom.setTexture(bloomEffect.bloom(0.55f, 5, 10.0f, 0.06f)); + + // save images image.save("result.png"); + image.save("resultWithBloom"); return 0; } diff --git a/renderer/simplerenderer.cpp b/renderer/simplerenderer.cpp index 3647efc..3aaa7c4 100644 --- a/renderer/simplerenderer.cpp +++ b/renderer/simplerenderer.cpp @@ -5,7 +5,6 @@ #include #include #include -#include "post_processing/bloom.h" void SimpleRenderer::renderThread(const Scene *scene, Camera const *camera, Texture *image, int width, int widthStep, int widthOffset, int height, int heightStep, int heightOffset, std::atomic *k, int const stepSize) { float const aspectRatio = static_cast(height) / width; @@ -74,13 +73,5 @@ Texture SimpleRenderer::renderImage(Scene const &scene, Camera const &camera, in std::cout << "Paths: " << rays << std::endl; std::cout << "Paths per second: " << std::fixed << std::setprecision(0) << rays / seconds << std::endl; - // Post-processing - // Bloom shader - - image.save("original.png"); - - Bloom bloomEffect = Bloom(image.getImage()); - image.setTexture(bloomEffect.bloom(0.55f, 5, 10.0f, 0.06f)); - return image; } \ No newline at end of file