[vtkusers] volume rendering using CPU instead of GPU

David Gobbi david.gobbi at gmail.com
Wed Jan 5 23:30:04 EST 2011


Hi Mark,

I tested a modified version of the Medical4 example on my home
machine (NVidia 9800 GT under Linux) and it displayed the attached
image as a result.  The rendering was very fast, but I was only doing
a 128x128x93 data set.

To get AdditiveMode to work without saturating the result, I set the
opacity to a constant value of 0.015, as shown below (python code).

volumeScalarOpacity = vtk.vtkPiecewiseFunction()
volumeScalarOpacity.AddPoint(0,     0.015)
volumeScalarOpacity.AddPoint(1200,  0.015)

  David


On Wed, Jan 5, 2011 at 5:20 PM, Mark Roden <mmroden at gmail.com> wrote:
> OK, I think I found the error.
>
>  const char *gl_vendor=reinterpret_cast<const char *>(glGetString(GL_VENDOR));
>  if(strstr(gl_vendor,"ATI")!=0)
>    {
>    this->LoadExtensionsSucceeded=0;
>    return;
>    }
>
> Why no ATI cards?  Is there some cmake flag I can set for this, or am
> I just SOL?  My graphics code editing experience is limited at best,
> but if there's a set of functions I can look at doing to get ATI
> working, lemme know.
>
> If I comment out those lines, the program now fails (badly) in
> AllocateFrameBuffers.  I'll have to switch to C++ to track down the
> error further, so that's next, I guess.
>
> Mark
>
> On Wed, Jan 5, 2011 at 3:04 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>> Just one additional note.  I just looked at the code for the various
>> volume mappers, and only the vtkGPUVolumeRayCastMapper
>> supports the Additive mode.  This mode is not supported by the
>> vtkVolumeRayCastMapper or vtkFixedPointVolumeRayCastMapper.
>>
>> I think that I'll play around with this a bit myself when I get home
>> (since only my home computer supports this GPU stuff).  I'm kind
>> of curious about how well this Additive mode works.
>>
>>  David
>>
>>
>> On Wed, Jan 5, 2011 at 3:40 PM, Mark Roden <mmroden at gmail.com> wrote:
>>> Hi David,
>>>
>>> Thanks for the pointers.  I had been looking at those tests earlier.
>>> I'm considering porting at least the additive test to java, just to
>>> see if it works.  I have a version of the Medical3 test in java, and
>>> doing so will let me know if I should expect this to work, and if not,
>>> to have a concise piece of code to demonstrate the error in the hopes
>>> it can be fixed.
>>>
>>> Mark
>>>
>>> On Wed, Jan 5, 2011 at 1:58 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>>> It looks like I might have been wrong about my last statement.
>>>> I see this in vtkVolumeMapper.h:
>>>>
>>>>  SetBlendModeToAdditive();
>>>>
>>>> So it looks like at least some of the VTK volume renderers
>>>> can do summation.  It looks like there are even some tests:
>>>>
>>>> VolumeRendering/Testing/Cxx/TestGPURayCastAdditive.cxx
>>>> VolumeRendering/Testing/Cxx/TestGPURayCastPerspectiveParallel.cxx
>>>>
>>>> Interesting stuff.
>>>>
>>>>  David
>>>>
>>>>
>>>> On Wed, Jan 5, 2011 at 2:35 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>>>> About all that I can suggest is that you look directly into the code for
>>>>> vtkOpenGLGPUVolumeRayCastMapper::LoadExtensions() and see
>>>>> what extension is failing.
>>>>>
>>>>> In LoadExtensions(), the one place where it can fail without printing
>>>>> the extension it failed on is right here:
>>>>>
>>>>>    if(glslMajor<1 || (glslMajor==1 && glslMinor<20))
>>>>>      {
>>>>>      this->LoadExtensionsSucceeded=0;
>>>>>      }
>>>>>
>>>>> That might provide you with some clues.
>>>>>
>>>>> Also, don't forget my earlier comment that VTK volume rendering
>>>>> does not do averaging or summation, so if averaging is what you
>>>>> need, then all of this is moot :)
>>>>>
>>>>>  David
>>>>>
>>>>>
>>>>> On Wed, Jan 5, 2011 at 2:11 PM, Mark Roden <mmroden at gmail.com> wrote:
>>>>>> Hi David,
>>>>>>
>>>>>> I'm actually doing this on Windows this time.  Sorry I didn't
>>>>>> specify-- although it's good to know to not even try on the mac just
>>>>>> yet :)
>>>>>>
>>>>>> Thanks,
>>>>>> Mark
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: additive.png
Type: image/png
Size: 17832 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110105/04df9a01/attachment.png>


More information about the vtkusers mailing list