<div dir="ltr">I agree with you David.<div>Unfortunately i need dynamic clipping planes and centering on visible bounds, so i will try to do it outside of vtk.</div><div><br></div><div>As for your last note in Mantis about having the same behaviour in <span style="font-family:arial,sans-serif;font-size:13px">vtkPainterPolyDataMapper and </span><span style="font-family:arial,sans-serif;font-size:13px">vtkPolyDataMapper, doesn't that mean that UpdateBounds should not be implemented at all in vtkPainter subclasses?</span></div>
<div><font face="arial, sans-serif">Because in both implementations of ComputeBounds() there is a call to this->GetInput()->GetBounds(this->Bounds); but then </font><span style="font-size:13px;font-family:arial,sans-serif">vtkPainterPolyDataMapper</span><span style="font-family:arial,sans-serif"> calls painter->UpdateBounds(this->Bounds); which will eventually modify the bounds in one of the succession of painters.</span></div>
<div><span style="font-family:arial,sans-serif">But i understand that this is the wanted behaviour. </span></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-02-27 17:28 GMT+01:00 David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Xabi,<br>
<br>
As I mentioned in the bug report, I think the UpdateBounds() method<br>
for vtkClipPlanesPainter should be removed.  I can provide some<br>
additional information here to explain why.  Hopefully someone who is<br>
more familiar with the painter code can confirm or deny my<br>
explanation.  In any case, it's good to have this discussion on the<br>
developer list.<br>
<br>
The UpdateBounds() method is called during the "Update" phase of the<br>
mapper, rather than during the "Render" phase.  During the "Update"<br>
phase, the mapper only sees the "data" side of the pipeline: it has no<br>
access to the actor, the renderer, or the window.  Mapper clipping<br>
planes in VTK are expressed in world coordinates, and the clipping is<br>
typically done in hardware by the GPU.  In other words, clipping<br>
occurs during the "Render" phase.<br>
<br>
If clipping is to be applied to the data itself, using data<br>
coordinates for the clipping planes, then that can be done with e.g.<br>
vtkClipPolyData.  This is slower than hardware clipping if the<br>
clipping planes need to be dynamic.  However, it is faster than<br>
hardware clipping if the clipping planes are static, because it means<br>
that fewer points and cells have to be loaded onto the GPU.<br>
<br>
Your assertion that vtkRenderer::ResetCamera() should take the<br>
hardware (i.e. mapper) clipping planes into consideration is,<br>
unfortunately, one that we will probably have to reject.  Even if it<br>
makes sense that UpdateBounds() should be based on the rendered<br>
representation of the data (rather than just on the data itself), the<br>
clear split between the "Data Update" phase versus the "Data Render"<br>
phase in the mapper makes it nearly impossible.<br>
<br>
My advice, then, is to remove vtkClipPlanesPainter::UpdateBounds().<br>
And for applications where ResetCamera needs to use the clipped<br>
bounds, use vtkClipPolyData instead of setting the planes on the<br>
mapper.<br>
<span class=""><font color="#888888"><br>
  David<br>
</font></span><div class=""><div class="h5"><br>
<br>
On Wed, Feb 26, 2014 at 2:57 AM, Xabi Riobe <<a href="mailto:xabivtk@gmail.com">xabivtk@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I would want to discuss about the issue reported here:<br>
> <a href="http://vtk.org/Bug/view.php?id=11949" target="_blank">http://vtk.org/Bug/view.php?id=11949</a><br>
><br>
> The vtkClipPlanesPainter::UpdateBounds method is incorrect, but should it be<br>
> removed or fixed if possible?<br>
><br>
> the documentation for vtkPainter says:<br>
> " Expand or shrink the estimated bounds of the object based on the geometric<br>
> transformations performed in the painter. If the painter does not modify the<br>
> geometry, the bounds are passed through. "<br>
><br>
> Since we are talking about the painter, i understand that the geometry<br>
> referred here is the one of the data representation, not the data itself.<br>
> And in that case, it is modified if clipped by the planes (in<br>
> vtkOpenGLClipPlanesPainter), so the bounds should be updated.<br>
><br>
> But for that we need the actor's matrix, which is not accessible in the<br>
> method UpdateBounds.<br>
><br>
> And the initial problem is that the vtkRenderer::ResetCamera method should<br>
> take into consideration the clipped bounds in order to recenter about the<br>
> visible geometry.<br>
><br>
> Any ideas or comments about that?<br>
><br>
><br>
> 2013-05-06 17:31 GMT+02:00 xabivtk <<a href="mailto:xabivtk@gmail.com">xabivtk@gmail.com</a>>:<br>
><br>
>> Hi,<br>
>><br>
>> For the 5.10 release, the method vtkClipPlanesPainter::UpdateBounds has<br>
>> been<br>
>> implemented to fix a bug, but i think that there is a transformation<br>
>> missing<br>
>> for the planes, leading to the incorrect culling of some props in the case<br>
>> they have a transformation matrix different than identity.<br>
>><br>
>> this->ClippingPlanes are expressed in world coordinates, after the use of<br>
>> the actor's matrix, whereas the bounds are in data coordinates<br>
>><br>
>> To clip the data, the planes are used in<br>
>> vtkOpenGLClipPlanesPainter::RenderInternal to be passed to glClipPlane<br>
>> after<br>
>> beeing transformed from world to data coords with the use of the actor's<br>
>> matrix.<br>
>> But in the rendering pipeline we have a call to<br>
>> vtkClipPlanesPainter::UpdateBounds where these planes are considered to be<br>
>> in the data coordinates.<br>
>><br>
>> Here is the calling stack:<br>
>><br>
>> vtkClipPlanesPainter::UpdateBounds              ===> original data bounds,<br>
>> but actor's world coordinates transformed planes<br>
>> vtkPainterPolyDataMapper::ComputeBounds<br>
>> vtkPolyDataMapper::GetBounds<br>
>> vtkActor::GetBounds                                  ===> actor's<br>
>> transformation Matrix applied to the bounds<br>
>> vtkFrustumCoverageCuller::Cull                    ===> Prop can be<br>
>> incorrectly culled !!!!<br>
>><br>
>> So in the method vtkClipPlanesPainter::UpdateBounds, the planes should be<br>
>> transformed with the actor's matrix before changing the bounds.<br>
>><br>
>><br>
>> I used to fill a report in the Mantis Bug Tracker for this kind of bug,<br>
>> but<br>
>> it seems that vtk has been removed from it...<br>
</div></div></blockquote></div><br></div></div></div>