raymarch from cube edge, not from the camera

This commit is contained in:
TÁNCZOS Vilmos Zsombor 2025-05-31 23:57:39 +02:00
parent 28bd6b2580
commit f33f74230e

View file

@ -89,7 +89,7 @@ fn fragment(
) -> FragmentOutput {
var in = vertex_output;
let ray_origin = view.world_position;
let ray_origin = in.world_position.xyz;
let ray_direction = normalize(in.world_position.xyz - view.world_position);
let local_origin = (volu_material.model_inverse * vec4<f32>(ray_origin, 1.0)).xyz;
@ -100,7 +100,7 @@ fn fragment(
var out: FragmentOutput;
if t > 0.0 {
let local_hit_point = ray_origin + t * ray_direction;
let local_hit_point = local_origin + t * local_direction;
let local_normal = mandelbulb_normal(local_hit_point);
let world_hit_point = (transpose(volu_material.model_inverse) * vec4<f32>(local_hit_point, 1.0)).xyz;