Compare commits

...

8 Commits

Author SHA1 Message Date
molive c3cc9943bc Merge branch 'main' of https://git.stargaze.group/molive/up-to-spec 2025-11-22 18:58:45 +01:00
molive 567ad0e480 Update project name 2025-11-20 15:56:24 +01:00
molive cc4b0aee82 Add linear AO spec constant 2025-11-19 17:03:04 +01:00
molive d3e3090cc5 Mess with AO calc 2025-11-19 15:56:21 +01:00
molive 58cf0ad068 Possibly fix device loss 2025-11-19 14:49:22 +01:00
molive 717488201b Revert "uhhh?????"
This reverts commit 3e9afeeffa.
2025-11-19 14:13:55 +01:00
molive 3e9afeeffa uhhh????? 2025-11-07 01:21:11 +01:00
molive cc5001bbc6 fix cargo 2025-11-07 01:10:20 +01:00
12 changed files with 765 additions and 666 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
/target /target
pipeline_cache.bin pipeline_cache.bin
log.log log.log
out.spv *.out.spv
*.recompiled.spv *.recompiled.spv
*.spv-dis *.spv-dis
+8 -8
View File
@@ -7,15 +7,15 @@
{ {
"type": "lldb", "type": "lldb",
"request": "launch", "request": "launch",
"name": "Debug executable 'erroccfisuvsc'", "name": "Debug executable 'tape-drive'",
"cargo": { "cargo": {
"args": [ "args": [
"build", "build",
"--bin=erroccfisuvsc", "--bin=tape-drive",
"--package=erroccfisuvsc" "--package=tape-drive"
], ],
"filter": { "filter": {
"name": "erroccfisuvsc", "name": "tape-drive",
"kind": "bin" "kind": "bin"
} }
}, },
@@ -25,16 +25,16 @@
{ {
"type": "lldb", "type": "lldb",
"request": "launch", "request": "launch",
"name": "Debug unit tests in executable 'erroccfisuvsc'", "name": "Debug unit tests in executable 'tape-drive'",
"cargo": { "cargo": {
"args": [ "args": [
"test", "test",
"--no-run", "--no-run",
"--bin=erroccfisuvsc", "--bin=tape-drive",
"--package=erroccfisuvsc" "--package=tape-drive"
], ],
"filter": { "filter": {
"name": "erroccfisuvsc", "name": "tape-drive",
"kind": "bin" "kind": "bin"
} }
}, },
Generated
+704 -628
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "erroccfisuvsc" name = "tape-drive"
version = "0.2.0" version = "0.3.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -30,7 +30,7 @@ egui_plot = "0.32.1"
utf-8 = "0.7" utf-8 = "0.7"
rand = "0.9.1" rand = "0.9.1"
foldhash = "*" foldhash = "0.1.5"
log = "0.4" log = "0.4"
simplelog = "0.12" simplelog = "0.12"
BIN
View File
Binary file not shown.
+7 -5
View File
@@ -24,6 +24,7 @@ pub(crate) struct PreviousDebug {
pub(crate) show_material: bool, pub(crate) show_material: bool,
pub(crate) show_all: bool, pub(crate) show_all: bool,
pub(crate) disable_ao: bool, pub(crate) disable_ao: bool,
pub(crate) use_linear_ao: bool,
} }
#[derive(Debug)] #[derive(Debug)]
@@ -80,11 +81,8 @@ pub(crate) fn gui_up(gui: &mut Gui, state: &mut GState, new_csg_needed: &mut boo
.frame(Frame::default().fill(Color32::from_rgba_unmultiplied(50, 50, 50, 200))) .frame(Frame::default().fill(Color32::from_rgba_unmultiplied(50, 50, 50, 200)))
.show(&ctx, |ui| { .show(&ctx, |ui| {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(egui::widgets::Label::new( sized_text(ui, "Tape Drive", 32.0);
"Efficient Realtime Rendering of Complex Closed Form Implicit Surfaces \ sized_text(ui, "Settings", 25.0);
Using Modern RTX Enabled GPUs",
));
sized_text(ui, "Settings", 32.0);
}); });
ui.separator(); ui.separator();
egui::ScrollArea::vertical().show(ui, |ui| { egui::ScrollArea::vertical().show(ui, |ui| {
@@ -313,6 +311,10 @@ pub(crate) fn gui_up(gui: &mut Gui, state: &mut GState, new_csg_needed: &mut boo
&mut state.debug.disable_ao, &mut state.debug.disable_ao,
"Disable ambient occlusion calculation", "Disable ambient occlusion calculation",
); );
ui.toggle_value(
&mut state.debug.use_linear_ao,
"Use linear falloff for occlusion calculation",
);
}); });
}); });
}); });
+1
View File
@@ -10,6 +10,7 @@ layout(constant_id = 5) const bool SPEC_SHOW_ALBEDO = false;
layout(constant_id = 6) const bool SPEC_SHOW_MATERIAL = false; layout(constant_id = 6) const bool SPEC_SHOW_MATERIAL = false;
layout(constant_id = 7) const bool SPEC_SHOW_ALL = false; layout(constant_id = 7) const bool SPEC_SHOW_ALL = false;
layout(constant_id = 8) const bool SPEC_DISABLE_AO = false; layout(constant_id = 8) const bool SPEC_DISABLE_AO = false;
layout(constant_id = 9) const bool SPEC_USE_LINEAR_AO = false;
//layout(constant_id = 30) const uint SPEC_MAXIMUM_SUBDIVISION = 64; //layout(constant_id = 30) const uint SPEC_MAXIMUM_SUBDIVISION = 64;
const uint SPEC_MAXIMUM_SUBDIVISION = 64; const uint SPEC_MAXIMUM_SUBDIVISION = 64;
+2 -2
View File
@@ -112,7 +112,7 @@ impl<'csg> PointInterpreter<'csg> {
} }
} }
// cargo asm "erroccfisuvsc::interpreter::PointInterpreter::scene" --no-color // cargo asm "tape-drive::interpreter::PointInterpreter::scene" --no-color
// --rust > scene.asm // --rust > scene.asm
pub(crate) fn scene(&mut self, px: Value, py: Value, pz: Value, time: Value) -> Value { pub(crate) fn scene(&mut self, px: Value, py: Value, pz: Value, time: Value) -> Value {
@@ -479,7 +479,7 @@ impl<'csg> IntervalInterpreter<'csg> {
} }
} }
// cargo asm "erroccfisuvsc::interpreter::IntervalInterpreter::scene" --no-color // cargo asm "tape-drive::interpreter::IntervalInterpreter::scene" --no-color
// --rust > scene.asm // --rust > scene.asm
pub(crate) fn scene( pub(crate) fn scene(
+7 -2
View File
@@ -3,7 +3,7 @@
#![feature(portable_simd)] #![feature(portable_simd)]
#![feature(mpmc_channel)] #![feature(mpmc_channel)]
const DUMP_SPV_TO_FILE: bool = false; const DUMP_SPV_TO_FILE: bool = true;
const PIPELINE_CACHING: bool = false; const PIPELINE_CACHING: bool = false;
const BYTECODE_IMITATES_GLSL: bool = false; const BYTECODE_IMITATES_GLSL: bool = false;
@@ -587,7 +587,7 @@ impl ApplicationHandler for App {
fn resumed(&mut self, event_loop: &ActiveEventLoop) { fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let window = Arc::new( let window = Arc::new(
event_loop event_loop
.create_window(Window::default_attributes().with_title("Implicit Surfaces")) .create_window(Window::default_attributes().with_title("Tape Drive"))
.unwrap(), .unwrap(),
); );
let surface = Surface::from_window(self.instance.clone(), window.clone()).unwrap(); let surface = Surface::from_window(self.instance.clone(), window.clone()).unwrap();
@@ -1867,6 +1867,7 @@ fn get_spec_constants(debug: &PreviousDebug) -> HashMap<u32, SpecializationConst
const SPEC_SHOW_MATERIAL: u32 = 6; const SPEC_SHOW_MATERIAL: u32 = 6;
const SPEC_SHOW_ALL: u32 = 7; const SPEC_SHOW_ALL: u32 = 7;
const SPEC_DISABLE_AO: u32 = 8; const SPEC_DISABLE_AO: u32 = 8;
const SPEC_USE_LINEAR_AO: u32 = 9;
const SPEC_MAXIMUM_SUBDISIVION: u32 = 30; const SPEC_MAXIMUM_SUBDISIVION: u32 = 30;
let mut spec_constants = HashMap::with_capacity(6); let mut spec_constants = HashMap::with_capacity(6);
@@ -1900,6 +1901,10 @@ fn get_spec_constants(debug: &PreviousDebug) -> HashMap<u32, SpecializationConst
SPEC_DISABLE_AO, SPEC_DISABLE_AO,
SpecializationConstant::Bool(debug.disable_ao), SpecializationConstant::Bool(debug.disable_ao),
); );
spec_constants.insert(
SPEC_USE_LINEAR_AO,
SpecializationConstant::Bool(debug.use_linear_ao),
);
spec_constants.insert( spec_constants.insert(
SPEC_MAXIMUM_SUBDISIVION, SPEC_MAXIMUM_SUBDISIVION,
SpecializationConstant::U32(MAXIMUM_SUBDIVISION), SpecializationConstant::U32(MAXIMUM_SUBDIVISION),
+23 -11
View File
@@ -7,6 +7,8 @@
#define tau 6.28318530717958647692 #define tau 6.28318530717958647692
#define AO_ENABLE 1
layout(location = 0) in vec2 v_pos; layout(location = 0) in vec2 v_pos;
layout(input_attachment_index = 0, set = 2, binding = 0) uniform usubpassInput u_material; layout(input_attachment_index = 0, set = 2, binding = 0) uniform usubpassInput u_material;
@@ -95,16 +97,24 @@ const uint AO_MAX_ITER = 10;
float getOcclusion(vec3 p, vec3 n) { float getOcclusion(vec3 p, vec3 n) {
float ao = 0.0; float ao = 0.0;
//for (uint i = 1; i < AO_MAX_ITER; i++) { #if AO_ENABLE
// hash = pcg4d(hash); for (uint i = 1; i < AO_MAX_ITER; i++) {
// vec3 point = getPointOnSphere(vec2(floatConstruct(hash.x), floatConstruct(hash.y))) * AO_STEP; hash = pcg4d(hash);
// float dist = dot(point, n); float multiplier;
// if (dist < 0) { if (SPEC_USE_LINEAR_AO) {
// dist = abs(dist); multiplier = AO_STEP * i;
// point += n * dist * 2.0; } else {
// } multiplier = pow(AO_STEP, (float(i) / AO_MAX_ITER * 2) + 0.5);
// ao += max((dist - scene(vec4(p + point, camera_uniforms.campos_and_time.w))) / dist, 0.0); }
//} vec3 point = getPointOnSphere(vec2(floatConstruct(hash.x), floatConstruct(hash.y))) * multiplier;
float dist = dot(point, n);
if (dist < 0) {
dist = abs(dist);
point += n * dist * 2.0;
}
ao += max((dist - scene(vec4(p + point, camera_uniforms.campos_and_time.w))) / dist, 0.0);
}
#endif
return 1.0 - ao * AO_INTENSITY; return 1.0 - ao * AO_INTENSITY;
} }
@@ -114,7 +124,9 @@ void main() {
discard; discard;
} }
//hash = uvec4(v_pos.x * 374799253, v_pos.y * 615653626, camera_uniforms.campos_and_time.w * 626228781, 713668633); #if AO_ENABLE
hash = uvec4((v_pos.x + 1.0) * 374799253, (v_pos.y + 1.0) * 615653626, camera_uniforms.campos_and_time.w * 626228781, 713668633);
#endif
float depth = subpassLoad(u_depth).x; float depth = subpassLoad(u_depth).x;
if (depth == 1.0) { if (depth == 1.0) {
+3 -3
View File
@@ -436,9 +436,9 @@ fn create_csg() -> SSATape {
pos[0], pos[0],
pos[1], pos[1],
pos[2], pos[2],
SSAInput::Constant(rand::random_range(0.0..3.0)), SSAInput::Constant(rand::random_range(0.0..1.0)),
SSAInput::Constant(rand::random_range(0.0..3.0)), SSAInput::Constant(rand::random_range(0.0..1.0)),
SSAInput::Constant(rand::random_range(0.0..3.0)), SSAInput::Constant(rand::random_range(0.0..1.0)),
], ],
); );
let sphere = tape.push_instruction( let sphere = tape.push_instruction(
+5 -2
View File
@@ -11,6 +11,8 @@ layout(location = 0) out uint material;
const float EPSILON = .001; const float EPSILON = .001;
const uint MAX_STEPS = 50;
void main() { void main() {
if (SPEC_BOUNDING_BOXES) { if (SPEC_BOUNDING_BOXES) {
material = object_uniforms.material; material = object_uniforms.material;
@@ -24,7 +26,7 @@ void main() {
vec3 p = raypos; vec3 p = raypos;
float total_dist = 0.; float total_dist = 0.;
do { for (uint i = 0; i < MAX_STEPS; i++) {
float dist = scene(vec4(p, camera_uniforms.campos_and_time.w)); float dist = scene(vec4(p, camera_uniforms.campos_and_time.w));
total_dist += dist; total_dist += dist;
p = fma(raydir, vec3(total_dist), raypos); p = fma(raydir, vec3(total_dist), raypos);
@@ -36,5 +38,6 @@ void main() {
} else if (total_dist > farplane) { } else if (total_dist > farplane) {
discard; discard;
} }
} while (true); }
discard;
} }