Skip to content

Commit

Permalink
AdaPT now supports complex scene rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
Enigmatisms committed Jun 1, 2023
1 parent 742426e commit d8994e9
Show file tree
Hide file tree
Showing 5 changed files with 449 additions and 47 deletions.
2 changes: 1 addition & 1 deletion bxdf/brdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def eval_blinn_phong(self, ray_in: vec3, ray_out: vec3, normal: vec3, tex = INVA
half_way.fill(0.0)
dot_clamp = ti.max(0.0, tm.dot(half_way, normal))
glossy = tm.pow(dot_clamp, self.k_g)
cosine_term = tm.max(0.0, tm.dot(normal, ray_out))
cosine_term = ti.max(0.0, tm.dot(normal, ray_out))
# A modified Phong model (k_d + k_s should be smaller than 1, otherwise not physically plausible)
diffuse_color = ti.select(tex[0] < 0, self.k_d, tex)
return (diffuse_color + self.k_s * (0.5 * (self.k_g + 2.0) * glossy)) * INV_PI * cosine_term
Expand Down
2 changes: 1 addition & 1 deletion scene_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def render(self):
ray = self.pix2ray(i, j)
obj_id, normal, _d, _u, _v = self.ray_intersect(ray, self.cam_t[None])
if obj_id >= 0:
self.pixels[i, j].fill(ti.max(-tm.dot(ray, normal), 0.))
self.pixels[i, j].fill(ti.abs(tm.dot(ray, normal)))
else:
self.pixels[i, j].fill(0.0)

Expand Down
Loading

0 comments on commit d8994e9

Please sign in to comment.