get some more variables from storage

This commit is contained in:
TÁNCZOS Vilmos Zsombor 2025-05-31 23:35:57 +02:00
parent 803daf17ff
commit fcd09c1d1d
3 changed files with 58 additions and 17 deletions

View file

@ -10,6 +10,10 @@ struct VoluMaterial {
model_inverse: mat4x4<f32>,
power: f32,
iterations: i32,
max_distance: f32,
max_steps: i32,
ray_epsilon: f32,
normal_epsilon: f32,
}
@group(2) @binding(100)
@ -47,7 +51,7 @@ fn mandelbulb_sdf(p: vec3<f32>) -> f32 {
}
fn mandelbulb_normal(p: vec3<f32>) -> vec3<f32> {
let e = 0.001;
let e = volu_material.normal_epsilon;
let dx = mandelbulb_sdf(p + vec3<f32>(e, 0.0, 0.0)) - mandelbulb_sdf(p - vec3<f32>(e, 0.0, 0.0));
let dy = mandelbulb_sdf(p + vec3<f32>(0.0, e, 0.0)) - mandelbulb_sdf(p - vec3<f32>(0.0, e, 0.0));
let dz = mandelbulb_sdf(p + vec3<f32>(0.0, 0.0, e)) - mandelbulb_sdf(p - vec3<f32>(0.0, 0.0, e));
@ -56,9 +60,9 @@ fn mandelbulb_normal(p: vec3<f32>) -> vec3<f32> {
fn raymarch(ray_origin: vec3<f32>, ray_direction: vec3<f32>) -> f32 {
var t = 0.0;
let max_distance = 100.0;
let max_steps = 128;
let epsilon = 0.001;
let max_distance = volu_material.max_distance;
let max_steps = volu_material.max_steps;
let epsilon = volu_material.ray_epsilon;
for (var i = 0; i < max_steps; i++) {
let current_pos = ray_origin + t * ray_direction;