Skip to content
Snippets Groups Projects
Commit df0b1f1f authored by bobarna's avatar bobarna
Browse files

todo: sun and sampling

parent e7d22240
No related branches found
No related tags found
No related merge requests found
......@@ -305,12 +305,12 @@ class Scene {
vec3 La;
public:
void build() {
vec3 eye = vec3(0, 3.0f, 3.0f), vup = vec3(0, 0, 1), lookat = vec3(0, 0, 0);
vec3 eye = vec3(0.0, 1.8f, 0.0f), vup = vec3(0, 0, 1), lookat = vec3(0, 0, 0);
float fov = 80 * M_PI / 180;
camera.set(eye, lookat, vup, fov);
//LIGHTING
La = vec3(0.2f, 0.2f, 0.8f);
La = vec3(0.2f, 0.2f, 0.4f);
vec3 lightDirection(3, 2, 2), Le(1, 1, 1);
lights.push_back(new Light(lightDirection, Le));
......@@ -335,8 +335,10 @@ public:
roomEllipsoid->intersectors.push_back(topHolePlane);
//BUILDING THE LIGHT "TUBE"
Quadric *lightTube = new Hyperboloid(0.5f, 0.5f, 0.65f, materialSilver);
Quadric *lightTube = new Hyperboloid(0.6f, 0.6f, 0.3f, materialSilver);
lightTube->Scale(1,1,10.0f);
lightTube->intersectors.push_back(new Plane(vec3(0.0f, 0.0f, 0.95f), vec3(0.0f, 0.0f, -1.0f), materialCylinder));
lightTube->intersectors.push_back(new Plane(vec3(0.0f, 0.0f, 4.0f), vec3(0.0f, 0.0f, 1.0f), materialCylinder));
// BULDING THE BLUE CYLINDER
Quadric *cylinder = new Cylinder(0.4f, 0.4f, materialCylinder);
......@@ -356,11 +358,11 @@ public:
vial->Translate(0.8f, 0.3f, 0.0f);
// INSERTING THE OBJECTS INTO THE ROOM
//objects.push_back(roomEllipsoid);
objects.push_back(roomEllipsoid);
objects.push_back(lightTube);
//objects.push_back(cylinder);
//objects.push_back(paraboloid);
//objects.push_back(vial);
objects.push_back(cylinder);
objects.push_back(paraboloid);
objects.push_back(vial);
// objects.push_back(new Sphere(vec3(0,0,0), 0.1f, materialCylinder));
}
......@@ -401,6 +403,7 @@ public:
if (hit.material->type == ROUGH) {
outRadiance = hit.material->ka * La;
for (Light *light : lights) {
// TODO: sampling points from the hole on the top of the room
Ray shadowRay(hit.position + hit.normal * epsilon, light->direction);
float cosTheta = dot(hit.normal, light->direction);
if (cosTheta > 0 && !shadowIntersect(shadowRay)) { // shadow computation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment