[vtkusers] vtkQuadricDecimation - color defects

David Gobbi david.gobbi at gmail.com
Tue Mar 19 12:06:56 EDT 2013


Can send a patch file and/or a short code segment that shows your fixes so far?

There might be some massive overshoot/undershoot in the computation
of the scalars, but that's just a guess because I've never looked at the
code that vtkQuadricDecimation uses to interpolate the scalars.  The
fact that clamping is necessary at all suggests that the interpolation
is not a simple weighted averaging of the original scalars.

 - David


On Tue, Mar 19, 2013 at 9:53 AM, Nigel Mcfarlane
<Nigel.Mcfarlane at beds.ac.uk> wrote:
> Hi David,
> Thanks for your help.  I have been able to fix the colour-spot problem by
> clamping the scalar values as you suggested.  However, I am still getting
> black scalars on the boundaries at high levels of decimation (2**7 or more)
> so I will look further into it.
> Nigel
>
>
>>>> David Gobbi <david.gobbi at gmail.com> 18/03/2013 22:09 >>>
> Hi Nigel,
>
> I'm certain that you are correct, it is an overflow bug.  I looked at
> vtkQuadricDecimation::SetPointAttributeArray() and it calls the
> following vtkDataArray method for each component (in your case,
> for R, G, B):
>
> scalars->SetComponent(pointId, i, v);
>
> SetComponent() just calls static_cast, it does no clamping. So
> overflows are likely to occur.
>
> Ideally vtkQuadricDecimation::SetPointAttributeArray() should call
> GetDataTypeMin() and GetDataTypeMax() on the scalar array and
> clamp the value to this range before inserting it into the array.  If you
> are able to fix the code, we can get your fix into VTK 5.10.2/VTK 6.0.
>
> - David
>
>
> On Mon, Mar 18, 2013 at 11:53 AM, Nigel Mcfarlane
> <Nigel.Mcfarlane at beds.ac.uk> wrote:
>> I am using vtkQuadricDecimation to reduce a triangular mesh with
>> color_scalar attributes.  After decimation, I get single-point errors in
>> the
>> colors which look as if they might be an overflow error in the color
>> interpolation.  If the decimation is repeated recursively, the errors
>> accumulate and start to form on the boundary points, turning the mesh
>> edges
>> black.  The errors appear when there is high-frequency noise in the color
>> pattern; if the color is smooth there is no problem.  It does not seem to
>> depend on the topography of the mesh.  The color scalars are unsigned char
>> with 3 components.  AttributeErrorMetric is On, NormalsAttribute is Off,
>> and
>> the TargetReduction is 0.5.  I am using VTK5.10, but it also happens in
>> VTK4.   Is this a known problem, and if so is there anything I can do
>> about
>> it?
>> Thank you
>> Nigel McFarlane
>> University of Bedfordshire, UK



More information about the vtkusers mailing list