[vtkusers] Opacity discrepancy with downscaled volume despite opacity unit distance == spacing

Elvis Stansvik elvis.stansvik at orexplore.com
Mon Feb 13 04:14:57 EST 2017


2017-02-12 18:06 GMT+01:00 David Gobbi <david.gobbi at gmail.com>:

>
>
> On Sun, Feb 12, 2017 at 10:01 AM, Elvis Stansvik <
> elvis.stansvik at orexplore.com> wrote:
>
>> 2017-02-12 17:56 GMT+01:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>>
>>> 2017-02-12 17:31 GMT+01:00 David Gobbi <david.gobbi at gmail.com>:
>>>
>>>> Hi Elvis,
>>>>
>>>> Here is something you can do as a check: set the sample distance for
>>>> the ray casting to a very small value, so that it takes around 1000 steps
>>>> for the ray to traverse the volume from front to back.  The thickness of
>>>> your volume is 29*0.006 = 0.174, so you can try a sample spacing
>>>> of 1.74e-04:
>>>>
>>>> mapper->AutoAdjustSampleDistancesOff();
>>>> mapper->SetSampleDistance(1.74e-04);
>>>>
>>>> If the two volumes look the same when you use a small sample distance,
>>>> then the difference you were seeing was probably just due to discretization.
>>>>
>>>
>>> That indeed did the trick, thanks David!
>>>
>>
>> And to clarify: The small difference I was seeing when I had the sample
>> distance left to auto-adjusted isn't really a problem for my application. I
>> was just surprised there was still a small difference even when both
>> volumes were rendered with the same opacity unit distance, and I wanted to
>> find the explanation for it. The discretization error coming into play
>> makes sense.
>>
>
> So everything should be fine if you leave AutoAdjustSampleDistances "On",
> for the interactive rendering, but set the SampleDistance to half of your
> high-res volume spacing for the high quality rendering (e.g. use 0.003 for
> this data set).
>

I had a look at the code, and it seems that if AutoAdjustSampleDistances is
left On, then any explicitly set SampleDistance is ignored [1].

Maybe the docs for SampleDistance should be updated. They currently say:

    "Set/Get the distance between samples used for rendering when
AutoAdjustSampleDistances is off, or when this mapper has more than 1
second allocated to it for rendering."

I interpret that as saying SampleDistance will have an effect for still
renderings (> 1 sec), even if AutoAdjustSampleDistances is left On. Or am I
misreading the docs and/or code here?

Elvis

[1]
https://gitlab.kitware.com/vtk/vtk/blob/master/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx#L1667-1725


>  - David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170213/3c9d7376/attachment.html>


More information about the vtkusers mailing list