Skip to content

Commit

Permalink
Switch to use the official nerfacc (add support for alpha rendering f…
Browse files Browse the repository at this point in the history
…rom v0.2.2).
  • Loading branch information
bennyguo committed Nov 1, 2022
1 parent ce45762 commit 5e66596
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ This repository contains a concise and extensible implementation of NeRF and Neu
### Environments
- Install PyTorch>=1.10 [here](https://pytorch.org/get-started/locally/) based the package management tool you used and your cuda version (older PyTorch versions may work but have not been tested)
- Install tiny-cuda-nn PyTorch extension: `pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch`
- Install my fork of nerfacc (with support for NeuS training): `pip install git+https://github.com/bennyguo/nerfacc/`
- `pip install -r requirements.txt`


Expand Down
2 changes: 1 addition & 1 deletion models/nerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def rgb_sigma_fn(t_starts, t_ends, ray_indices):
)

rgb, opacity, depth = rendering(
rgb_sigma_fn,
packed_info,
t_starts,
t_ends,
rgb_sigma_fn=rgb_sigma_fn,
render_bkgd=self.background_color
)

Expand Down
8 changes: 4 additions & 4 deletions models/neus.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from models.base import BaseModel
from models.utils import chunk_batch
from systems.utils import update_module_step
from nerfacc import ContractionType, OccupancyGrid, ray_marching_alpha, rendering_alpha
from nerfacc import ContractionType, OccupancyGrid, ray_marching, rendering


class VarianceNetwork(nn.Module):
Expand Down Expand Up @@ -121,7 +121,7 @@ def rgb_alpha_fn(t_starts, t_ends, ray_indices):
return rgb, alpha[...,None]

with torch.no_grad():
packed_info, t_starts, t_ends = ray_marching_alpha(
packed_info, t_starts, t_ends = ray_marching(
rays_o, rays_d,
scene_aabb=self.scene_aabb,
grid=self.occupancy_grid if self.config.grid_prune else None,
Expand All @@ -133,11 +133,11 @@ def rgb_alpha_fn(t_starts, t_ends, ray_indices):
alpha_thre=0.0
)

rgb, opacity, depth = rendering_alpha(
rgb_alpha_fn,
rgb, opacity, depth = rendering(
packed_info,
t_starts,
t_ends,
rgb_alpha_fn=rgb_alpha_fn,
render_bkgd=self.background_color,
)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pytorch-lightning==1.7.7
omegaconf==2.2.3
nerfacc==0.2.2
matplotlib
opencv-python
imageio
Expand Down

0 comments on commit 5e66596

Please sign in to comment.