mirror of
https://github.com/storytold/spark.git
synced 2026-10-18 00:22:59 +00:00
Fixed rendering, moved examples/editor option under Debug. Updated spark-viewpoint.md.
This commit is contained in:
committed by
Andreas Sundquist
parent
d707f283f5
commit
b39cf3873f
@@ -24,6 +24,7 @@ const viewpoint = spark.newViewpoint({
|
|||||||
depthBias?: number;
|
depthBias?: number;
|
||||||
sort360?: boolean;
|
sort360?: boolean;
|
||||||
sort32?: boolean;
|
sort32?: boolean;
|
||||||
|
stochastic?: boolean;
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ const viewpoint = spark.newViewpoint({
|
|||||||
| **depthBias** | Constant added to Z-depth to bias values into the positive range for `sortRadial: false`, but also used for culling splats "well behind" the viewpoint origin (default: `1.0`)
|
| **depthBias** | Constant added to Z-depth to bias values into the positive range for `sortRadial: false`, but also used for culling splats "well behind" the viewpoint origin (default: `1.0`)
|
||||||
| **sort360** | Set this to true if rendering a 360 to disable "behind the viewpoint" culling during sorting. This is set automatically when rendering 360 envMaps using the `SparkRenderer.renderEnvMap()` utility function. (default: `false`)
|
| **sort360** | Set this to true if rendering a 360 to disable "behind the viewpoint" culling during sorting. This is set automatically when rendering 360 envMaps using the `SparkRenderer.renderEnvMap()` utility function. (default: `false`)
|
||||||
| **sort32** | Set this to true to sort with float32 precision with two-pass sort. (default: `false`)
|
| **sort32** | Set this to true to sort with float32 precision with two-pass sort. (default: `false`)
|
||||||
|
| **stochastic** | Set this to true to enable sort-free stochastic splat rendering. (default: `false`)
|
||||||
|
|
||||||
## `dispose()`
|
## `dispose()`
|
||||||
|
|
||||||
|
|||||||
@@ -498,11 +498,6 @@
|
|||||||
gui.addColor(guiOptions, "backgroundColor").name("Background color").onChange((value) => {
|
gui.addColor(guiOptions, "backgroundColor").name("Background color").onChange((value) => {
|
||||||
scene.background.set(value);
|
scene.background.set(value);
|
||||||
});
|
});
|
||||||
// spark.defaultView.stochastic = true;
|
|
||||||
gui.add(spark.defaultView, "stochastic").name("Stochastic sort-free").listen().onChange(() => {
|
|
||||||
// spark.prepareViewpoint();
|
|
||||||
touch();
|
|
||||||
});
|
|
||||||
|
|
||||||
const debugFolder = gui.addFolder("Debug").close();
|
const debugFolder = gui.addFolder("Debug").close();
|
||||||
const normalColor = dyno.dynoBool(false);
|
const normalColor = dyno.dynoBool(false);
|
||||||
@@ -531,6 +526,8 @@
|
|||||||
debugFolder.add(spark, "minAlpha", 0, 1, 0.001).name("Min alpha").listen();
|
debugFolder.add(spark, "minAlpha", 0, 1, 0.001).name("Min alpha").listen();
|
||||||
|
|
||||||
debugFolder.add(spark, "premultipliedAlpha").name("Premultiplied alpha").listen();
|
debugFolder.add(spark, "premultipliedAlpha").name("Premultiplied alpha").listen();
|
||||||
|
debugFolder.add(spark.defaultView, "stochastic").name("Stochastic sort-free").listen().onChange(touch);
|
||||||
|
|
||||||
const accumFolder = debugFolder.addFolder("Accumulator encoding").close();;
|
const accumFolder = debugFolder.addFolder("Accumulator encoding").close();;
|
||||||
accumFolder.add(spark.splatEncoding, "rgbMin", -1, 1, 0.1).name("RGB min").onChange(touch);
|
accumFolder.add(spark.splatEncoding, "rgbMin", -1, 1, 0.1).name("RGB min").onChange(touch);
|
||||||
accumFolder.add(spark.splatEncoding, "rgbMax", 0, 4, 0.1).name("RGB max").onChange(touch);
|
accumFolder.add(spark.splatEncoding, "rgbMax", 0, 4, 0.1).name("RGB max").onChange(touch);
|
||||||
@@ -779,8 +776,6 @@
|
|||||||
lastTime = time;
|
lastTime = time;
|
||||||
stats.begin();
|
stats.begin();
|
||||||
|
|
||||||
renderer.clear(true, true, false);
|
|
||||||
|
|
||||||
if (guiOptions.autoRotate) {
|
if (guiOptions.autoRotate) {
|
||||||
frame.rotation.y += deltaTime / 5000;
|
frame.rotation.y += deltaTime / 5000;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -535,9 +535,10 @@ export class SparkRenderer extends THREE.Mesh {
|
|||||||
// Alternating debug flag that can aid in visual debugging
|
// Alternating debug flag that can aid in visual debugging
|
||||||
this.uniforms.debugFlag.value = (performance.now() / 1000.0) % 2.0 < 1.0;
|
this.uniforms.debugFlag.value = (performance.now() / 1000.0) % 2.0 < 1.0;
|
||||||
|
|
||||||
// if (viewpoint.stochastic) {
|
if (viewpoint.display && viewpoint.stochastic) {
|
||||||
// (this.geometry as SplatGeometry).instanceCount = this.uniforms.numSplats.value;
|
(this.geometry as SplatGeometry).instanceCount =
|
||||||
// }
|
this.uniforms.numSplats.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewpoint.target) {
|
if (viewpoint.target) {
|
||||||
|
|||||||
@@ -571,6 +571,11 @@ export class SparkViewpoint {
|
|||||||
|
|
||||||
if (this.stochastic) {
|
if (this.stochastic) {
|
||||||
activeSplats = numSplats;
|
activeSplats = numSplats;
|
||||||
|
// Render all splats in order since the Z-buffer
|
||||||
|
// will handle ordering.
|
||||||
|
for (let i = 0; i < numSplats; ++i) {
|
||||||
|
ordering[i] = i;
|
||||||
|
}
|
||||||
} else if (numSplats > 0) {
|
} else if (numSplats > 0) {
|
||||||
const {
|
const {
|
||||||
reader,
|
reader,
|
||||||
|
|||||||
Reference in New Issue
Block a user