[vtkusers] Rending texture problem

Eric E. Monson emonson at cs.duke.edu
Sat Sep 25 20:06:29 EDT 2010


Hey Yun,

I've never used the vtk3DSImporter (or dotnet), but I would guess that if the importer has problems with textures, then probably it's not just losing the textures, but it's also not importing the texture coordinates. So, when you try to apply a texture manually there is nothing to tell the system where to put the texture.

I have a feeling, looking back on old mailing list postings, that the 3DSImporter really just grabs the most basic geometry, and computes Normals, but it's not designed to pull in anything more than the polygons. I'm sure this will disappoint you, but maybe there's a chance someone else has another solution for converting your file into another format...?

Good luck,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Sep 25, 2010, at 11:22 AM, quengzi wrote:

> Hi all,
> 
> I'm a newer of VTK, I use VTK Dotnet to open a 3ds file, someone tell me that vtk3DSImpoter do not support texture, so I want to draw it by manual, but it failed, I cannot see any different after add the texture by manual, below is my code:
>             string fileName = @"E:\VTK\3D Module\Mickey\Mickey.3ds";
>             vtk3DSImporter importer = new vtk3DSImporter();
>             importer.ComputeNormalsOn();
>             importer.SetFileName(fileName);
>             importer.Read();
>             importer.GetRenderer().ResetCamera();
>             importer.DebugOn();
> 
>             //Add or Remove this section, no differents
>             vtkPNGReader pngReader = new vtkPNGReader();
>             pngReader.SetDebug(1);
>             pngReader.SetFileName(@"E:\VTK\3D Module\Mickey\l.png");
>             vtkTexture texture = new vtkTexture();
>             texture.SetInput(pngReader.GetOutput());
>             texture.InterpolateOn();
>             vtkActor actor = new vtkActor();
>             actor.SetTexture(texture);
>             importer.GetRenderer().AddActor(actor);
> 
>             //Below is add a light, and it's okay
>             vtkLight light = new vtkLight();
>             light.SetColor(1,1 , 1);
>             light.SwitchOn();
>             light.SetIntensity(0.9);
>             light.SetAmbientColor(1, 1, 1);
>             light.SetPosition(importer.GetRenderer().GetActiveCamera().GetPosition());
>             light.SetFocalPoint(importer.GetRenderer().GetActiveCamera().GetFocalPoint());
> 
>             importer.GetRenderer().SetBackground(0.1,0.2,0.4);            
>             importer.GetRenderer().AddLight(light);
> 
>             renderer[0] = importer.GetRenderer();
>             AddRendererToRenderWindow(renWin);
> ...
> Any suggestions will be appropriated.
> 
> Thanks,
> Yun
> _______________________________________________
> 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




More information about the vtkusers mailing list