[vtkusers] Customized Volume Rendering, and Camera Vision

Jeffrey Meng mengjinjie at gmail.com
Tue Mar 22 16:44:31 EST 2005


Thanks a bunch. Please see my comments below:

> The need to mark points that have been seen is sounding like a ray tracing
> problem, because you must correctly determine points occluded from each
> view position. This would be a bit slow just for one view position, and
> quite a big problem for a moving camera (many view points).
> 
> vtkPicker and more specifically vtkCellPicker 'shoot' a ray from the camera
> to the focal point in the scene and determine what was intersected. A quick
> peek at the code shows this is done brute force: each cell is tested with
> IntersectWithLine, and the closest intersection is remembered.

I understand vtkCell::IntersectWithLine sure is a good tool to find
visuiable cell.
But I have been trying to:

1. How to iterate through the cell level? (From vtkMapper? vtkActor?)

2. Even I could get the cell level, how could I change the color of
the cell? (vtkCell doesn't
provide such function)

3. Even if I could set color for the cell, I still have to override
Render or function like that to achieve my purpose.

> Assuming you could specify the camera path and orientation at a set of
> discrete steps (more steps = more accurate and slower) you could write a
> class to do this as follows:
> 1  Initialise scalars to 0s
> 2  for each camera position
> 3    for each point in dataset
> 4      if point p1 inside camera view frustrum
> 5        for each cell in dataset (watch out for own cell)
> 6          if line from p1 to camera position 'intersects' cell
> 7            break out of cell loop, this point is occluded
> 8          if point was not occluded
> 9            set its scalar to 1, it was visible
> 
> At 4 you could avoid processing points where scalar is already 1
> At 9 you could set scalar to integer representing camera position in
> sequence, giving points that were seen and at which step.

Thanks for the pseduo code, I will digest it when I am home.
 
> This simplistic approach sounds quite easy to do, (vtkCell has
> IntersectWithLine for the critical test) but it would certainly not be
> fast. If you wanted this to happen interactivly you would not pre-specify
> camera path but find a way to get render events and process the dataset at
> each render. Take a look at how vtkFollower knows the camera has moved, or
> look at AddObserver stuff?
> Note the end result would be accurate only to the resolution of points in
> the dataset, ie the exact boundary of visible/not on cell faces is not
> determined. More points (see vtkLinearSubdivisionFilter...) would give more
> accuracy, (and slower speed).
> 
> A vtkLookupTable with opacity 0 (or < 1) for scalar=0 could be one useful
> way to view the result, pieces not seen would disappear (or be lighter).

Speed is not the major concern at this point, I will have to make it
happen before doing
any improvement or optimization.

>    Dave P.

Thank you for your help again, and please continue to help. :)



More information about the vtkusers mailing list