[vtkusers] 3DS Import

Aashish Chaudhary aashish.chaudhary at kitware.com
Tue Jun 14 22:20:51 EDT 2011


Daniel,

Looks like some of the material properties are not imported correctly.
However I can fix the issue of lighting by doing something like this:

#include <vtk3DSImporter.h>
#include <vtkLight.h>
#include <vtkMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>

int main(int argc, char *argv[])
{
  vtkSmartPointer<vtkRenderWindowInteractor> interactor
(vtkSmartPointer<vtkRenderWindowInteractor>::New());
  vtkSmartPointer<vtkRenderWindow> renderWindow
(vtkSmartPointer<vtkRenderWindow>::New());

  interactor->SetRenderWindow(renderWindow);

  vtkSmartPointer<vtk3DSImporter> importer
(vtkSmartPointer<vtk3DSImporter>::New());
  importer->SetFileName("assembly_cell_modelT.3ds");
  importer->DebugOn();
  importer->Read();
  renderWindow->AddRenderer(importer->GetRenderer());

  vtkSmartPointer<vtkLight> light (vtkSmartPointer<vtkLight>::New());
  light->SetColor(1, 1, 1);
  light->SetDiffuseColor(1.0, 1.0, 1.0);
  light->SetIntensity(1);
  light->SetAmbientColor(2.0, 2.0, 2.0);
  light->SetLightTypeToHeadlight();
  importer->GetRenderer()->AddLight(light);


  interactor->Initialize();
  interactor->Start();
}


On Thu, Jun 9, 2011 at 11:05 AM, Aashish Chaudhary
<aashish.chaudhary at kitware.com> wrote:
> On Thu, Jun 9, 2011 at 11:04 AM, Aashish Chaudhary
> <aashish.chaudhary at kitware.com> wrote:
>> Hi Daniel,
>>
>> Is it possible for you to send me this 3ds file (or create a test 3ds
>> file that didn't work for you) . Sorry I realized that I didn't reply
>> to your last email.
>
> I meant create a test 3ds file that can reproduce this behavior.
>
> Thanks
>
>
>>
>> Thanks,
>>
>>
>>
>> On Thu, Jun 9, 2011 at 7:53 AM, Daniel Zuidinga
>> <daniel.zuidinga at rwth-aachen.de> wrote:
>>> Hello,
>>>
>>> i created a 3D-Model in googles Sketchup and import it via vtk3dsimporter.
>>>
>>> The whole model is very dark, nearly all black.
>>>
>>> Have i to set lights or something else?
>>>
>>> The flamingo.3ds has not the problem.
>>> i tried different export settings in sketchup but had no success.
>>>
>>> regards
>>> Daniel
>>> _______________________________________________
>>> 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
>>>
>>
>>
>>
>> --
>> | Aashish Chaudhary
>> | R&D Engineer
>> | Kitware Inc.
>> | www.kitware.com
>>
>
>
>
> --
> | Aashish Chaudhary
> | R&D Engineer
> | Kitware Inc.
> | www.kitware.com
>



-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com



More information about the vtkusers mailing list