tweaks to outline viewer

This commit is contained in:
Tom 2025-05-06 10:50:44 +01:00
parent 0a37afee12
commit b90ac49f24
3 changed files with 6 additions and 20 deletions

View File

@ -172,12 +172,6 @@ class CustomOutlinePass extends Pass {
surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(0, e))) ? 1.0 : 0.0; surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(0, e))) ? 1.0 : 0.0;
surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(-e, 0))) ? 1.0 : 0.0; surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(-e, 0))) ? 1.0 : 0.0;
surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(0, -e))) ? 1.0 : 0.0; surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(0, -e))) ? 1.0 : 0.0;
surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(e, e))) ? 1.0 : 0.0;
surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(e, -e))) ? 1.0 : 0.0;
surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(-e, e))) ? 1.0 : 0.0;
surfaceIdDiff += any(notEqual(surfaceValue, getSurfaceValue(-e, -e))) ? 1.0 : 0.0;
return surfaceIdDiff; return surfaceIdDiff;
} }
@ -187,11 +181,6 @@ class CustomOutlinePass extends Pass {
depthDiff += abs(depth - getPixelDepth(-1, 0)); depthDiff += abs(depth - getPixelDepth(-1, 0));
depthDiff += abs(depth - getPixelDepth(0, 1)); depthDiff += abs(depth - getPixelDepth(0, 1));
depthDiff += abs(depth - getPixelDepth(0, -1)); depthDiff += abs(depth - getPixelDepth(0, -1));
depthDiff += abs(depth - getPixelDepth(1, 1));
depthDiff += abs(depth - getPixelDepth(1, -1));
depthDiff += abs(depth - getPixelDepth(-1, 1));
depthDiff += abs(depth - getPixelDepth(-1, -1));
return depthDiff; return depthDiff;
} }
@ -232,8 +221,6 @@ class CustomOutlinePass extends Pass {
gl_FragColor = vec4(vec3(surfaceValueDiff), 1.0); gl_FragColor = vec4(vec3(surfaceValueDiff), 1.0);
} }
if (surfaceValueDiff != 0.0) surfaceValueDiff = 1.0;
float outline; float outline;
vec4 outlineColor = vec4(outlineColor, 1.0);; vec4 outlineColor = vec4(outlineColor, 1.0);;

View File

@ -128,7 +128,7 @@ export class OutlineModelViewer extends HTMLElement {
composer.addPass(effectFXAA); composer.addPass(effectFXAA);
// Set over sampling ratio // Set over sampling ratio
this.updateEdgeThickness(1); this.updateEdgeThickness(1 / window.devicePixelRatio);
this.updatePixelRatio(window.devicePixelRatio); this.updatePixelRatio(window.devicePixelRatio);
renderer.setSize(width, height, false); renderer.setSize(width, height, false);
@ -294,9 +294,11 @@ export class OutlineModelViewer extends HTMLElement {
uniforms.debugVisualize.value = value; uniforms.debugVisualize.value = value;
}); });
gui.add(params, "edgeThickness", 1, 10).onChange(function (value) { gui
element.updateEdgeThickness(value); .add(params, "edgeThickness", 1 / window.devicePixelRatio, 10)
}); .onChange(function (value) {
element.updateEdgeThickness(value);
});
gui.add(params, "pixelRatio", 1, 8, 1).onChange(function (value) { gui.add(params, "pixelRatio", 1, 8, 1).onChange(function (value) {
element.updatePixelRatio(value); element.updatePixelRatio(value);

View File

@ -24,7 +24,6 @@ if (inline_viewer) {
original.autoRotate = controls.autoRotate; original.autoRotate = controls.autoRotate;
controls.autoRotate = true; controls.autoRotate = true;
inline_viewer.updateEdgeThickness(0.5);
} }
if (mode === "icon" && delta > 2 * margin) { if (mode === "icon" && delta > 2 * margin) {
@ -42,8 +41,6 @@ if (inline_viewer) {
); );
controls.autoRotate = original.autoRotate; controls.autoRotate = original.autoRotate;
mode = "inline"; mode = "inline";
// inline_viewer.onWindowResize();
inline_viewer.updateEdgeThickness(1);
canvas.classList.remove("revealed"); canvas.classList.remove("revealed");
} }