kwea123 / ngp_pl

Instant-ngp in pytorch+cuda trained with pytorch-lightning (high quality with high speed, with only few lines of legible code)
MIT License
1.26k stars 156 forks source link

Fixing two issues in RayMarcher and VolumeRendering #133

Open jnhwkim opened 1 year ago

jnhwkim commented 1 year ago

This pull request addresses two issues that were identified in the RayMarcher and Volume Rendering code:

  1. Random Order Aggregation in RayMarcher: Previously, the samples were aggregated in random order during the forward pass. To ensure correct calculations of dL_drays_o and dL_drays_d using rays_a, I have introduced a sorting mechanism to organize the aggregation process appropriately. Although this fix can be improved using CUDA implementation, it still performs well with reasonable speed.

  2. Incorrect Gradient from Opacity: There was a problem with the gradient calculation from Opacity, which has now been rectified. The changes align the gradient calculation with the forward pass, ensuring accurate results. These fixes enhance the functionality and accuracy of the RayMarcher implementation.