[vtk-developers] Lighting and vtkCubeAxesActor
    Leif Delgass 
    ldelgass at gmail.com
       
    Mon Dec 17 03:50:04 EST 2012
    
    
  
Hello,
I am trying to use the vtkCubeAxesActor from VTK git head and have run
into a problem with lighting.
If I set the ambient light in my vtkRenderer down to, e.g.
(.2,.2,.2), the label text in vtkCubeAxesActor turns dim because it
has ambient set to 1 and diffuse set to 0 in the label actors'
properties:
vtkAxisActor::SetLabels @ 1248
      this->LabelActors[i]->GetProperty()->SetAmbient(1.);
      this->LabelActors[i]->GetProperty()->SetDiffuse(0.);
I want the axes always fully lit, so In my application I have turned
off lighting on the cube axes actor property, which is copied to the
title actors, but not the label actors.  I am currently using this
change in vtkAxisActor.cxx:
diff --git a/Rendering/Annotation/vtkAxisActor.cxx
b/Rendering/Annotation/vtkAxisActor.cxx
index 01101a5..ea9d186 100644
--- a/Rendering/Annotation/vtkAxisActor.cxx
+++ b/Rendering/Annotation/vtkAxisActor.cxx
@@ -682,6 +682,7 @@ vtkAxisActor::BuildLabels(vtkViewport *viewport, bool force)
   for (int i = 0; i < this->NumberOfLabelsBuilt; i++)
     {
     this->LabelActors[i]->SetCamera(this->Camera);
+    this->LabelActors[i]->SetProperty(this->GetProperty());
     this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
     this->LabelActors[i]->SetOrientation(0., 0.,
this->LabelTextProperty->GetOrientation());
Does this look like an appropriate fix?  Also, what was the reason for
turning off diffuse lighting on labels (but not title text)?
Thanks,
Leif Delgass
    
    
More information about the vtk-developers
mailing list