From 5353f28acde9467a9d2ecf1367dec29a09bc8654 Mon Sep 17 00:00:00 2001 From: zomseffen <steffen@tom.bi> Date: Thu, 20 Feb 2025 16:48:20 +0100 Subject: [PATCH] start of second test generator. revealed issue with neighbor linkage overwriting --- shaders/compiled/frag_rt_quad.spv | Bin 44124 -> 44228 bytes shaders/rt_quad.frag | 2 +- src/main.rs | 5 +- src/scene/empty_volume.rs | 6 +- src/scene/generators.rs | 113 ++++++++++++++++++++++++++---- src/scene/oct_tree.rs | 5 +- 6 files changed, 112 insertions(+), 19 deletions(-) diff --git a/shaders/compiled/frag_rt_quad.spv b/shaders/compiled/frag_rt_quad.spv index 9e46dcc4d26c15e13c8abc5d395d6021b6ab2395..6cb39ac357fec59ae52c44ff2fa0be971b8177d2 100644 GIT binary patch delta 14418 zcmZ9S34m2)*~brXXNG`rVT54-K{Of-$?R(pL6Q{r-O$Wz9Cbhp7#Kj&vLm^)Xciv( z$~D&#&4tKp^ApRZEHkrIQZp=DtSq%eH0}HS?mZ8__gpyh{{R2yd7t-r*K_Xj<l}?y zSwFaa$lx8?vTRT`JZsO!tZLtP>!Vw<>=>?It`oRMuIamf<e>YCsU4j=Jy6TC`OEqS zdY8@bUzBB83;!NLTQGm#$;*1?FFL7j1xjo7Y_YJTGyfx&#k~W)3ro+x!WZ_g=$YGl z;<Ek$YuB=uDn6SwM?0~90Z#h7+T>HqUWX6#EnU7~StG_96+4w|_rqnwwQO)h*vxAc z-df>9D|}cJZ_VCa9Jfv9yWZ2J*0T3i__QY8md$7>UagItbO7?A{(*(P3mVxU*yPrd z9a3!Arelx8P?z`g&z-xpk6t!L`dGA6E81MN6%}novFoUgd=-{6nk=>KTC|Ai$le5h zbB1c!%@ux2h2Pf1TeEfWQ~MVzU)a~PxPNKSibkfb*}W}U@x-VR#Y3as()B>I&l%zK zQ1Qa3&aTI?p3Lg$IlbqE{(+PFSQboQYqp`7G`h3vIjjr%PwQFnrm=2)zBnA~i>399 zCTm+ZyjVGU+@P-FiqR7%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=U|#rOo6_M9l}^ Wm_AElwpDwx2Sg`t1LAGC%ltp}n{Q|U diff --git a/shaders/rt_quad.frag b/shaders/rt_quad.frag index aca2709..848e342 100644 --- a/shaders/rt_quad.frag +++ b/shaders/rt_quad.frag @@ -377,7 +377,7 @@ vec3 get_lighting_color(uint volume_start, vec3 starting_pos, vec4 orig_color_sa uint light_num = 0; // initialize color - vec3 color_sum = vec3(0.0, 0.0, 0.0);// + (orig_color_sample.xyz * 0.01); + vec3 color_sum = vec3(0.0, 0.0, 0.0) + (orig_color_sample.xyz * 0.01); uint max_iterations = max_num_lights * max_iterations_per_light; uint iteration = 0; diff --git a/src/main.rs b/src/main.rs index 717dc60..a5923b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -223,7 +223,8 @@ impl App { image::create_texture_image_view(&device, &mut data)?; image::create_texture_sampler(&device, &mut data)?; - generators::generate_test_scene(&mut scene_handler, &mut data)?; + let cur_pos = generators::generate_test_scene(&mut scene_handler, &mut data)?; + //let cur_pos = generators::generate_test_scene2(&mut scene_handler, &mut data, 1, 1,1, 1)?; scene_handler.prepare_data(&instance, &device, &mut data)?; buffer::create_uniform_buffers(&instance, &device, &mut data)?; @@ -239,7 +240,7 @@ impl App { cam_angle_x: 0.0, cam_angle_y: 0.0, last_pos: LogicalPosition::new(-1 as f32, -1 as f32), view_direction: vertex::Vec3::new(0.0, 0.0, 0.0), - cur_pos: cgmath::point3(5.0, 5.0, 10.0), + cur_pos: cur_pos, scene_handler, show_frame_rate: false, synchronized: 0 diff --git a/src/scene/empty_volume.rs b/src/scene/empty_volume.rs index 38b690a..42474c8 100644 --- a/src/scene/empty_volume.rs +++ b/src/scene/empty_volume.rs @@ -292,11 +292,11 @@ impl EmptyVolume { for x in 0..x_size+1 { for y in 0..y_size+1 { for z in 0..z_size+1 { - //neighbors.set_element(reference.clone(), reference.borrow().position.x + x, reference.borrow().position.y + y, reference.borrow().position.z + z); + neighbors.set_element(reference.clone(), reference.borrow().position.x + x, reference.borrow().position.y + y, reference.borrow().position.z + z); // fill only the edges - if x == 0 || x == x_size || y == 0 || y == y_size || z==0 || z == z_size { + /*if x == 0 || x == x_size || y == 0 || y == y_size || z==0 || z == z_size { neighbors.set_element(reference.clone(), reference.borrow().position.x + x, reference.borrow().position.y + y, reference.borrow().position.z + z) - } + }*/ } } } diff --git a/src/scene/generators.rs b/src/scene/generators.rs index 55fd6c7..07eb61c 100644 --- a/src/scene/generators.rs +++ b/src/scene/generators.rs @@ -8,9 +8,9 @@ use crate::app_data::AppData; extern crate rand; use rand::Rng; -use anyhow::Result; +use anyhow::{Ok, Result}; -use cgmath::{vec2, vec3, Vector3}; +use cgmath::{vec2, vec3, Vector3, Point3}; use std::cell::RefCell; use std::rc::Rc; @@ -18,9 +18,9 @@ use std::rc::Rc; use super::light::{DirectionalLight, PointLight}; -pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<()> { +pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<(Point3<f32>)> { let mut rng = rand::thread_rng(); - let grid_size = CHUNK_SIZE as i32; + let grid_size = CHUNK_SIZE as i32; let mut oct_tree1: OctTree<Cube> = OctTree::create(CHUNK_SIZE)?; let mut oct_tree2: OctTree<Cube> = OctTree::create(CHUNK_SIZE)?; @@ -41,7 +41,7 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<()> let shade = (rng.gen_range(0..50) as f32) / 100.0; let cube = Cube { pos: vec3(x_index as f32, y_index as f32, 6.0), - color: vec3(shade, shade, 0.0), + color: vec3(shade, 1.0, shade), tex_coord: vec2(0.0, 0.0), transparent: false, roughness: 255, @@ -73,7 +73,7 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<()> let cube = Cube { pos: vec3(10.0, 10.0, 10.0), - color: vec3(0.9, 0.9, 0.9), + color: vec3(0.9, 0.0, 0.0), tex_coord: vec2(0.0, 0.0), transparent: true, roughness: 32, @@ -82,19 +82,19 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<()> let cube = Cube { pos: vec3(10.0, 10.0, 9.0), - color: vec3(0.9, 0.9, 0.9), + color: vec3(0.9, 0.0, 0.0), tex_coord: vec2(0.0, 0.0), transparent: true, roughness: 32, }; oct_tree2.set_cube(cube.clone()); - scene.point_lights.push(Rc::new(RefCell::new(PointLight { pos: vec3(11.0, 11.0, 11.0), color: vec3(1.0, 1.0, 1.0), memory_start: 0 }))); - scene.point_lights.push(Rc::new(RefCell::new(PointLight { pos: vec3(9.0, 9.0, 11.0), color: vec3(0.5, 0.5, 0.5), memory_start: 0 }))); + scene.point_lights.push(Rc::new(RefCell::new(PointLight { pos: vec3(11.0 + grid_size as f32, 11.0 + grid_size as f32, 11.0), color: vec3(1.0, 1.0, 1.0), memory_start: 0 }))); + scene.point_lights.push(Rc::new(RefCell::new(PointLight { pos: vec3(9.0 + grid_size as f32, 9.0 + grid_size as f32, 11.0), color: vec3(0.5, 0.5, 0.5), memory_start: 0 }))); scene.directional_lights.push(Rc::new(RefCell::new(DirectionalLight { direction: vec3(1.0, 1.0, -1.0), color: vec3(0.1, 0.1, 0.1), memory_start: 0 }))); let cube = Cuboid { - pos: vec3(11.0, 11.0, 11.0), + pos: vec3(11.0 + grid_size as f32, 11.0 + grid_size as f32, 11.0), color: vec3(1.0, 1.0, 1.0), tex_coord: vec2(0.0, 0.0), size: Vector3 {x: 0.5, y: 0.5, z: 0.5} @@ -103,7 +103,7 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<()> cube.draw(&data.topology, index, scene); let cube = Cuboid { - pos: vec3(9.0, 9.0, 11.0), + pos: vec3(9.0 + grid_size as f32, 9.0 + grid_size as f32, 11.0), color: vec3(1.0, 1.0, 1.0), tex_coord: vec2(0.0, 0.0), size: Vector3 {x: 0.5, y: 0.5, z: 0.5} @@ -115,5 +115,94 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<()> let tree_ref_two = Rc::new(RefCell::new(oct_tree2.clone())); scene.oct_trees = vec![vec![vec![tree_ref_one.clone(), tree_ref_two.clone()], vec![tree_ref_two.clone(), tree_ref_two.clone()]], vec![vec![tree_ref_one.clone(), tree_ref_two.clone()], vec![tree_ref_two.clone(), tree_ref_two.clone()]]]; - Ok(()) + Ok((cgmath::point3(5.0, 5.0, 10.0))) +} + + +pub fn generate_test_scene2(scene: &mut Scene, data: &mut AppData, chunk_num_x: usize, chunk_num_y: usize, chunk_num_z: usize, num_gaussians: usize) -> Result<(Point3<f32>)> { + let mut rng = rand::thread_rng(); + let grid_size = CHUNK_SIZE as i32; + + let max_x = chunk_num_x * grid_size as usize; + let max_y = chunk_num_y * grid_size as usize; + let max_z = chunk_num_z * grid_size as usize; + + let mut height_map = vec![vec![0.0; max_y]; max_x]; + + for i in 0..num_gaussians { + let height = rng.gen_range(0..max_z / 2) as f32; + let center_x = rng.gen_range(0..max_x) as f32; + let center_y = rng.gen_range(0..max_y) as f32; + + let spread_x = rng.gen_range(0..max_x/2) as f32; + let spread_y = rng.gen_range(0..max_y/2) as f32; + + for x in 0..max_x { + for y in 0..max_y { + height_map[x][y] += height * (-((x as f32 - center_x).powf(2.0)/(2.0 * spread_x.powf(2.0)) + (y as f32 - center_y).powf(2.0)/(2.0 * spread_y.powf(2.0)))).exp(); + } + } + } + + let oct_trees = vec![vec![vec![Rc::new(RefCell::new(OctTree::<Cube>::create(CHUNK_SIZE)?)); chunk_num_x]; chunk_num_y]; chunk_num_z]; + + for x in 0..max_x { + for y in 0..max_y { + let height = height_map[x][y].floor() as usize; + let mut pillar_height; + if height < max_z { + let shade = (rng.gen_range(0..50) as f32) / 100.0; + let cube = Cube { + pos: vec3(x as f32, y as f32, (height % grid_size as usize) as f32), + color: vec3(shade, 1.0, shade), + tex_coord: vec2(0.0, 0.0), + transparent: false, + roughness: 255, + }; + + oct_trees[((height as f32) / (grid_size as f32)).floor() as usize][((y as f32) / (grid_size as f32)).floor() as usize][((x as f32) / (grid_size as f32)).floor() as usize].borrow_mut().set_cube(cube.clone()); + + pillar_height = height; + } else { + pillar_height = max_z; + } + + while pillar_height > 0 { + pillar_height -= 1; + let shade = (rng.gen_range(1..50) as f32) / 100.0; + let cube = Cube { + pos: vec3(x as f32, y as f32, (pillar_height % grid_size as usize) as f32), + color: vec3(shade, shade / 2.0, 0.0), + tex_coord: vec2(0.0, 0.0), + transparent: false, + roughness: 255, + }; + + //oct_trees[((pillar_height as f32) / (grid_size as f32)).floor() as usize][((y as f32) / (grid_size as f32)).floor() as usize][((x as f32) / (grid_size as f32)).floor() as usize].borrow_mut().set_cube(cube.clone()); + + } + } + } + + for i in 0..num_gaussians { + let height = rng.gen_range(1..8) as f32; + let center_x = rng.gen_range(0..max_x) as f32; + let center_y = rng.gen_range(0..max_y) as f32; + let final_height = height_map[center_x.floor() as usize][center_y.floor() as usize] + height; + scene.point_lights.push(Rc::new(RefCell::new(PointLight { pos: vec3(center_x, center_y, final_height), color: vec3(1.0, 1.0, 1.0), memory_start: 0 }))); + + let cube = Cuboid { + pos: vec3(center_x, center_y, final_height), + color: vec3(1.0, 1.0, 1.0), + tex_coord: vec2(0.0, 0.0), + size: Vector3 {x: 0.5, y: 0.5, z: 0.5} + }; + let index = scene.sized_vertices.len(); + cube.draw(&data.topology, index, scene); + } + + scene.directional_lights.push(Rc::new(RefCell::new(DirectionalLight { direction: vec3(0.0, 0.0, -1.0), color: vec3(0.1, 0.1, 0.1), memory_start: 0 }))); + scene.oct_trees = oct_trees; + + Ok(cgmath::point3((max_x as f32 / 2.0) as f32, (max_y as f32 / 2.0) as f32, height_map[(max_x as f32 / 2.0).floor() as usize][(max_y as f32 / 2.0).floor() as usize] + 2.0)) } \ No newline at end of file diff --git a/src/scene/oct_tree.rs b/src/scene/oct_tree.rs index f0e5da6..a156557 100644 --- a/src/scene/oct_tree.rs +++ b/src/scene/oct_tree.rs @@ -7,7 +7,7 @@ use crate::primitives::cube::Cube; extern crate rand; -pub const CHUNK_SIZE_EXPONENT: u32 = 4; +pub const CHUNK_SIZE_EXPONENT: u32 = 6; pub const CHUNK_SIZE: usize = (2 as usize).pow(CHUNK_SIZE_EXPONENT); pub const MAX_TREE_DEPTH: usize = CHUNK_SIZE_EXPONENT as usize - 2; pub const MIN_CHUNK_SIZE: usize = CHUNK_SIZE / (2 as usize).pow(MAX_TREE_DEPTH as u32); @@ -191,6 +191,9 @@ impl<T: Clone> OctTree<T> { } } else { + if let Some(_) = self.blocks[z * MIN_CHUNK_SIZE * MIN_CHUNK_SIZE + y * MIN_CHUNK_SIZE + x] { + println!("overwriting block!") + } self.blocks[z * MIN_CHUNK_SIZE * MIN_CHUNK_SIZE + y * MIN_CHUNK_SIZE + x] = Some(element); } }