Skip to content

Commit

Permalink
fix(fields): ray marching direction normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
technobaboo committed Feb 6, 2024
1 parent a280faf commit 5bbc1e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nodes/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ pub trait FieldTrait: Send + Sync + 'static {
let ray_to_field_matrix =
Spatial::space_to_space_matrix(Some(&ray.space), Some(self.spatial_ref()));
let mut ray_point = ray_to_field_matrix.transform_point3a(ray.origin.into());
let ray_direction = ray_to_field_matrix.transform_vector3a(ray.direction.into());
let ray_direction = ray_to_field_matrix
.transform_vector3a(ray.direction.into())
.normalize();

while result.ray_steps < MAX_RAY_STEPS && result.ray_length < MAX_RAY_LENGTH {
let distance = self.local_distance(ray_point);
Expand Down

0 comments on commit 5bbc1e0

Please sign in to comment.