From 729fcb8559b094b6a9459e646edc792fb58400da Mon Sep 17 00:00:00 2001 From: zomseffen Date: Wed, 15 Jan 2025 13:09:54 +0100 Subject: [PATCH] adds multilight handling --- shaders/compiled/frag_rt_quad.spv | Bin 22728 -> 24048 bytes shaders/rt_quad.frag | 33 +++++++++++++++++++++++++++--- src/main.rs | 2 +- src/scene/mod.rs | 14 +++++++++++-- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/shaders/compiled/frag_rt_quad.spv b/shaders/compiled/frag_rt_quad.spv index eafd9b98c8190e4dd8473bd0b06d3c639a892a0b..32ca9f02830832efa29626333a924d7786d65827 100644 GIT binary patch literal 24048 zcmaKz2bf${{e}m!DbhO@S^`o8kzPa~fDn)lf*|U;B%831?1tS<2oWhEARt6KND%}j zlt_~R>a}!ZVUz~iu&N)k+rGQ4KQK6M{Y^IAK!+t7O-Fr}Y%J2~ptnux>glCx z?7DEHu{&)K+R3yxabJoUeJBPRLWM@-J`!{gKW4YiF?;SgX15(X$4;KyIWTzS#O}_C zJ-ywX<9hnL#}4*P?bdHZ;n&kUcH)$ArNdA>$}tS3(xTLu(mT0p>|vc_`zH4FuRUeM zt&kc+slN#Q)UJu(#T(0l2f8LrrfhF_&xAt`?(6Ry-`_W>b6{*Yqv+`!-)HF5DI0B7 zWf;o3EM#TtPg6gb@Ua#{(v}T6|G#x{Vi{{F5bJI8eojP0Mh zkj{GtZ2P+WyRiD(PZ>YHyB~FEr5o=>VR=!8Hg=?MUn;fXja|{23*4-bi==H&Y=eE1 zo13C@pl5n_=MjkyVSdgt1cM`UP=iV*tg)wf{0&E%Q+1Omq zxi?R-E*C7&=DLh%Tx!ndde%cL`xXDoUX6D|V-EIeUFVB-9Y!>6T(I3?SN7ZJn`=0K z0^{%gANJOuo-dyJe$3Of(?1_IId$r#4hgai!a>4f2_=h!~#Xj#oZeIWAjH~Zc zH1DhD>1%rteR$(#^!k26s%)>(*Y{J?HmvamptfhKI&Y(w_g{DKxGLAeJoD$}!AKQwC%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iwmbfs4R$7wCVP*1*M900THs2ZPL~*JuzOF9xgK!IoW0e;G~f653Vxc!MslbZ^j= zU_V|v^($z1(Yz(%Slm^<|1%Mm5ZEABgAvQBHPE%-2&C;A+MP55i6hW;VB@%WcSRny z>%nUAlkf((nm4086@&k=cOydl`qUu?-vriXU~hmtY&V1Rz_-BFtory>dn-KRYLBtE zfwk>j5ZLNg2;=SGJn&+;ns0doz5^bCwa3^cU~MkgCtL2#a3|e0cTd|IY@@+NZq!Nc z`RVML<<7ZHANdxQuf2=#81Du 0.0; bool z_null = (light_direction.z == 0.0); + // initialize color vec3 color_sum = vec3(0.0, 0.0, 0.0) + (orig_color_sample.xyz * 0.01); uint max_iterations = max_light_num * 20; @@ -188,7 +190,7 @@ void main() { if ((x_factor >= 1.0) && (y_factor >= 1.0) && (z_factor >= 1.0)) { // no hit, add light color result - color_sum += (orig_color_sample.xyz * light_color) / ((0.01 * light_direction.length() * light_direction.length()) + 1.0); + color_sum += (orig_color_sample.xyz * light_color) / ((0.1 * light_direction.length() * light_direction.length()) + 1.0); needs_next_light = true; } else { // if there is a border hit before reaching the light @@ -249,7 +251,32 @@ void main() { } } if (needs_next_light) { - break; + light_num += 1; + if (light_num >= max_light_num) { + break; + } + // set up the new light + light_index = scene_info.infos[fragVolumeStart + 6 + light_num]; + if (light_index == 0) { + // abort if there is no new light + break; + } + light_direction = get_light_position(light_index) - origPosition; + light_color = get_light_color(light_index); + + x_pos = light_direction.x > 0.0; + x_null = (light_direction.x == 0.0); + + y_pos = light_direction.y > 0.0; + y_null = (light_direction.y == 0.0); + + z_pos = light_direction.z > 0.0; + z_null = (light_direction.z == 0.0); + // reset volume info + volume_index = fragVolumeStart; + volume_pos_x = scene_info.infos[volume_index + 0]; + volume_pos_y = scene_info.infos[volume_index + 1]; + volume_pos_z = scene_info.infos[volume_index + 2]; } } outColor = vec4(color_sum, 1.0); diff --git a/src/main.rs b/src/main.rs index 9674aea..5c6dc6b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -178,7 +178,7 @@ impl App { let entry = Entry::new(loader).map_err(|b| anyhow!("{}", b))?; let mut data = app_data::AppData::default(); data.use_geometry_shader = false; - data.num_lights_per_volume = 1; + data.num_lights_per_volume = 2; let mut scene_handler = scene::Scene::default(); //load_model::load_model(&mut data)?; diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 61609bd..2006ece 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -88,7 +88,8 @@ impl Scene { oct_tree.set_cube(cube.clone()); - self.point_lights.push(PointLight { pos: vec3(11.0, 11.0, 11.0), color: vec3(1.0, 1.0, 1.0), memory_start: 0 }); + self.point_lights.push(PointLight { pos: vec3(11.0, 11.0, 11.0), color: vec3(0.5, 0.5, 0.5), memory_start: 0 }); + self.point_lights.push(PointLight { pos: vec3(9.0, 9.0, 11.0), color: vec3(0.5, 0.5, 0.5), memory_start: 0 }); let mut empty_volumes: Vec>>; (empty_volumes, _) = EmptyVolume::from_oct_tree(&oct_tree); @@ -113,7 +114,7 @@ impl Scene { else { cube.draw(&data.topology, index, self); }*/ - cube.draw(&data.topology, index, self); + //cube.draw(&data.topology, index, self); } None => {} } @@ -127,6 +128,15 @@ impl Scene { }; let index = self.sized_vertices.len(); cube.draw(&data.topology, index, self); + + let cube = Cuboid { + pos: vec3(9.0, 9.0, 11.0), + color: vec3(shade, 1.0, shade), + tex_coord: vec2(0.0, 0.0), + size: Vector3 {x: 0.5, y: 0.5, z: 0.5} + }; + let index = self.sized_vertices.len(); + cube.draw(&data.topology, index, self); let mut memory_index = 1; // zero should be the location for the overall length (also will be the invalid memory allocation for pointing to a nonexistant neighbor) for light in &mut self.point_lights {