fix training light dir
Browse files- main.py +1 -1
- nerf/renderer.py +2 -2
main.py
CHANGED
@@ -70,8 +70,8 @@ if __name__ == '__main__':
|
|
70 |
|
71 |
if opt.O:
|
72 |
opt.fp16 = True
|
73 |
-
opt.cuda_ray = True
|
74 |
opt.dir_text = True
|
|
|
75 |
elif opt.O2:
|
76 |
opt.fp16 = True
|
77 |
opt.dir_text = True
|
|
|
70 |
|
71 |
if opt.O:
|
72 |
opt.fp16 = True
|
|
|
73 |
opt.dir_text = True
|
74 |
+
opt.cuda_ray = True
|
75 |
elif opt.O2:
|
76 |
opt.fp16 = True
|
77 |
opt.dir_text = True
|
nerf/renderer.py
CHANGED
@@ -323,7 +323,7 @@ class NeRFRenderer(nn.Module):
|
|
323 |
# random sample light_d if not provided
|
324 |
if light_d is None:
|
325 |
# gaussian noise around the ray origin, so the light always face the view dir (avoid dark face)
|
326 |
-
light_d =
|
327 |
light_d = safe_normalize(light_d)
|
328 |
|
329 |
#print(f'nears = {nears.min().item()} ~ {nears.max().item()}, fars = {fars.min().item()} ~ {fars.max().item()}')
|
@@ -457,7 +457,7 @@ class NeRFRenderer(nn.Module):
|
|
457 |
# random sample light_d if not provided
|
458 |
if light_d is None:
|
459 |
# gaussian noise around the ray origin, so the light always face the view dir (avoid dark face)
|
460 |
-
light_d =
|
461 |
light_d = safe_normalize(light_d)
|
462 |
|
463 |
results = {}
|
|
|
323 |
# random sample light_d if not provided
|
324 |
if light_d is None:
|
325 |
# gaussian noise around the ray origin, so the light always face the view dir (avoid dark face)
|
326 |
+
light_d = (rays_o[0] + torch.randn(3, device=device, dtype=torch.float))
|
327 |
light_d = safe_normalize(light_d)
|
328 |
|
329 |
#print(f'nears = {nears.min().item()} ~ {nears.max().item()}, fars = {fars.min().item()} ~ {fars.max().item()}')
|
|
|
457 |
# random sample light_d if not provided
|
458 |
if light_d is None:
|
459 |
# gaussian noise around the ray origin, so the light always face the view dir (avoid dark face)
|
460 |
+
light_d = (rays_o[0] + torch.randn(3, device=device, dtype=torch.float))
|
461 |
light_d = safe_normalize(light_d)
|
462 |
|
463 |
results = {}
|