pub struct HashField {
pub grid: HashGrid,
/* private fields */
}Expand description
Instant-NGP style neural field: multi-resolution hash grid + 2-layer MLP.
Architecture:
- HashGrid query →
[n_levels * F]features - Concat with
dir_enc→[(n_levels*F) + dir_enc_dim] - Linear + ReLU →
hidden_dim - Linear →
(1 + color_dim) - sigma = ReLU(output[0]), color_feat = output[1..]
Fields§
§grid: HashGridMulti-resolution hash grid.
Implementations§
Source§impl HashField
impl HashField
Sourcepub fn new(
grid_cfg: HashGridConfig,
hidden_dim: usize,
dir_enc_dim: usize,
color_dim: usize,
rng: &mut LcgRng,
) -> NerfResult<Self>
pub fn new( grid_cfg: HashGridConfig, hidden_dim: usize, dir_enc_dim: usize, color_dim: usize, rng: &mut LcgRng, ) -> NerfResult<Self>
Sourcepub fn forward(
&self,
xyz: [f32; 3],
dir_enc: &[f32],
) -> NerfResult<(f32, Vec<f32>)>
pub fn forward( &self, xyz: [f32; 3], dir_enc: &[f32], ) -> NerfResult<(f32, Vec<f32>)>
Query the hash field at a 3D world point with encoded view direction.
Returns (sigma: f32, color_feat: Vec<f32>) where color_feat has color_dim elements.
§Errors
Returns DimensionMismatch if dir_enc.len() != dir_enc_dim.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HashField
impl RefUnwindSafe for HashField
impl Send for HashField
impl Sync for HashField
impl Unpin for HashField
impl UnsafeUnpin for HashField
impl UnwindSafe for HashField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more