[vtkusers] vtkLODActor->GetProperty()->SetColor() does not maintain the input color?

Hong Yi hongyi at renci.org
Fri Mar 2 10:56:53 EST 2012


Attached is an image with three actors colored by green, orange, and bluish, with the real color legend along with RGB values used on the right. 

I did not color any of the lights in my scene. Here is the code snippet I used to set up each actor:

Actor->GetProperty()->LightingOn();
Actor->GetProperty()->SetRepresentationToSurface();
Actor->GetProperty()->SetInterpolationToGouraud();
Actor->GetProperty()->SetColor(StructColors[i]);
Actor->GetProperty()->SetOpacity(0.6);
Actor->SetNumberOfCloudPoints(30000);
Actor->SetUserTransform(transform);

I just turned on the lighting on the actor without explicitly manipulating lights at all (I assume the default lights should be white lights). I also tried to set up the diffuse, ambient, and specular parameters rather than setting color directly, but got the same kind of color mismatch. Let me know if you need more information. Any further comments and insights are very much appreciated.

Thanks,

Hong

-----Original Message-----
From: David E DeMarle [mailto:dave.demarle at kitware.com] 
Sent: Friday, March 02, 2012 9:38 AM
To: Hong Yi
Cc: Jothybasu Selvaraj; VTK Users
Subject: Re: [vtkusers] vtkLODActor->GetProperty()->SetColor() does not maintain the input color?

Can you post an image along with a description of the RGB values you are setting?

Also, please verify for us that none of the lights in your scene are colored themselves. If that isn't the case the only variation of colors for the objects should be the intensity variation due to the diffuse color term of the lighting equation. I.e. they get darker the more they turn away from the camera.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909



On Fri, Mar 2, 2012 at 9:28 AM, Hong Yi <hongyi at renci.org> wrote:
> I already set ScalarVisibilityOff() on the corresponding mappers, and 
> not use scalar for color mapping at all, since the entire polydata 
> will be colored in the same color as set to the corresponding actor. 
> The problem is some of the uniform colors being displayed are not 
> exactly the color being set to the actor, for example, the orange 
> color (displayed on the legend) gets mapped to yellow for the actor in 
> the view. Some color like green gets mapped correctly, but not some 
> other colors. I have set lighting on, but did not expect the color 
> could be off so much in many cases. Any insight/comment/suggestion is very much appreciated.
>
>
>
> Thanks,
>
>
>
> Hong
>
>
>
> From: Jothybasu Selvaraj [mailto:jothybasu at gmail.com]
> Sent: Friday, March 02, 2012 4:16 AM
> To: Hong Yi
> Cc: VTK Users
> Subject: Re: [vtkusers] vtkLODActor->GetProperty()->SetColor() does 
> not maintain the input color?
>
>
>
> Could you try with mapper->ScalarVisibilityOff()
>
> Jothy
>
> On Thu, Mar 1, 2012 at 9:36 PM, Hong Yi <hongyi at renci.org> wrote:
>
> I am using distinct colors to represent each different molecular 
> structure for multiple structure visual comparison. Each structure is 
> represented by a different actor, and a predefined color is passed 
> into the actor property to set its color. I found some colors get 
> altered significantly. For example, the orange color becomes yellow. I 
> want to show a legend to show correspondence between colors and 
> structures, but some colors look so different between the legend and 
> the displayed color for the corresponding structure actor. Is this 
> expected behavior or I did not set up something correctly? Any suggestions and comments are very much appreciated.
>
>
>
> Thanks,
>
>
>
> Hong
>
>
>
>
> _______________________________________________
> 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
>
>
>
>
> --
>
> Jothy
>
>
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ColorMismatch.png
Type: image/png
Size: 101370 bytes
Desc: ColorMismatch.png
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120302/dcaef645/attachment.png>


More information about the vtkusers mailing list