[vtkusers] volume rendering using CPU instead of GPU

Mark Roden mmroden at gmail.com
Thu Jan 6 00:59:18 EST 2011


Hi David,

Thanks for this.

Unfortunately, it looks like ATI cards really aren't supported.  It
seems that the ATI drivers are... problematic in their rendering
support.  I can't ignore half of the market, so I'll need another
hardware solution.

Luckily, it appears that that hardware solution is
vtkVolumeTextureMapper3D.  That's doing what I need it to do, at least
for composite VR. I haven't figured out yet how to make it do additive
transforms.

One note about the ATI thing though, and the mac-- I know that
Starcraft II is using OpenGL on the Mac.  It seems that if Blizzard
can make it happen, then it's possible.  Are they using GLSL?  I have
no idea.  But I do believe that some rendering of some kind in
hardware using OpenGL must be doable  (I'm not suggesting that it's
_easy_, mind you, just possible).

Thanks,
Mark

On Wed, Jan 5, 2011 at 8:30 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> 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
>>>>>>
>>>>>
>>>>
>>>
>>
>



More information about the vtkusers mailing list