[vtkusers] vtkOBJExporter and vtkOBJReader .obj files do not have colors

Tim Hutton tim.hutton at gmail.com
Wed May 14 16:39:15 EDT 2008


The answer can be found in vtkOBJReader.cxx
http://public.kitware.com/cgi-bin/viewcvs.cgi/IO/vtkOBJReader.cxx?view=markup
from "This is only partial support for the OBJ format..."

No colour information is loaded from OBJ files. If we can work out
which OBJ tags to support and how to map the information onto VTK
structures we could add it.

Sorry to disappoint,

Tim

On Wed, May 14, 2008 at 3:37 PM, Catherine Peloquin
<peloquin at iastate.edu> wrote:
> Hello all,
>
> I am using vtkOBJExporter and vtkOBJReader to save and load .obj files of
> colored surfaces.  This works well, except that when I load in a saved .obj
> file, all objects are white.  How can I maintain the colors, as well as the
> objects' geometry, when I load in .obj files?
>
> I save the files like so:
>         vtkOBJExporter* vtkExporter = vtkOBJExporter::New();
>         vtkExporter->SetRenderWindow(renderWindowName);
>         vtkExporter->SetFilePrefix(filename.c_str());
>         vtkExporter->Write();
>
> And load files like so:
>     vtkOBJReader* vtkReader = vtkOBJReader::New();
>     vtkReader->SetFileName(filename.c_str());
>     vtkReader->Update(); // force the VTK pipeline to update
>     int nPoints = vtkReader->GetOutput()->GetNumberOfPoints();
>     vtkContourNormals = vtkPolyDataNormals::New();
>     vtkContourNormals->SetInput(vtkReader->GetOutput());
>     vtkContourNormals->SetFeatureAngle(60.0);
>     vtkContourMapper = vtkPolyDataMapper::New();
>     vtkContourMapper->SetInput(vtkContourNormals->GetOutput());
>     vtkContourMapper->ScalarVisibilityOff();
>     //Then visualize the data
>
> Thanks,
> Catherine
> _______________________________________________
> 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
>
>



-- 
Tim Hutton - http://www.sq3.org.uk

Take the Organic Builder challenge -
http://www.sq3.org.uk/Evolution/Squirm3/OrganicBuilder/



More information about the vtkusers mailing list