diff --git a/.idea/PathTracing.iml b/.idea/PathTracing.iml index 0b154a1..f58f256 100644 --- a/.idea/PathTracing.iml +++ b/.idea/PathTracing.iml @@ -2,7 +2,7 @@ - + diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..579ee6c --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 85ef79a..8d1bcfc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d100556..730a090 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,14 +1,7 @@ - - - - - - - - + - - - - - - - - + + + + + + + + + + + - - + + - - + + - + - - + + - - - - - + + + - - + + - - - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + - - + + + + + + + + + - - + + + + + + + + + + + + @@ -130,6 +138,9 @@ prin local iluminação difusa + 0.00319, 1.0, 0.0078 + inter + inters @@ -141,13 +152,14 @@ @@ -158,10 +170,9 @@ DEFINITION_ORDER - @@ -178,27 +189,27 @@ - + - - - - @@ -214,6 +225,7 @@ + @@ -550,6 +562,9 @@ + + + @@ -604,16 +619,16 @@ - - + + - + - + @@ -635,9 +650,9 @@ - + - + @@ -650,6 +665,14 @@ + + + + @@ -669,29 +692,13 @@ - - - - - - - - - - - - - - - - - - - + + + @@ -706,17 +713,14 @@ - - - - + - + @@ -758,9 +762,6 @@ - - - @@ -778,7 +779,9 @@ - + + + @@ -808,7 +811,9 @@ - + + + @@ -816,9 +821,6 @@ - - - @@ -855,7 +857,9 @@ - + + + @@ -863,9 +867,6 @@ - - - @@ -901,15 +902,17 @@ - - + + + + - + @@ -925,46 +928,51 @@ - + + + - + + - + - + - - + + - + - + - + + - - + + - + - - + + + @@ -972,26 +980,33 @@ - + - - + + + - + - - + + + - - - + + + + + + + + - + @@ -999,70 +1014,52 @@ - + - - - - - + + + - + - - + + - + - - + + - + - - - - - + + + - - - - - - - - - + + + - - + + - - - - - - - - \ No newline at end of file diff --git a/Algebra.py b/Algebra.py index 60e0ff6..926ef93 100644 --- a/Algebra.py +++ b/Algebra.py @@ -6,11 +6,14 @@ ######################################### # Modules -from math import sqrt, cos, sin +from math import sqrt, cos, sin, cos +from random import uniform +PI = 3.1415926535897932384 # -------------------------------------------------Vector3D class class Vector3D: + # Initializer def __init__(self, x_element, y_element, z_element): self.x = x_element @@ -76,6 +79,12 @@ def sample_direction(u1, u2): phi = 6.24 * u2 # Azimuth theta = sqrt(max(0.0, 1.0 - z * z)) + R1 = uniform(0,1) + R2 = uniform(0,1) + + #phi = 1/cos(sqrt(R1)) + #theta = 2*PI*R2 + p = Vector3D p.x = theta * cos(phi) p.y = theta * sin(phi) @@ -109,8 +118,8 @@ def local_color(obj, hit_normal, ray, ambient): color = obj.color # Iluminação ambiente - ia = ambient * float(obj.ka) - color = color + (RGBColour(ia, ia, ia)) + ia = BLACK + color = color + ia # Iluminação difusa p1 = Normalize(flip_direction(ray.d)) @@ -122,9 +131,14 @@ def local_color(obj, hit_normal, ray, ambient): if (Length(hit_normal) != 1): p2 = Normalize(hit_normal) - lv = 1.0 * float(obj.kd) * Dot(p1, p2) + angulo = Dot(p1, p2) - color = color + (RGBColour(lv, lv, lv)) + if (angulo < 0) : + angulo * -1 + + lv = (obj.color) * (angulo * float(obj.kd)) + + color = color + lv # Iluminação especular p1 = Vector3D(p1.x * (-1), p1.y, p1.z) @@ -143,9 +157,14 @@ def local_color(obj, hit_normal, ray, ambient): return color def tonemapping(pixel, tmapping): - pixel.r = pixel.r / (pixel.r + tmapping) - pixel.g = pixel.g / (pixel.g + tmapping) - pixel.b = pixel.b / (pixel.b + tmapping) + if 0.9999 < pixel.r > 1.0001 : + pixel.r = pixel.r / (pixel.r + tmapping) + + if 0.9999 < pixel.g > 1.0001 : + pixel.g = pixel.g / (pixel.g + tmapping) + + if 0.9999 < pixel.b > 1.0001 : + pixel.b = pixel.b / (pixel.b + tmapping) # -------------------------------------------------Ray class class Ray: diff --git a/Camera.py b/Camera.py index fd12c93..01d83bc 100644 --- a/Camera.py +++ b/Camera.py @@ -93,7 +93,7 @@ def render(self, integrator, file_name, depth, tmapping): sp_x = (x + random()) - (self.width / 2.0) sp_y = (y + random()) - (self.height / 2.0) ray.d = self.get_direction(sp_x, sp_y) - pixel = pixel + integrator.trace_ray(ray, depth) + pixel = pixel + integrator.trace_ray(ray, depth, 1.0) pixel = pixel / self.spp tonemapping(pixel, tmapping) self.save_pixel(pixel, x, y) diff --git a/PathTraceIntegrator.py b/PathTraceIntegrator.py index 0b54da1..7170c1d 100644 --- a/PathTraceIntegrator.py +++ b/PathTraceIntegrator.py @@ -2,9 +2,9 @@ from Algebra import BLACK, Vector3D, Cross, Normalize, Length, Dot, local_color, Ray, flip_direction, random_direction, WHITE from objetos import Objeto, Light, ObjectQuadric import random +from math import sqrt from math import pow - class PathTraceIntegrator: background = BLACK # Cor do Background ambient = 0.5 @@ -15,16 +15,31 @@ def __init__(self): #trace light path - def trace_ray(self, ray, depth): + def trace_ray(self, ray, depth, nRefractedInitial): difuso = BLACK especular = BLACK + refletido = BLACK + transmitido = BLACK + self.nRefractedInitial = nRefractedInitial + temLuz = 1 + result = BLACK # Checando interseções com cada objeto dist = 100 + dist2 = 100 + dist3 = 100 hit = False + hit2 = False + hit3 = False objeto = 1 hit_point = Vector3D(0.0, 0.0, 0.0) + hit_point2 = Vector3D(0.0, 0.0, 0.0) + hit_point3 = Vector3D(0.0, 0.0, 0.0) normal = Vector3D(0.0, 0.0, 0.0) + normal2 = Vector3D(0.0, 0.0, 0.0) + normal3 = Vector3D(0.0, 0.0, 0.0) + objeto2 = 0.0 + objeto3 = 0.0 for obj in self.obj_list: inter = obj.intersect(ray) @@ -42,8 +57,43 @@ def trace_ray(self, ray, depth): if isinstance(objeto, Light): return objeto.color else: - result = local_color(objeto, normal, ray, self.ambient) + if depth == 1 : + for l in range (0, 9): + lx = random.uniform(-0.9100, 0.9100) + lz = random.uniform(-23.3240, -26.4880) + shadow_ray2 = Ray(Vector3D(hit_point.x, hit_point.y, hit_point.z), Vector3D(lx, 3.8360, lz)) + shadow_ray2.d = Vector3D(shadow_ray2.d.x - hit_point.x, shadow_ray2.d.y - hit_point.y, + shadow_ray2.d.z - hit_point.z) + shadow_ray2.d = Normalize(shadow_ray2.d) + for obj3 in self.obj_list: + inter3 = obj3.intersect(shadow_ray2) + tmp_hit3 = inter3[0] + distance3 = inter3[1] + + if tmp_hit3 and distance3 < dist3: + dist3 = distance3 + objeto3 = obj3 + hit3 = tmp_hit3 + hit_point3 = inter3[2] + normal3 = inter3[3] + temLuz = 0 + if hit3: ## Se o raio bateu no objeto calculamos a cor do ponto + if isinstance(objeto3, Light): + temLuz = 1 + + if temLuz == 0.0: + #if objeto.color == objeto3.color: + # result = local_color(objeto, normal, ray, self.ambient) + # break + pass + else: + result = local_color(objeto, normal, ray, self.ambient) + break + else: + result = local_color(objeto, normal, ray, self.ambient) + else: + return self.background @@ -51,23 +101,170 @@ def trace_ray(self, ray, depth): ktot = obj.kd + obj.ks + obj.kt aleatorio = random.random()*ktot - if depth > 0: if aleatorio < obj.kd: ## Raio Difuso x = random.random() y = random.random() dir = random_direction(x, y, normal) + #dir2 = Normalize(dir) + + # shadow ray + lx = random.uniform(-0.9100, 0.9100) + lz = random.uniform(-23.3240, -26.4880) + shadow_ray = Ray(Vector3D(dir.x, dir.y, dir.z), Vector3D(lx, 3.8360, lz)) + shadow_ray.d = Vector3D(shadow_ray.d.x - dir.x, shadow_ray.d.y - dir.y, + shadow_ray.d.z - dir.z) + shadow_ray.d = Normalize(shadow_ray.d) + for obj2 in self.obj_list: + inter2 = obj2.intersect(shadow_ray) + tmp_hit2 = inter2[0] + distance2 = inter2[1] - new_ray = Ray(hit_point, Normalize(dir)) - difuso = self.trace_ray(new_ray, depth - 1) + if tmp_hit2 and distance2 < dist2: + dist2 = distance2 + objeto2 = obj2 + hit2 = tmp_hit2 + hit_point2 = inter2[2] + normal2 = inter2[3] + temLuz = 0 + if hit2: ## Se o raio bateu no objeto calculamos a cor do ponto + if isinstance(objeto2, Light): + temLuz = 1 + + if temLuz==0: + difuso = BLACK + #else: + #new_ray = Ray(hit_point, Normalize(dir)) + #difuso = self.trace_ray(new_ray, depth - 1, objeto.kt) + #difuso = difuso * objeto2.kt + else: + new_ray = Ray(hit_point, Normalize(dir)) + difuso = self.trace_ray(new_ray, depth - 1, objeto.kt) elif aleatorio < obj.kd + obj.ks: # ## Raio especular L = Normalize(flip_direction(ray.d)) N = objeto.normal R = (N * (Dot(N, L)) - L) * 2.0 + #R2 = Normalize(R) + + # shadow ray + lx = random.uniform(-0.9100, 0.9100) + lz = random.uniform(-23.3240, -26.4880) + shadow_ray = Ray(Vector3D(R.x, R.y, R.z), Vector3D(lx, 3.8360, lz)) + shadow_ray.d = Vector3D(shadow_ray.d.x - R.x, shadow_ray.d.y - R.y, + shadow_ray.d.z - R.z) + shadow_ray.d = Normalize(shadow_ray.d) + for obj2 in self.obj_list: + inter2 = obj2.intersect(shadow_ray) + tmp_hit2 = inter2[0] + distance2 = inter2[1] - new_ray = Ray(hit_point, Normalize(R)) - especular = self.trace_ray(new_ray, depth - 1) + if tmp_hit2 and distance2 < dist2: + dist2 = distance2 + objeto2 = obj2 + hit2 = tmp_hit2 + hit_point2 = inter2[2] + normal2 = inter2[3] + temLuz = 0 + if hit2: ## Se o raio bateu no objeto calculamos a cor do ponto + if isinstance(objeto2, Light): + temLuz = 1 + + if temLuz == 0.0: + if objeto2.kt == 0: + especular = BLACK + else: + new_ray = Ray(hit_point, Normalize(R)) + especular = self.trace_ray(new_ray, depth - 1, objeto.kt) + #especular = especular * objeto2.kt + else: + new_ray = Ray(hit_point, Normalize(R)) + especular = self.trace_ray(new_ray, depth - 1, objeto.kt) else: ## Raio Transmitido - pass + if (objeto.kt > 0): + L = Normalize(ray.d) + N = objeto.normal + if Length(N) != 1: + N = Normalize(N) + cos1 = Dot(N, flip_direction(L)) + refletido = L + (N * (2 * cos1)) + #refletido2 = Normalize(refletido) + + # shadow ray + lx = random.uniform(-0.9100, 0.9100) + lz = random.uniform(-23.3240, -26.4880) + shadow_ray = Ray(Vector3D(refletido.x, refletido.y, refletido.z), Vector3D(lx, 3.8360, lz)) + shadow_ray.d = Vector3D(shadow_ray.d.x - refletido.x, shadow_ray.d.y - refletido.y, + shadow_ray.d.z - refletido.z) + shadow_ray.d = Normalize(shadow_ray.d) + for obj2 in self.obj_list: + inter2 = obj2.intersect(shadow_ray) + tmp_hit2 = inter2[0] + distance2 = inter2[1] + + if tmp_hit2 and distance2 < dist2: + dist2 = distance2 + objeto2 = obj2 + hit2 = tmp_hit2 + hit_point2 = inter2[2] + normal2 = inter2[3] + temLuz = 0 + if hit2: ## Se o raio bateu no objeto calculamos a cor do ponto + if isinstance(objeto2, Light): + temLuz = 1 + + if temLuz == 0: + if objeto2.kt == 0.0: + refletido = BLACK + else: + new_rayReflected = Ray(hit_point, Normalize(refletido)) + refletido = self.trace_ray(new_rayReflected, depth - 1, objeto.kt) + #refletido = refletido * objeto2.kt + else: + new_rayReflected = Ray(hit_point, Normalize(refletido)) + refletido = self.trace_ray(new_rayReflected, depth - 1, objeto.kt) + + delta = 1-((pow(1.33/objeto.kt,2))*(1-(pow(cos1,2)))) + if (delta >= 0): + cos2 = sqrt(delta) + divisao = nRefractedInitial / objeto.kt + nRefractedInitial = objeto.kt + if (cos1 > 0) : + transmitido = (L * divisao) + (N * ((divisao * cos1) - cos2)) + #transmitido2 = Normalize(transmitido) + else: + transmitido = (L * divisao) + (N * ((divisao * cos1) + cos2)) + #transmitido2 = Normalize(transmitido) + + # shadow ray + shadow_ray = Ray(Vector3D(transmitido.x, transmitido.y, transmitido.z), Vector3D(lx, 3.8360, lz)) + shadow_ray.d = Vector3D(shadow_ray.d.x - transmitido.x, shadow_ray.d.y - transmitido.y, + shadow_ray.d.z - transmitido.z) + shadow_ray.d = Normalize(shadow_ray.d) + for obj2 in self.obj_list: + inter2 = obj2.intersect(shadow_ray) + tmp_hit2 = inter2[0] + distance2 = inter2[1] + + if tmp_hit2 and distance2 < dist2: + dist2 = distance2 + objeto2 = obj2 + hit2 = tmp_hit2 + hit_point2 = inter2[2] + normal2 = inter2[3] + temLuz = 0 + if hit2: ## Se o raio bateu no objeto calculamos a cor do ponto + if isinstance(objeto2, Light): + temLuz = 1 + + if temLuz == 0: + if objeto2.kt == 0.0: + transmitido = BLACK + else: + new_ray = Ray(hit_point, Normalize(transmitido)) + transmitido = self.trace_ray(new_ray, depth - 1, objeto.kt) + #transmitido = transmitido * objeto2.kt + else: + new_ray = Ray(hit_point, Normalize(transmitido)) + transmitido = self.trace_ray(new_ray, depth-1, objeto.kt) - return result + difuso*objeto.trans_difusa + especular*objeto.trans_especular + return result + difuso * objeto.kd + especular * objeto.ks + refletido + transmitido * objeto.kt diff --git a/Photon.py b/Photon.py new file mode 100644 index 0000000..4530d5f --- /dev/null +++ b/Photon.py @@ -0,0 +1,11 @@ +from Algebra import Vector3D + +class Photon: + + def __init__(self, posicao, reflectPower, transmitPower, direcaoPhi, direcaoTheta): + + self.posicao = posicao + self.reflectPower = reflectPower + self.transmitPower = transmitPower + self.direcaoPhi = direcaoPhi + self.direcaoTheta = direcaoTheta diff --git a/PhotonMappingIntegrator.py b/PhotonMappingIntegrator.py new file mode 100644 index 0000000..66c0725 --- /dev/null +++ b/PhotonMappingIntegrator.py @@ -0,0 +1,57 @@ +from Algebra import Vector3D +from math import sqrt, cos, pi +from random import uniform +import Photon + +class PhotonMappingIntegrator: + numeroPhotons = 2.0 + contador = 0 + depthOriginal = 4 + + # Initializer - creates object list + def __init__(self): + self.obj_list = [] + self.photons_list = [] + + #photon path + def photon_ray(self, ray, depth): + + # Checando interseções com cada objeto + dist = 100 + hit = False + objeto = 1 + hit_point = Vector3D(0.0, 0.0, 0.0) + normal = Vector3D(0.0, 0.0, 0.0) + + for n in self.numeroPhotons : + + for obj in self.obj_list: + + # setado com os valores da fonte de luz para o primeiro caso + if self.depth == 4 : + inter = obj.intersect(-0.9100, 3.8360 -23.3240), (0.0, -1.0, 0.0) + else: + inter = obj.intersect(ray) + + tmp_hit = inter[0] + distance = inter[1] + + if tmp_hit and distance < dist: + dist = distance + objeto = obj + hit = tmp_hit + hit_point = inter[2] + normal = inter[3] + + if hit: ## Se o raio bateu no objeto adicionamos o photon a estrutura de dados + R1 = uniform(0.0, 1.0) + R2 = uniform(0.0, 1.0) + direcaoPhi = 1/cos(sqrt(R1)) + direcaoTheta = 2*pi*R2 + R = 1.0 + T = 1.0 + self.photons_list[self.contador] = Photon(hit_point, R*1.0/self.numeroPhotons, T*1.0/self.numeroPhotons, direcaoPhi, direcaoTheta) + self.contador = self.contador +1 + + # chamar raio secundário + # http://www.cs.cmu.edu/afs/cs/academic/class/15462-s12/www/lec_slides/lec18.pdf \ No newline at end of file diff --git a/__pycache__/Algebra.cpython-35.pyc b/__pycache__/Algebra.cpython-35.pyc index ad09017..4db8c77 100644 Binary files a/__pycache__/Algebra.cpython-35.pyc and b/__pycache__/Algebra.cpython-35.pyc differ diff --git a/__pycache__/Camera.cpython-35.pyc b/__pycache__/Camera.cpython-35.pyc index 7a916e1..f256e91 100644 Binary files a/__pycache__/Camera.cpython-35.pyc and b/__pycache__/Camera.cpython-35.pyc differ diff --git a/__pycache__/PathTraceIntegrator.cpython-35.pyc b/__pycache__/PathTraceIntegrator.cpython-35.pyc index 974f38b..f9cca2e 100644 Binary files a/__pycache__/PathTraceIntegrator.cpython-35.pyc and b/__pycache__/PathTraceIntegrator.cpython-35.pyc differ diff --git a/__pycache__/helper.cpython-35.pyc b/__pycache__/helper.cpython-35.pyc index 84cee08..c100fe5 100644 Binary files a/__pycache__/helper.cpython-35.pyc and b/__pycache__/helper.cpython-35.pyc differ diff --git a/__pycache__/main.cpython-35.pyc b/__pycache__/main.cpython-35.pyc index 6988764..77efd0c 100644 Binary files a/__pycache__/main.cpython-35.pyc and b/__pycache__/main.cpython-35.pyc differ diff --git a/__pycache__/objetos.cpython-35.pyc b/__pycache__/objetos.cpython-35.pyc index 83e1bc5..c070011 100644 Binary files a/__pycache__/objetos.cpython-35.pyc and b/__pycache__/objetos.cpython-35.pyc differ diff --git a/cornell.pnm b/cornell.pnm index becec60..f38ccfb 100644 Binary files a/cornell.pnm and b/cornell.pnm differ diff --git a/helper.py b/helper.py index 7c8d77d..fc019d5 100644 --- a/helper.py +++ b/helper.py @@ -53,8 +53,6 @@ def object(self, values): ks = float(values[6]) kt = float(values[7]) n = int(values[8]) - trans_difusa = float(values[9]) - trans_especular = float(values[10]) obj_list = [] @@ -63,7 +61,7 @@ def object(self, values): B = vertices[f[1] - 1] C = vertices[f[2] - 1] - obj = Objeto(A, B, C, cor, ka, kd, ks, kt, n, trans_difusa, trans_especular) + obj = Objeto(A, B, C, cor, ka, kd, ks, kt, n) obj_list.append(obj) return obj_list @@ -114,12 +112,15 @@ def objectquadric(self, values): ks = float(values[15]) kt = float(values[16]) n = int(values[17]) - trans_difusa = float(values[18]) - trans_especular = int(values[19]) - quad = Objeto(a, b, c, d, e, f, g, h, j, k, cor, ka, kd, ks, kt, n, trans_difusa, trans_especular) - - return quad + # escrevi só pra não dá erro no arquivo de leitura + A = Vector3D(d - g, 0.0, 0.0) + B = Vector3D(0.0, e - h, 0.0) + C = Vector3D(0.0, 0.0, f - j) + quad_list = [] + quad = Objeto(A, B, C, cor, ka, kd, ks, kt, n) + quad_list.append(quad) + return quad_list # Retorna a string contendo o nome do arquivo de saida def output(self,values): @@ -129,7 +130,7 @@ def output(self,values): def __get_faces(self, name): faces = [] - f = open ('.\src\\' + name, 'r') + f = open ('./src//' + name, 'r') for line in f: # Pulando linhas em branco @@ -154,7 +155,7 @@ def __get_vertices(self, name): vertices = [] faces = [] - f = open ('.\src\\' + name, 'r') + f = open ('./src//' + name, 'r') for line in f: # Pulando linhas em branco @@ -196,4 +197,4 @@ def read(t, values): # Chamamos a função com nome read_ + tipo do valor a ser lido(object, light, eye...) func = getattr(read, t) result = func(values) - return result \ No newline at end of file + return result diff --git a/main.py b/main.py index 396eee7..bcae048 100644 --- a/main.py +++ b/main.py @@ -9,10 +9,10 @@ print("Lendo Arquivos de configuração e Objetos") -file = ".\src\cornellroom.sdl" +file = "./src/cornellroom.sdl" DIRECTORY = './' # alterar de acordo com computador -obj_types_list = ['object','quad', 'light'] +obj_types_list = ['object','quad', 'light', 'objectquadric'] prop_types_list = ['eye', 'size', 'ortho', 'background', 'ambient', 'tonemapping', 'npaths', 'seed', 'output', 'deepth'] obj_list = [] # Lista de objetos a serem redenrizados @@ -49,7 +49,7 @@ #Create Camera eye = Vector3D(prop_dict['eye'][0], prop_dict['eye'][1], prop_dict['eye'][2]) #higher z = more narrow view focal = Vector3D(0.0, 0.0, 0.0) -view_distance = 1000 +view_distance = 600 up = Vector3D(0.0, 1.0, 0.0) height = int(prop_dict['size'][0]) width = int(prop_dict['size'][1]) diff --git a/objetos.py b/objetos.py index 6ab9fe6..8cb25b6 100644 --- a/objetos.py +++ b/objetos.py @@ -7,7 +7,7 @@ class Objeto: area = 0.0 - def __init__(self, A, B, C, color, ka, kd,ks, kt, n, trans_difusa, trans_especular): + def __init__(self, A, B, C, color, ka, kd,ks, kt, n): """ :param vertices - lista de vertices: :param faces: lista de Faces @@ -28,8 +28,6 @@ def __init__(self, A, B, C, color, ka, kd,ks, kt, n, trans_difusa, trans_especul self.ks = ks self.kt = kt self.n = n - self.trans_difusa = trans_difusa - self.trans_especular = trans_especular def intersect(self, ray): @@ -163,7 +161,7 @@ def intersect(self, ray): class ObjectQuadric(): def __init__(self, a, b, c, d, e, f, g, h, j, k, color, ka, - kd, ks, kt, n, trans_difusa, trans_especular): + kd, ks, kt, n): self.a = a self.b = b self.c = c @@ -180,8 +178,6 @@ def __init__(self, a, b, c, d, e, f, g, h, j, k, color, ka, self.ks = ks self.kt = kt self.n = n - self.trans_difusa = trans_difusa - self.trans_especular = trans_especular def intersect(self, ray): d = ray.d - ray.o diff --git a/src/cornellroom.sdl b/src/cornellroom.sdl index 7d01573..4dece9c 100644 --- a/src/cornellroom.sdl +++ b/src/cornellroom.sdl @@ -6,7 +6,7 @@ # do Vinicius 6/12/2005 eye 0.0 0.0 5.7 -size 450 350 +size 200 200 ortho -1 -1 1 1 background 0.0 0.0 0.0 ambient 0.5 @@ -14,9 +14,9 @@ ambient 0.5 # Luz branca retangulo no centro do teto light luzcornell.obj 1.0 1.0 1.0 1.0 -npaths 10 -deepth 2 -tonemapping 10 +npaths 1 +deepth 1 +tonemapping 1.0 seed 9 # Aqui comeca a definicao das geometrias @@ -29,25 +29,28 @@ seed 9 # object red green blue ka kd ks kt n trans_difusa trans_especular # left wall RED -object leftwall.obj 1.0 0.0 0.0 0.3 0.7 0 0 5 1.0 0.0 +object leftwall.obj 1.0 0.0 0.0 0.3 0.7 0 0 5 # right wall GREEN -object rightwall.obj 0.0 1.0 0.0 0.3 0.7 0 0 5 1.0 0.0 +object rightwall.obj 0.0 1.0 0.0 0.3 0.7 0 0 5 # floor WHITE -object floor.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 0.5 0.5 +object floor.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 # back wall WHITE -object back.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 0.5 0.5 +object back.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 # ceiling WHITE -object ceiling.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 0.5 0.5 +object ceiling.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 # cube 1 WHITE -object cube1.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 0.5 0.5 +object cube1.obj 0.5 0.5 0.0 0.8 0.7 0 0 5 # cube 2 WHITE -object cube2.obj 1.0 1.0 1.0 0.3 0.7 0 0 5 0.5 0.5 +object cube2.obj 0.1 0.7 0.4 0.8 0.7 0 0 5 + +# objectquadric RED a b c d e f g h j k red green blue ka kd ks kt n +# objectquadric 1 1 1 0 0 0 0 5 10 -200 1.0 0.0 0.0 1.0 1.0 1.0 1.0 5 output cornell.pnm