Skip to content

Commit 3659cda

Browse files
TreatTrickfinetjul
authored andcommitted
fix(vtkWebGPUImageCPRMapper): projection direction should use vtkImageData direction matrix
1 parent 7bfb552 commit 3659cda

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

  • Sources/Rendering/WebGPU/ImageCPRMapper

Sources/Rendering/WebGPU/ImageCPRMapper/index.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ fn sampleOpacityRow(value: f32, row: f32) -> f32
110110
111111
fn getProjectedValue(volumePosTC: vec3<f32>, projectionDirection: vec3<f32>) -> vec4<f32>
112112
{
113-
let volumeSize = max(mapperUBO.VolumeSizeMC.xyz, vec3<f32>(0.000001));
114-
let scaledDirection = projectionDirection / volumeSize;
113+
let scaledDirection =
114+
(mapperUBO.MCTCMatrix * vec4<f32>(projectionDirection, 0.0)).xyz;
115115
let projectionStep = mapperUBO.ProjectionParams.z * scaledDirection;
116116
let projectionStart = volumePosTC + mapperUBO.ProjectionParams.y * scaledDirection;
117117
@@ -627,14 +627,6 @@ function vtkWebGPUImageCPRMapper(publicAPI, model) {
627627
mat4.multiply(tmpMat4, tmp2Mat4, modelToIndex);
628628
model.UBO.setArray('MCTCMatrix', tmpMat4);
629629

630-
const spacing = image.getSpacing();
631-
model.UBO.setArray('VolumeSizeMC', [
632-
spacing[0] * dims[0],
633-
spacing[1] * dims[1],
634-
spacing[2] * dims[2],
635-
1.0,
636-
]);
637-
638630
const centerPoint = model.renderable.getCenterPoint();
639631
model.UBO.setArray('GlobalCenterPoint', [
640632
...(centerPoint ?? [0.0, 0.0, 0.0]),
@@ -939,7 +931,6 @@ export function extend(publicAPI, model, initialValues = {}) {
939931
model.UBO.addEntry('BCSCMatrix', 'mat4x4<f32>');
940932
model.UBO.addEntry('MCTCMatrix', 'mat4x4<f32>');
941933
model.UBO.addEntry('BackgroundColor', 'vec4<f32>');
942-
model.UBO.addEntry('VolumeSizeMC', 'vec4<f32>');
943934
model.UBO.addEntry('GlobalCenterPoint', 'vec4<f32>');
944935
model.UBO.addEntry('UniformOrientation', 'vec4<f32>');
945936
model.UBO.addEntry('TangentDirection', 'vec4<f32>');

0 commit comments

Comments
 (0)