From 5ffcfe95c6b8be88cae0310acafbd1d2fcc3d4fb Mon Sep 17 00:00:00 2001 From: Peregrine05 <92183530+Peregrine05@users.noreply.github.com> Date: Mon, 24 Oct 2022 19:54:37 +0200 Subject: [PATCH 1/4] Make sky depth infinite This can be enabled and disabled with a control in the plugin tab. --- build.gradle | 4 ++-- .../thatredox/chunkyaov/raytracer/DepthTracer.java | 4 +++- .../dev/thatredox/chunkyaov/ui/ChunkyAovTab.java | 13 +++++++++++++ src/main/resources/plugin.json | 4 ++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index dc1cbce..50fb779 100644 --- a/build.gradle +++ b/build.gradle @@ -22,14 +22,14 @@ configurations { } dependencies { - provided 'se.llbit:chunky-core:2.4.2' + provided 'se.llbit:chunky-core:2.4.4' provided 'org.apache.commons:commons-math3:3.2' provided 'it.unimi.dsi:fastutil:8.4.4' bundled 'org.jocl:jocl:2.0.2' } javafx { - version = '11' + version = '11.0.2' modules = ['javafx.base', 'javafx.controls', 'javafx.fxml'] configuration = 'provided' } diff --git a/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java b/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java index e380040..7810a88 100644 --- a/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java +++ b/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java @@ -29,6 +29,7 @@ public class DepthTracer implements RayTracer { public static double NORMALIZATION_FACTOR = 100.0; + public static boolean INFINITE_SKY_DISTANCE = true; private DepthTracer() {} @@ -50,7 +51,8 @@ public static void register() { @Override public void trace(Scene scene, WorkerState state) { Ray ray = state.ray; - double distance = 0.0; + double distance = INFINITE_SKY_DISTANCE ? Double.longBitsToDouble(0x7fe0000000000000L) : 0.0; + if (PreviewRayTracer.nextIntersection(scene, ray)) { distance = ray.distance; } diff --git a/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java b/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java index 949fc7b..34787a1 100644 --- a/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java +++ b/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java @@ -40,6 +40,7 @@ public class ChunkyAovTab implements RenderControlsTab { private final SimpleBooleanProperty nmPositive = new SimpleBooleanProperty(NormalTracer.MAP_POSITIVE); private final SimpleBooleanProperty nmWaterDisplacement = new SimpleBooleanProperty(NormalTracer.WATER_DISPLACEMENT); private final SimpleDoubleProperty depthNormFactor = new SimpleDoubleProperty(DepthTracer.NORMALIZATION_FACTOR); + private final SimpleBooleanProperty infiniteSkyDepth = new SimpleBooleanProperty(DepthTracer.INFINITE_SKY_DISTANCE); public ChunkyAovTab() { nmPositive.addListener((observable, oldValue, newValue) -> { @@ -64,6 +65,13 @@ public ChunkyAovTab() { scene.refresh(); } }); + infiniteSkyDepth.addListener((observable, oldValue, newValue) -> { + DepthTracer.INFINITE_SKY_DISTANCE = newValue; + if (scene != null) { + scene.setAdditionalData("aov_infinite_sky_depth", Json.of(newValue)); + scene.refresh(); + } + }); box.setPadding(new Insets(10.0, 10.0, 10.0, 10.0)); @@ -86,6 +94,10 @@ public ChunkyAovTab() { depthNormAdjuster.setRange(1.0, 1000.0); depthNormAdjuster.clampMin(); box.getChildren().add(depthNormAdjuster); + + CheckBox enableInfiniteSkyDepth = new CheckBox("Infinite Sky Depth"); + enableInfiniteSkyDepth.selectedProperty().bindBidirectional(infiniteSkyDepth); + box.getChildren().add(enableInfiniteSkyDepth); } @Override @@ -94,6 +106,7 @@ public void update(Scene scene) { nmPositive.set(scene.getAdditionalData("aov_normal_positive").boolValue(nmPositive.get())); nmWaterDisplacement.set(scene.getAdditionalData("aov_normal_water_displacement").boolValue(nmWaterDisplacement.get())); depthNormFactor.set(scene.getAdditionalData("aov_depth_normalization").doubleValue(depthNormFactor.get())); + infiniteSkyDepth.set(scene.getAdditionalData("aov_infinite_sky_depth").boolValue(infiniteSkyDepth.get())); } @Override diff --git a/src/main/resources/plugin.json b/src/main/resources/plugin.json index 9242851..a9cad67 100644 --- a/src/main/resources/plugin.json +++ b/src/main/resources/plugin.json @@ -2,7 +2,7 @@ "name": "Chunky AOV", "author": "Redox", "main": "dev.thatredox.chunkyaov.ChunkyAOV", - "version": "0.0.1", - "targetVersion": "2.4.2", + "version": "0.0.2", + "targetVersion": "2.4.4", "description": "Arbitrary output variable renderers for Chunky." } \ No newline at end of file From bf0964d957e54fb7b3689fbfb3ee7d5288576bec Mon Sep 17 00:00:00 2001 From: Peregrine05 <92183530+Peregrine05@users.noreply.github.com> Date: Tue, 25 Oct 2022 11:59:59 +0200 Subject: [PATCH 2/4] Add note on Postprocessing filter; return target version to 2.4.2 --- build.gradle | 2 +- src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java | 7 +++++++ src/main/resources/plugin.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 50fb779..7f82531 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ configurations { } dependencies { - provided 'se.llbit:chunky-core:2.4.4' + provided 'se.llbit:chunky-core:2.4.2' provided 'org.apache.commons:commons-math3:3.2' provided 'it.unimi.dsi:fastutil:8.4.4' bundled 'org.jocl:jocl:2.0.2' diff --git a/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java b/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java index 34787a1..219d288 100644 --- a/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java +++ b/src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java @@ -28,6 +28,7 @@ import javafx.scene.control.Separator; import javafx.scene.control.Tooltip; import javafx.scene.layout.VBox; +import javafx.scene.text.Text; import se.llbit.chunky.renderer.scene.Scene; import se.llbit.chunky.ui.DoubleAdjuster; import se.llbit.chunky.ui.SliderAdjuster; @@ -98,6 +99,12 @@ public ChunkyAovTab() { CheckBox enableInfiniteSkyDepth = new CheckBox("Infinite Sky Depth"); enableInfiniteSkyDepth.selectedProperty().bindBidirectional(infiniteSkyDepth); box.getChildren().add(enableInfiniteSkyDepth); + + box.getChildren().add(new Separator()); + + Text text = new Text("For accurate results, set the Postprocessing filter in the Postprocessing tab to None."); + text.setWrappingWidth(350); + box.getChildren().add(text); } @Override diff --git a/src/main/resources/plugin.json b/src/main/resources/plugin.json index a9cad67..e848558 100644 --- a/src/main/resources/plugin.json +++ b/src/main/resources/plugin.json @@ -3,6 +3,6 @@ "author": "Redox", "main": "dev.thatredox.chunkyaov.ChunkyAOV", "version": "0.0.2", - "targetVersion": "2.4.4", + "targetVersion": "2.4.2", "description": "Arbitrary output variable renderers for Chunky." } \ No newline at end of file From 5e441590f6449ac9e065cdf9723233217c0a5456 Mon Sep 17 00:00:00 2001 From: Peregrine05 <92183530+Peregrine05@users.noreply.github.com> Date: Tue, 25 Oct 2022 21:49:08 +0200 Subject: [PATCH 3/4] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7f82531..dc1cbce 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ dependencies { } javafx { - version = '11.0.2' + version = '11' modules = ['javafx.base', 'javafx.controls', 'javafx.fxml'] configuration = 'provided' } From 52ba483a2e28f78fa72abeec2ca501491079d270 Mon Sep 17 00:00:00 2001 From: Peregrine05 <92183530+Peregrine05@users.noreply.github.com> Date: Tue, 25 Oct 2022 21:58:30 +0200 Subject: [PATCH 4/4] Use `Double.MAX_VALUE` --- .../java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java b/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java index 7810a88..022d166 100644 --- a/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java +++ b/src/main/java/dev/thatredox/chunkyaov/raytracer/DepthTracer.java @@ -51,7 +51,7 @@ public static void register() { @Override public void trace(Scene scene, WorkerState state) { Ray ray = state.ray; - double distance = INFINITE_SKY_DISTANCE ? Double.longBitsToDouble(0x7fe0000000000000L) : 0.0; + double distance = INFINITE_SKY_DISTANCE ? Double.MAX_VALUE : 0.0; if (PreviewRayTracer.nextIntersection(scene, ray)) { distance = ray.distance;