[vtk-developers] [vtkusers] volume rendering using CPU instead of GPU
Fauze Polpeta
fauze.polpeta at gmail.com
Mon Jan 10 11:14:14 EST 2011
Dear All;
I shared with Francois Bertel a time ago a workaround I made for Mac,
which turns VTK GPU-based Ray Casting possible on OSX, but yet without
shading. Just let me know about your interest.
Also, I have intention of working on a approach that works in
ATI/NVIDIA cards (and scape from this GLSL linker issues) but didn't
find the time for that.
Best Regards
Fauze
On Sat, Jan 8, 2011 at 3:22 AM, Karthik Krishnan
<karthik.krishnan at kitware.com> wrote:
> CCing the long thread to the dev list for archival (hopefully someone there
> will contribute an ATI build to the dashboard)
>
> So after these three commits, the gist is that GPU ray cast on ATI can now
> work when used without shading. Why it would fail with shading enabled, is
> puzzling, since its essentially the same extensions, just a few more shader
> vars.
>
>
> http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=603423177b3514fd45e68d29ba7d18aa31cbd643
>
> http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=09af243374d6d7cc5bd300147843fa58f5e797a8
>
> http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=d6c9a0bbb5dbced83aee7b76c57779b6f541c212
>
> I'd prefer to continue committing to head since it'll tell me if it works on
> all the dashboard machines.
>
> Thanks
> --
> karthik
>
> On Sat, Jan 8, 2011 at 2:21 AM, Mark Roden <mmroden at gmail.com> wrote:
>>
>> Hi Karthik,
>>
>> Whoops. These are the results with the most recently sycned code.
>> Same three tests are failing.
>>
>> If you want, we can set up some kind of skype dual-programming on
>> Monday if you need to have faster feedback. I could sync to a branch
>> in git that you're working in and compile and run the tests
>> immediately. When we do this by email, I start working on other
>> projects in the meantime.
>>
>> Thanks,
>> Mark
>>
>>
>> On Fri, Jan 7, 2011 at 10:15 AM, Karthik Krishnan
>> <karthik.krishnan at kitware.com> wrote:
>> > Thanks Mark:
>> >
>> > Great. We are getting there.
>> >
>> > Did you also update VTK from git. As I mentioned earlier, I committed a
>> > third fix to VTK for the ATI stuff hours ago, so as to set the size of
>> > the
>> > max/min/additive value FBOs before their attachment is done.
>> >
>> >
>> >
>> > http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=HEAD;hp=abd3dde48cd35e9e5b2c744735e5f12a33333af2
>> >
>> > I was hoping that would get rid of the "AllocateFrameBuffers ERROR
>> > (x502)
>> > Invalid operation" output on the test results that you have. I know they
>> > pass, but its a bad sign.
>> >
>> > Please update vtk and then send us the result.
>> >
>> > ------
>> >
>> > Now to the 3 remaining test failures. The 3 failing tests all use
>> > shading.
>> > All the tests that pass don't use shading. This is something I'm finding
>> > on
>> > my macs too and I haven't yet gotten to the bottom of it. I'm not sure
>> > why
>> > volume rendering with shading should fail since they don't need any
>> > extra
>> > extensions, as compared to not using shading. They just need a few more
>> > shader vars to be passed. Will take a closer look at that.
>> >
>> > Thanks again for your help.
>> > --
>> > karthik
>> >
>> > On Fri, Jan 7, 2011 at 11:34 PM, Mark Roden <mmroden at gmail.com> wrote:
>> >>
>> >> Hi Karthik,
>> >>
>> >> So I pulled the VTKData as per: http://www.vtk.org/Wiki/VTK/Git
>> >> Then re-cmaked with the new data directory. I'm attaching these test
>> >> results now.
>> >>
>> >> Down to just three test failures, excellent!
>> >>
>> >> Thanks,
>> >> Mark
>> >>
>> >>
>> >> On Thu, Jan 6, 2011 at 11:10 PM, Karthik Krishnan
>> >> <karthik.krishnan at kitware.com> wrote:
>> >> > Thanks for your help Mark:
>> >> >
>> >> > I committed a third fix:
>> >> >
>> >> >
>> >> >
>> >> > http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=HEAD;hp=abd3dde48cd35e9e5b2c744735e5f12a33333af2
>> >> >
>> >> > Could you please update. Also please switch to VTKData git. And send
>> >> > us
>> >> > the
>> >> > test results again.
>> >> >
>> >> > -------------
>> >> >
>> >> > Long summary:
>> >> >
>> >> > 11 of the GPU ray casting tests do pass with this change. Now to the
>> >> > 6
>> >> > failed tests ...
>> >> >
>> >> > 4 tests can't locate baseline files. it appears that you are using
>> >> > VTKData-5.6. I've added a few tests/baselines since. Please update
>> >> > VTKData
>> >> >
>> >> > TestGPURayCastAdditive - Update VTKData
>> >> > TestGPURayCastCompositeBinaryMask - Update VTKData
>> >> > TestGPURayCastMIPBinaryMask - Update VTKData
>> >> > TestGPURayCastPerspectiveParallel - Update VTKData
>> >> >
>> >> > The following tests report "AllocateFrameBuffers ERROR (x502) Invalid
>> >> > operation" , although they pass:
>> >> >
>> >> > TestGPURayCastAdditive
>> >> > TestGPURayCastCompositeToMIP
>> >> > TestGPURayCastDataTypesMinIP
>> >> > TestGPURayCastMIPBinaryMask
>> >> > TestGPURayCastDataTypesMIP
>> >> > TestGPURayCastFourComponentsMinIP
>> >> > TestGPURayCastFourComponentsMIP
>> >> > TestGPURayCastMIPToComposite
>> >> > TestGPURayCastNearestDataTypesMIP
>> >> >
>> >> > Now to the two remaining tests that appear to have really failed :
>> >> >
>> >> > TestGPURayCastCompositeShadeMask
>> >> > TestGPURayCastCropping
>> >> >
>> >> > The following tests pass without errors:
>> >> >
>> >> > TestGPURayCastCompositeMaskBlend
>> >> > TestGPURayCastCompositeMask
>> >> > TestGPURayCastFourComponentsComposite
>> >> > TestGPURayCastFourComponentsCompositeStreaming
>> >> >
>> >> >
>> >> > As you can see, the MIP, MinIP and Additive modes produce errors. The
>> >> > fact
>> >> > is that modes use an extra FBO to store the max/min/add value. I've
>> >> > made
>> >> > the
>> >> > following commit to set the size of this FBO as well before they are
>> >> > attached. That should hopefully get these modes working too on the
>> >> > ATI.
>> >> >
>> >> > -------------
>> >> >
>> >> > Mark: Onto your second question about the GPURenderDemo. We really
>> >> > should
>> >> > rename this demo.
>> >> >
>> >> > The GPURenderDemo example uses a vtkSmartVolumeMapper, which is
>> >> > essentially
>> >> > a "mapper chooser", ie if a GPU mapper is not supported due to any
>> >> > required
>> >> > extensions, it will fall back to either 3D texture mapping or to
>> >> > software
>> >> > rendering. (We should remove GPU from its name). That's the reason
>> >> > why
>> >> > its
>> >> > coming up quickly.. It just may not be doing a GPU ray cast :)
>> >> >
>> >> > -----
>> >> >
>> >> > Thanks again for your help.
>> >> >
>> >> > --
>> >> > karthik
>> >> >
>> >> > On Fri, Jan 7, 2011 at 4:32 AM, Mark Roden <mmroden at gmail.com> wrote:
>> >> >>
>> >> >> Hi Karthik,
>> >> >>
>> >> >> I've attached the test results. The first one passed, the second
>> >> >> one
>> >> >> not so much.
>> >> >>
>> >> >> The interesting thing is that I have a pelvic CT study that appears
>> >> >> to
>> >> >> run very well on the GPURenderDemo MIP mode. Not sure if those
>> >> >> other
>> >> >> test failures mean I can't use composite mode or what, though.
>> >> >>
>> >> >> Also, the GPURenderDemo contexts come up _much_ more rapidly than
>> >> >> when
>> >> >> I try to load things in Java. Would you know of any particular
>> >> >> reason
>> >> >> why a context would be slow to load?
>> >> >>
>> >> >> Thanks,
>> >> >> Mark
>> >> >>
>> >> >> On Thu, Jan 6, 2011 at 8:00 AM, Mark Roden <mmroden at gmail.com>
>> >> >> wrote:
>> >> >> > Hi Karthik,
>> >> >> >
>> >> >> > Thanks for this! I'll take a look. I've been having problems
>> >> >> > getting
>> >> >> > the gdcm git head to work with the vtk git head-- there appears to
>> >> >> > be
>> >> >> > some kind of misalignment in the java wrappings, as the
>> >> >> > vtkStringArray
>> >> >> > needed by gdcm to read a DICOM image appeared to have some
>> >> >> > problems
>> >> >> > getting initialized when in java. I'll retry, because I'd rather
>> >> >> > be
>> >> >> > at the head anyway instead of 5.6.1.
>> >> >> >
>> >> >> > Mark
>> >> >> >
>> >> >> > On Wed, Jan 5, 2011 at 11:46 PM, Karthik Krishnan
>> >> >> > <karthik.krishnan at kitware.com> wrote:
>> >> >> >> Mark:
>> >> >> >>
>> >> >> >> I put some fixes in to attempt getting volume rendering to work
>> >> >> >> on
>> >> >> >> ATI.
>> >> >> >> The
>> >> >> >> FBO creation fails on ATI, probably because the assignment of the
>> >> >> >> Renderbuffer/Texture is made to the FBO before the size of those
>> >> >> >> is
>> >> >> >> set.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=09af243374d6d7cc5bd300147843fa58f5e797a8
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=d6c9a0bbb5dbced83aee7b76c57779b6f541c212
>> >> >> >>
>> >> >> >>
>> >> >> >> Could you please update your repository and send me the results
>> >> >> >> of
>> >> >> >> the
>> >> >> >> following :
>> >> >> >>
>> >> >> >> ctest -R LoadOpenGLExtension -V
>> >> >> >> ctest -R TestGPU -V
>> >> >> >>
>> >> >> >> Alternatively you could submit to the dashboard. There are no
>> >> >> >> ATI's
>> >> >> >> on
>> >> >> >> the
>> >> >> >> VTK dashboard, so we are grateful for any contributions.
>> >> >> >>
>> >> >> >> Thanks
>> >> >> >> --
>> >> >> >> karthik
>> >> >> >>
>> >> >> >>
>> >> >> >> On Thu, Jan 6, 2011 at 5:50 AM, 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
>> >> >> >>> >>>>
>> >> >> >>> >>>
>> >> >> >>> >>
>> >> >> >>> >
>> >> >> >>> _______________________________________________
>> >> >> >>> 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
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>
More information about the vtk-developers
mailing list