[vtkusers] Volume Rendering, cell mode, and rotation optimization - VTK macro bug/issue?

Karthik Krishnan karthik.krishnan at kitware.com
Sat May 18 23:35:38 EDT 2013


Rick:

The DesiredUpdateRate of the render window is a changing quantity. Its
usually the same as the StillUpdateRate of the interactor (which defaults
to a really low number, implying that the StillRender can take as long as
it needs to).

During interaction, the interactor style switches the DesiredUpdateRate of
the RenderWindow to the interactor's InteractiveUpdateRate, so as to
maintain interactivity. At the end of the interaction it switches the
DesiredUpdateRate back to the interactor's StillUpdateRate. This results in
a coarser render during interaction followed by a high resolution render at
the end of the interaction.

The if-block in the GPURenderMode is consistent with this intent:
   usedMapper->SetAutoAdjustSampleDistances(****
        ren->GetRenderWindow()->GetDesiredUpdateRate()>=****
        this->InteractiveUpdateRate);

Its saying: During interaction, adjust the ImageSampling to achieve the
interactive frame rate. When not interacting, don't adjust the image
sampling.

I don't see a bug here.

What's probably incorrect is the InteractiveUpdateRate which you've set to
1 (ie a frame a second). You want to set that to a much larger number  15 ~
30.

Also your check via the debugger was probably done prior to interaction and
not during interaction itself, so your conclusions would be misleading.

Hope this helps
--
karthik



On Sun, May 19, 2013 at 2:21 AM, Richard Frank <rickfrank at me.com> wrote:

> On researching my previous question about how the volume rendering is made
> lower resolution during rotation,
> I did some tracing of the code, and found what I believe is a problem
> related to a Macro.
>
> This is the section of code that determines whether the sampling  distance
> is computed on the fly for the GPURenderMode:
>
> case vtkSmartVolumeMapper::GPURenderMode:****
>     ...
>       usedMapper->SetAutoAdjustSampleDistances(****
>         ren->GetRenderWindow()->GetDesiredUpdateRate()>=****
>         this->InteractiveUpdateRate);****
>       usedMapper->Render(ren, vol);****
>       break;****
> ** **
> **
> **
> **Here it seems that SetAutoAdjustSampleDistance(int) if passed 0 will
> turn off auto adjusting sampling distance.**
> **
> **
> **If I look at **
> **
> **
> **ren->GetRenderWindow()->GetDesiredUpdateRate() it is equal to 0.0001;**
> **
> **
> **this->InteractiveUpdateRate == 1.0;**
> **
> **
> **so, **GetDesiredUpdateRate is not greater than or equal to
> InteractiveUpdateRate,
> and so SetAutoAdjustSampleDistances() should be passed 0 (or false) and
> turned off.
>
> But it's not.
>
> SetAutoAdjustSampleDistance is defined as some macros
> / Description:****
>   // If AutoAdjustSampleDistances is on, the the ImageSampleDistance****
>   // will be varied to achieve the allocated render time of this****
>   // prop (controlled by the desired update rate and any culling in****
>   // use).****
>   vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );****
>   vtkGetMacro( AutoAdjustSampleDistances, int );****
>   vtkBooleanMacro( AutoAdjustSampleDistances, int );
>
>
> if I change the code to
>
> int val = ren->GetRenderWindow()->GetDesiredUpdateRate()>=
>         this->InteractiveUpdateRate;
>
> usedMapper->SetAutoAdjustSampleDistances(val);
>
> val is 0 and still doesn't turn it off.
>
>
> HOWEVER if I change the code to
>
>
> usedMapper->SetAutoAdjustSampleDistances(0);
>
> IT WORKS - the Auto Adjustment is off and I get smooth rotations.
>
> Seems odd to me, and perhaps a bug with the macro definition?
>
> I'm using Windows Visual Studio 7, but we also see this on Ubuntu Linux
> with gcc
>
> Can someone verify?
>
>
> Thanks
>
> Rick
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>


-- 
karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130519/67193e4a/attachment.htm>


More information about the vtkusers mailing list