[Paraview] Two Sided Lighting

Moreland, Kenneth kmorel at sandia.gov
Tue Feb 13 12:21:48 EST 2007


There is no easy way to do what you want in ParaView.  Filters have no
access to the vtkRenderer in which they will be rendering.  There are a
number of complications implementing this, one if which is that in
general there is no guarantee that the filter object and the renderer
object are even on the same computer.

To access the TwoSidedLighting parameter in the renderer, I think you
are going to have to hack up ParaView.  The easiest way to do this is to
simply change the default for the TwoSidedLighting ivar in vtkRenderer
to 0.  Then all rendering will be one sided.  The next easiest thing is
to expose the TwoSidedLighting parameter in the Renderer proxy and add a
checkbox to the GUI to turn it on and off.  Things get much more
complicated from there.

An alternative to using filters or hacking up ParaView is to use shaders
to do what you want.  Shaders let you completely override the behavior
of the graphics card, so you can implement whatever rendering method you
want.  Furthermore, starting with ParaView 2.6 you can load in your own
shaders without any modifications to the ParaView code.  If you are
interested in using shaders, there is a short description of them in the
latest Kitware Source newsletter
(http://www.kitware.com/products/newsletter/kitware_quarterly1113.pdf)
written by Utkarsh Ayachit.  There is also some other information on the
Kitware Wiki (http://www.paraview.org/Wiki/VTKShaders).

There are some issues with using shaders, however.  The shaders will
only work if you are using graphics hardware or software that has
programmable architecture and the drivers allow you to access them.  If
you bought your graphics card in the last couple years, it is probably
supported.  Another issue is that writing shaders tend to be a bit
slower than using the standard pipeline, although the latest round of
graphics cards seem to have less of a problem in this area.  A pragmatic
issue is that shaders are all-or-nothing.  If you make one, you have to
write the algorithm for all the geometric and/or fragment processing.
That can be a lot of work if you just want to disable two sided
lighting.

-Ken

> -----Original Message-----
> From: paraview-bounces+kmorel=sandia.gov at paraview.org
[mailto:paraview-
> bounces+kmorel=sandia.gov at paraview.org] On Behalf Of Mike Jackson
> Sent: Tuesday, February 13, 2007 8:17 AM
> To: ParaView
> Subject: [Paraview] Two Sided Lighting
> 
> If I write a "filter" for Paraview, is there a base class that I can
> derive from so that I can get access to the "vtkRenderer"? I would
> like create a "filter" to toggle two sided lighting on and off? or is
> there another way to achieve this effect?
>     Basically I have a very complex surface mesh where the parts that
> intersect the bounding box are not sealed off, thus allowing one to
> "see" into the interior of the mesh. By turning off two sided
> lighting, these areas show up as black, or any other color I would
> like. I have my own simple vtk based viewer where I did this so I
> know all the plumbing is there, I just have no idea how to actually
> get to it in ParaView?
>      I guess I could just modify ParaView to always have two sided
> lighting off, but I would rather have a toggle button.
> 
> THanks for any help or pointers.
> --
> Mike Jackson   Senior Research Engineer
> Innovative Management & Technology Services
> 
> 
> 
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview




More information about the ParaView mailing list