[vtkusers] Color of isosurface

Dale "Luke" Peterson hazelnusse at gmail.com
Mon Jul 2 15:05:00 EDT 2012


I flipped the sign of the gradient in EvaluateGradient() and nothing
changed.  That should have the same effect, correct?

On Mon, Jul 2, 2012 at 11:54 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> I'll bet your normals are point "in" rather than "out".  Try vtkReverSense
> on the output of your isosurface.
>
>
> On Mon, Jul 2, 2012 at 2:37 PM, Dale "Luke" Peterson <hazelnusse at gmail.com>
> wrote:
>> I tried ScalarVisibilityOff() and it didn't fix the problem.  However,
>> it did make me realize that the problem is different from what I
>> originally thought.  I've attached two window screen shots, both with
>> ScalarVisibilityOff().  The only difference is that in the second one,
>> I've called contourActor->GetProperty()->SetColor(0, 0, 1).  You can
>> see that the blue color is just barely visible.
>>
>> Just to check, I tried setting ScalarVisibilityOn(), and then repeated
>> the test with and without calling SetColor(0, 0, 1).  In both cases
>> the surface appears to be very dark but slightly red.  So it seems
>> like red is the default color for the zero-level curve, but for some
>> reason, my surface is showing a whole lot darker than I would like.
>>
>> Thanks for suggestion and let me know if you have any other ideas.
>>
>> Thanks,
>> ~Luke
>>
>>
>> On Mon, Jul 2, 2012 at 10:51 AM, Jothy <jothybasu at gmail.com> wrote:
>>> Can you try contourMapper->setScalarVisibilityOff()
>>>
>>> Jothy
>>>
>>> On 02-Jul-2012, at 5:52 PM, "Dale \"Luke\" Peterson"
>>> <hazelnusse at gmail.com> wrote:
>>>
>>>> I subclassed vtkImplicit function and implemented EvaluateFunction()
>>>> and EvaluateGradient().  I then use vtkSampleFunction,
>>>> vtkContourFilter, vtkPolyDataMapper, and vtkActor and add the actor to
>>>> a renderer.  I am only interested in one iso-surface, the zero
>>>> iso-surface, and in the past it always displayed in red.  Something
>>>> changed (likely in my code) but I can't figure out what, and the the
>>>> surface renders only in black.  I have tried calling
>>>> GetProperty()->SetColor() on the actor but this has no effect.  I also
>>>> tried dropping in example code for the vtkSphereSource which shows up
>>>> blue, as in the tutorial.  Based on this, I'm guessing that there is
>>>> something going on with vtkSampleFunction, vtkContourFilter, or
>>>> vtkPolyDataMapper, but I can't figure out what.
>>>>
>>>> I am doing all of this in my own subclassed QVTKWidget, and the color
>>>> used to work fine.  I also have a minimal example of the surface that
>>>> doesn't use QVTKWidget and it shows the surface in red.  Perhaps there
>>>> is something strange going on in Qt?
>>>>
>>>> Any ideas on what might be going on?
>>>>
>>>> The relevant code I have in the constructor of my QVTKWidget subclass
>>>> is:
>>>>
>>>>  configurationSurface = vtkSmartPointer<vtkHolonomicConstraint>::New();
>>>>  sample = vtkSmartPointer<vtkSampleFunction>::New();
>>>>  sample->SetSampleDimensions(50, 50, 50);
>>>>  sample->SetImplicitFunction(configurationSurface);
>>>>  // Create the 0 isosurface
>>>>  contour = vtkSmartPointer<vtkContourFilter>::New();
>>>>  contour->SetInputConnection(sample->GetOutputPort());
>>>>  contour->GenerateValues(1, 0.0, 0.0);
>>>>  contour->Update();
>>>>
>>>>  // Map the contours to graphical primitives
>>>>  contourMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
>>>>  contourMapper->SetInputConnection(contour->GetOutputPort());
>>>>
>>>>  // Create an actor for the contours
>>>>  contourActor = vtkActor::New();
>>>>  contourActor->SetMapper(contourMapper);
>>>>
>>>>  // Has no effect: still shows up as black.
>>>>  contourActor->GetProperty()->SetColor(0,0,1);
>>>>
>>>> Thanks,
>>>> Luke
>>>>
>>>>
>>>> --
>>>> “People call me a perfectionist, but I'm not. I'm a rightist. I do
>>>> something until it's right, and then I move on to the next thing.”
>>>> ― James Cameron
>>>> _______________________________________________
>>>> 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
>>
>>
>>
>> --
>> “People call me a perfectionist, but I'm not. I'm a rightist. I do
>> something until it's right, and then I move on to the next thing.”
>> ― James Cameron
>>
>> _______________________________________________
>> 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
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com



-- 
“People call me a perfectionist, but I'm not. I'm a rightist. I do
something until it's right, and then I move on to the next thing.”
― James Cameron



More information about the vtkusers mailing list