• Emilien Garreau's avatar
    Adapt RayPointRefiner and RayMarcher to support bins. · 3d011a91
    Emilien Garreau authored
    Summary:
    ## Context
    
    Bins are used in mipnerf to allow to manipulate easily intervals. For example, by doing the following, `bins[..., :-1]` you will obtain all the left coordinates of your intervals, while doing `bins[..., 1:]` is equals to the right coordinates of your intervals.
    
    We introduce here the support of bins like in MipNerf implementation.
    
    ## RayPointRefiner
    
    Small changes have been made to modify RayPointRefiner.
    - If bins is None
    
    ```
    mids = torch.lerp(ray_bundle.lengths[..., 1:], ray_bundle.lengths[…, :-1], 0.5)
    z_samples = sample_pdf(
    		mids, # [..., npt]
    		weights[..., 1:-1], # [..., npt - 1]
                   ….
                )
    ```
    
    - If bins is not None
    In the MipNerf implementation the sampling is done on all the bins. It allows us to use the full weights tensor without slashing it.
    
    ```
    z_samples = sample_pdf(
    		ray_bundle.bins, # [..., npt + 1]
    		weights, # [..., npt]
                   ...
                )
    ```
    
    ## RayMarcher
    
    Add a ray_deltas optional argument. If None, keep the same deltas computation from ray_lengths.
    
    Reviewed By: shapovalov
    
    Differential Revision: D46389092
    
    fbshipit-source-id: d4f1963310065bd31c1c7fac1adfe11cbeaba606
    3d011a91
test_ray_point_refiner.py 5.82 KB