Skip to content

Commit 96d6b45

Browse files
Fix viewing zoomed out datasets for which rotations are configured transformation via dataset settings (#8819)
The fix works by disabling the vertex position optimization code for datasets where all layers are transformed. Previously a dataset where all layers had transforms had `representativeMagForVertexAlignment=[1,1,1]` regardless of the zooming of the user. This caused the vertices of the plane to be bucket aligned to mag 1 buckets by the optimization code. The calculated bucket positions were then disregarded in the fragment shader but lead to the "blank" areas. Because when zoomed out, there were not enough vertices to cover all buckets in mag 1 regarding the viewed area leaving gaps in what was rendered. This should now be fixed. ### URL of deployed dev instance (used for testing): - https://___.webknossos.xyz ### Steps to test: - Open DS settings for a dataset and configure a default rotation of e.g. 180° around x - View the dataset and zoom out as far as possible -> everything should look normal - Checkout master. View the DS again -> now not all of the screen should be a "rendered area" shown by the viewports default color being rendered for parts of the viewport. ### Issues: - reported here: https://scm.slack.com/archives/C5AKLAV0B/p1753954379767099 ------ (Please delete unneeded items, merge only when none are left open) - [x] Added changelog entry (create a `$PR_NUMBER.md` file in `unreleased_changes` or use `./tools/create-changelog-entry.py`) --------- Co-authored-by: Florian M <[email protected]>
1 parent 27948cb commit 96d6b45

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ class PlaneMaterialFactory {
253253
},
254254
blendMode: { value: 1.0 },
255255
isFlycamRotated: { value: false },
256+
doAllLayersHaveTransforms: { value: false },
256257
inverseFlycamRotationMatrix: { value: new Matrix4() },
257258
};
258259

@@ -850,6 +851,7 @@ class PlaneMaterialFactory {
850851
this.scaledTpsInvPerLayer = {};
851852
const state = Store.getState();
852853
const layers = state.dataset.dataSource.dataLayers;
854+
let countOfLayersWithTransforms = 0;
853855
for (let layerIdx = 0; layerIdx < layers.length; layerIdx++) {
854856
const layer = layers[layerIdx];
855857
const name = sanitizeName(layer.name);
@@ -869,7 +871,13 @@ class PlaneMaterialFactory {
869871
this.uniforms[`${name}_has_transform`] = {
870872
value: hasTransform,
871873
};
874+
if (hasTransform) {
875+
countOfLayersWithTransforms++;
876+
}
872877
}
878+
this.uniforms.doAllLayersHaveTransforms = {
879+
value: countOfLayersWithTransforms === layers.length,
880+
};
873881
this.recomputeShaders();
874882
},
875883
true,

frontend/javascripts/viewer/shaders/main_data_shaders.glsl.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ uniform uint availableLayerIndexToGlobalLayerIndex[<%= globalLayerCount %>];
7171
uniform vec3 allMagnifications[<%= magnificationsCount %>];
7272
uniform uint magnificationCountCumSum[<%= globalLayerCount %>];
7373
uniform bool isFlycamRotated;
74+
uniform bool doAllLayersHaveTransforms;
7475
uniform mat4 inverseFlycamRotationMatrix;
7576
7677
uniform highp usampler2D lookup_texture;
@@ -483,8 +484,9 @@ void main() {
483484
484485
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
485486
// Early return shader as optimized vertex positioning at bucket borders currently does not work while rotations are active.
487+
// The same goes when all layers of the dataset are transformed.
486488
// This shouldn't really impact the performance as isFlycamRotated is a uniform.
487-
if(isFlycamRotated || !<%= isOrthogonal %>) {
489+
if(isFlycamRotated || !<%= isOrthogonal %> || doAllLayersHaveTransforms) {
488490
return;
489491
}
490492
// Remember the original z position, since it can subtly diverge in the

unreleased_changes/8819.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### Fixed
2+
- Fixed viewing a dataset zoomed far out which has rotations configured in the dataset settings Data Source tab.

0 commit comments

Comments
 (0)