[vtkusers] texture problem // blue reflection

tune at freenet.de tune at freenet.de
Fri Jul 27 02:54:24 EDT 2007


An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070727/6b4b57a8/attachment.htm>
-------------- next part --------------
Hallo,
 
I try to work with texture in vtk. What i dont understand is the behaviour ot the object conserning the light sources
when they have a texture ?

So if i map a texture on an object the only shadow i get is a blue one. I tried ti change the settings of the light sources in the
renderer and the behaviour of the actors properties like ambient, diffuse and specular (in power and color ) ?

Can anyone help me understand the problem.

Thanks a lot..

Here is a part of my source code -->

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        vtkSmartPointer<vtkBMPReader> bmpReader = vtkSmartPointer<vtkBMPReader>::New();
        bmpReader->SetFileName("skin04.bmp"); // --> hier muss noch ein Absoluter Pfas gesetzt werden + Fehlerabfang !
        vtkSmartPointer<vtkTexture> atext = vtkSmartPointer<vtkTexture>::New();
        atext->SetInputConnection(bmpReader->GetOutputPort());
        atext->RepeatOn();
        atext->InterpolateOn();

        vtkSmartPointer<vtkProp3DCollection> collection = m_PolyDataAssembly->GetParts();
        vtkSmartPointer<vtkActor> actor = vtkActor::SafeDownCast(collection->GetItemAsObject(3));

        actor->GetProperty()->SetColor(255,255,255);
        actor->GetProperty()->SetAmbient (1);
        actor->GetProperty()->SetAmbientColor (0,0,0);
        actor->GetProperty()->SetDiffuse (0.1);
        actor->GetProperty()->SetDiffuseColor(0,0,0);
        actor->GetProperty()->SetSpecular(0.5);
        actor->GetProperty()->SetSpecularColor(255,255,255);
        
        vtkSmartPointer<vtkTextureMapToSphere> tmapper = vtkSmartPointer<vtkTextureMapToSphere>::New();
        tmapper->SetInput(actor->GetMapper()->GetInput());
        tmapper->AutomaticSphereGenerationOn();

        vtkSmartPointer<vtkTransformTextureCoords> xform = vtkSmartPointer<vtkTransformTextureCoords>::New();
        xform->SetInputConnection(tmapper->GetOutputPort());
        xform->SetScale( 5.0, 5.0, 5.0);

        vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
        mapper->SetInputConnection(xform->GetOutputPort());
        mapper->SetLookupTable(bmpReader->GetLookupTable());

        actor->SetTexture(atext.GetPointer());
        actor->SetMapper(mapper);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++







More information about the vtkusers mailing list