Skip to content

Correct displayed sources bounds - #32

Open
ekatrukha wants to merge 6 commits into
bigdataviewer:masterfrom
ekatrukha:correctDisplayedSourcesBounds
Open

ekatrukha wants to merge 6 commits into
bigdataviewer:masterfrom
ekatrukha:correctDisplayedSourcesBounds

Conversation

@ekatrukha

@ekatrukha ekatrukha commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Hello Tobias @tpietzsch,

I've looked into the rendering of those border "half pixels" again.
Here is an example (code) comparing two 5x5x5 volumes side-by-side:
"simple" RAI on the left and "multires" on the right (shifted by 5 pixels in X).

bvv_current

They are not identical. The reason is that in the "simple" and "multires" intersection box is calculated as:

intersectBox( mfront.xyz, (mback - mfront).xyz, vec3( 0, 0, 0 ), sourcemax, tnear, tfar );
intersectBox( mfront.xyz, (mback - mfront).xyz, sourcemin, sourcemax, tnear, tfar );

For the source from 0 to N-1 it would span [0; N-1], but it should be [-0.5, N-0.5].

This is the reason why single plane (or just 2D) images are not currently displayed in BVV.

Correcting this for all sampling shaders

intersectBox( mfront.xyz, (mback - mfront).xyz, vec3( -0.5, -0.5, -0.5 ), sourcemax + 0.5, tnear, tfar );
intersectBox( mfront.xyz, (mback - mfront).xyz, sourcemin - 0.5, sourcemax + 0.5, tnear, tfar );

gives:
bvv_correct_range

So either there is no zero padding from (0,0,0), or texture reading in the shader is wrong.
Looking at this code, I think the padding is ok (paddOffset is subtracted from min).
Now, fixing the multires sampling shader finally gives:

bvv_correct_all I will close my previous PR on this topic.

Cheers,
Eugene

p.s. Working on this, I've noticed the Multibox sources view is not correct, so I've submitted another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant