Added gallery.

This commit is contained in:
2017-05-21 12:21:39 -04:00
parent 6b98770b0e
commit e69e030b20
16 changed files with 24 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
-ansi -std=c++11
-pedantic -pedantic
-Wall -Wall
-DGLM_FORCE_RADIANS -DGLM_FORCE_RADIANS
-DUSE_CPP11_RANDOM
-fopenmp -fopenmp
-std=c++11

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View File

@@ -6,7 +6,7 @@ OBJECTS = main.o sampling.o camera.o environment.o disk.o plane.o sphere.o \
spot_light.o sphere_area_light.o disk_area_light.o scene.o tracer.o \ spot_light.o sphere_area_light.o disk_area_light.o scene.o tracer.o \
path_tracer.o whitted_tracer.o rgbe.o kd_tree.o photon_tracer.o path_tracer.o whitted_tracer.o rgbe.o kd_tree.o photon_tracer.o
DEPENDS = $(OBJECTS:.o=.d) DEPENDS = $(OBJECTS:.o=.d)
CXXFLAGS = -std=c++11 -pedantic -Wall -DGLM_FORCE_RADIANS -fopenmp -D_USE_CPP11_RANDOM #-DENABLE_KD_TREE CXXFLAGS = -std=c++11 -pedantic -Wall -DGLM_FORCE_RADIANS -fopenmp -DUSE_CPP11_RANDOM #-DENABLE_KD_TREE
LDLIBS = -lfreeimage -ljson_spirit LDLIBS = -lfreeimage -ljson_spirit
.PHONY: all .PHONY: all

View File

@@ -2,6 +2,8 @@
#ifndef HSA_BRDF_HPP #ifndef HSA_BRDF_HPP
#define HSA_BRDF_HPP #define HSA_BRDF_HPP
#include <glm/glm.hpp>
#include "phong_brdf.hpp" #include "phong_brdf.hpp"
using glm::normalize; using glm::normalize;

View File

@@ -118,9 +118,16 @@ vec3 PhotonTracer::trace_ray(Ray & r, Scene * s, unsigned int rec_level) const {
#else #else
m_photon_map.find_by_distance(photons, i_pos, n, m_h_radius, 1000); m_photon_map.find_by_distance(photons, i_pos, n, m_h_radius, 1000);
#endif #endif
while(photons.size() == 0 && radius < 5.0) { while(photons.size() == 0 && radius < 5.0) {
radius *= 2; radius *= 2;
#ifdef ENABLE_KD_TREE
vmin = Vec3(i_pos.x - m_h_radius, i_pos.y - m_h_radius, i_pos.z - m_h_radius);
vmax = Vec3(i_pos.x + m_h_radius, i_pos.y + m_h_radius, i_pos.z + m_h_radius);
photons = m_photon_map.findInRange(vmin, vmax);
#else
m_photon_map.find_by_distance(photons, i_pos, n, m_h_radius, 1000); m_photon_map.find_by_distance(photons, i_pos, n, m_h_radius, 1000);
#endif
} }
radius = m_h_radius; radius = m_h_radius;
@@ -129,11 +136,17 @@ vec3 PhotonTracer::trace_ray(Ray & r, Scene * s, unsigned int rec_level) const {
#else #else
m_caustics_map.find_by_distance(caustics, i_pos, n, m_h_radius, 1000); m_caustics_map.find_by_distance(caustics, i_pos, n, m_h_radius, 1000);
#endif #endif
while(caustics.size() == 0 && radius < 5.0) { while(caustics.size() == 0 && radius < 5.0) {
radius *= 2; radius *= 2;
#ifdef ENABLE_KD_TREE
vmin = Vec3(i_pos.x - m_h_radius, i_pos.y - m_h_radius, i_pos.z - m_h_radius);
vmax = Vec3(i_pos.x + m_h_radius, i_pos.y + m_h_radius, i_pos.z + m_h_radius);
photons = m_caustics_map.findInRange(vmin, vmax);
#else
m_caustics_map.find_by_distance(caustics, i_pos, n, m_h_radius, 1000); m_caustics_map.find_by_distance(caustics, i_pos, n, m_h_radius, 1000);
#endif
} }
//photons.insert(photons.end(), caustics.begin(), caustics.end());
for (Photon p : photons) { for (Photon p : photons) {
p.getColor(red, green, blue); p.getColor(red, green, blue);

View File

@@ -1,5 +1,4 @@
#ifdef _USE_CPP11_RANDOM #ifdef USE_CPP11_RANDOM
#warning "Using C++11 random number generators."
#include <random> #include <random>
#include <chrono> #include <chrono>
#include <functional> #include <functional>
@@ -13,7 +12,7 @@
#include "sampling.hpp" #include "sampling.hpp"
#ifdef _USE_CPP11_RANDOM #ifdef USE_CPP11_RANDOM
using std::uniform_real_distribution; using std::uniform_real_distribution;
using std::mt19937; using std::mt19937;
using std::bind; using std::bind;
@@ -29,7 +28,7 @@ const float PDF = (1.0f / (2.0f * pi<float>()));
static bool seeded = false; static bool seeded = false;
#ifdef _USE_CPP11_RANDOM #ifdef USE_CPP11_RANDOM
static uniform_real_distribution<float> dist(0, 1); static uniform_real_distribution<float> dist(0, 1);
static mt19937 engine; static mt19937 engine;
static auto generator = bind(dist, engine); static auto generator = bind(dist, engine);
@@ -37,14 +36,14 @@ static auto generator = bind(dist, engine);
float random01() { float random01() {
if (!seeded) { if (!seeded) {
#ifdef _USE_CPP11_RANDOM #ifdef USE_CPP11_RANDOM
engine.seed(std::chrono::system_clock::now().time_since_epoch().count()); engine.seed(std::chrono::system_clock::now().time_since_epoch().count());
#else #else
srand(time(NULL)); srand(time(NULL));
#endif #endif
seeded = true; seeded = true;
} }
#ifdef _USE_CPP11_RANDOM #ifdef USE_CPP11_RANDOM
return generator(); return generator();
#else #else
return static_cast<float>(rand()) / RAND_MAX; return static_cast<float>(rand()) / RAND_MAX;