[vtkusers] diffuse lighting after scaling with negative values

Manuel Feige manuelfeige at googlemail.com
Wed Sep 3 15:32:23 EDT 2008


Re: [vtkusers] diffuse lighting after scaling with negative valuesHi Gerrick,

no, a 180 degrees rotation is not the same as the mirroring with respect to a plane. Moreover, you cannot accomplish mirroring by any combination of rotations. Take a book or something like that to convince yourself of this fact.

But the solution is probably to switch off two sided lighting: vtkRenderer::TwoSidedLightingOff().

Manuel
  ----- Original Message ----- 
  From: Gerrick Bivins 
  To: Manuel Feige ; VTK-users 
  Sent: Wednesday, September 03, 2008 9:11 PM
  Subject: Re: [vtkusers] diffuse lighting after scaling with negative values




  Hi Manuel,
  You should just rotate your actor 180 degrees rather than using the scale.  This would avoid these kinds of problems.
  Gerrick


  On 9/3/08 1:55 PM, "Manuel Feige" <manuelfeige at googlemail.com> wrote:


    Hello,

    my application needs to mirror the actors with respect to the x-y-plane. I can do this by vtkProp3D::SetScale(1, 1, -1). Unfortunately the diffuse lighting does not work after this transformation (the ambient lighting does). In this example the cone appears gray instead of white.

    int main()
    {
    vtkConeSource* cone = vtkConeSource::New();
    vtkDataSetMapper* mapper = vtkDataSetMapper::New();
    mapper->SetInput(cone->GetOutput());

    vtkActor* actor = vtkActor::New();
    actor->SetMapper(mapper);
    actor->GetProperty()->SetRepresentationToSurface();
    actor->GetProperty()->SetColor(1.0, 1.0, 1.0);
    actor->GetProperty()->SetAmbient(0.5);
    actor->SetScale(1,1,-1);

    vtkRenderer* renderer = vtkRenderer::New();
    renderer->AddActor(actor);
    vtkRenderWindow* renWin = vtkRenderWindow::New();
    renWin->AddRenderer(renderer);
    vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);
    iren->Initialize();
    iren->Start(); 
     
    //Delete...
    }

    Any suggestions how I can get the diffuse lighting running?

    Thanks in advance
    Manuel Feige


----------------------------------------------------------------------------
    _______________________________________________
    This is the private VTK discussion list.
    Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
    Follow this link to subscribe/unsubscribe:
    http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080903/2d38fc49/attachment.htm>


More information about the vtkusers mailing list