Skip to content

Commit

Permalink
Revert skipping refinement in mip/minip
Browse files Browse the repository at this point in the history
  • Loading branch information
aganders3 committed Apr 20, 2023
1 parent 3cb973a commit 84a7901
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions vispy/visuals/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@
before_loop="""
float maxval = u_mip_cutoff; // The maximum encountered value
int maxi = -1; // Where the maximum value was encountered
bool refine = true; // Whether to refine the frag with smaller steps
""",
in_loop="""
if ( val > maxval ) {
Expand All @@ -376,13 +375,12 @@
if ( maxval >= clim.y ) {
// stop if no chance of finding a higher maxval
iter = nsteps;
refine = false;
}
}
""",
after_loop="""
// Refine search for max value, but only if anything was found
if ( maxi > -1 && refine) {
if ( maxi > -1 ) {
// Calculate starting location of ray for sampling
vec3 start_loc_refine = start_loc + step * (float(maxi) - 0.5);
loc = start_loc_refine;
Expand All @@ -401,10 +399,6 @@
}
frag_depth_point = max_loc_tex * u_shape;
gl_FragColor = applyColormap(maxval);
} else if ( maxi > -1 ) {
// skip refinement if already minimum wrt contrast
frag_depth_point = (start_loc + step * float(maxi)) * u_shape;
gl_FragColor = applyColormap(maxval);
} else {
discard;
}
Expand Down Expand Up @@ -449,7 +443,6 @@
before_loop="""
float minval = u_minip_cutoff; // The minimum encountered value
int mini = -1; // Where the minimum value was encountered
bool refine = true;
""",
in_loop="""
if ( val < minval ) {
Expand All @@ -458,13 +451,12 @@
if ( minval <= clim.x ) {
// stop if no chance of finding a lower minval
iter = nsteps;
refine = false;
}
}
""",
after_loop="""
// Refine search for min value, but only if anything was found
if ( mini > -1 && refine ) {
if ( mini > -1 ) {
// Calculate starting location of ray for sampling
vec3 start_loc_refine = start_loc + step * (float(mini) - 0.5);
loc = start_loc_refine;
Expand All @@ -484,10 +476,6 @@
frag_depth_point = min_loc_tex * u_shape;
gl_FragColor = applyColormap(minval);
}
else if ( mini > -1 ) {
// skip refinement if already minimum wrt contrast
frag_depth_point = (start_loc + step * float(mini)) * u_shape;
gl_FragColor = applyColormap(minval);
} else {
discard;
}
Expand Down

0 comments on commit 84a7901

Please sign in to comment.