Skip to content

Commit

Permalink
fix training light dir
Browse files Browse the repository at this point in the history
  • Loading branch information
ashawkey committed Oct 7, 2022
1 parent 6875ba9 commit a0c4308
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@

if opt.O:
opt.fp16 = True
opt.cuda_ray = True
opt.dir_text = True
opt.cuda_ray = True
elif opt.O2:
opt.fp16 = True
opt.dir_text = True
Expand Down
4 changes: 2 additions & 2 deletions nerf/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def run(self, rays_o, rays_d, num_steps=128, upsample_steps=128, light_d=None, a
# random sample light_d if not provided
if light_d is None:
# gaussian noise around the ray origin, so the light always face the view dir (avoid dark face)
light_d = - (rays_o[0] + torch.randn(3, device=device, dtype=torch.float))
light_d = (rays_o[0] + torch.randn(3, device=device, dtype=torch.float))
light_d = safe_normalize(light_d)

#print(f'nears = {nears.min().item()} ~ {nears.max().item()}, fars = {fars.min().item()} ~ {fars.max().item()}')
Expand Down Expand Up @@ -457,7 +457,7 @@ def run_cuda(self, rays_o, rays_d, dt_gamma=0, light_d=None, ambient_ratio=1.0,
# random sample light_d if not provided
if light_d is None:
# gaussian noise around the ray origin, so the light always face the view dir (avoid dark face)
light_d = - (rays_o[0] + torch.randn(3, device=device, dtype=torch.float))
light_d = (rays_o[0] + torch.randn(3, device=device, dtype=torch.float))
light_d = safe_normalize(light_d)

results = {}
Expand Down

0 comments on commit a0c4308

Please sign in to comment.