# Why is there no color in the scene I exported with vtkVRMLExporter

**URL:** https://discourse.vtk.org/t/why-is-there-no-color-in-the-scene-i-exported-with-vtkvrmlexporter/7344
**Category:** Support
**Created:** [December 6, 2021, 1:00pm UTC](https://discourse.vtk.org/t/why-is-there-no-color-in-the-scene-i-exported-with-vtkvrmlexporter/7344 "2021-12-06T13:00:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![DX130](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@DX130](https://discourse.vtk.org/u/DX130)
#### Post date: [December 6, 2021, 1:00pm UTC](https://discourse.vtk.org/t/why-is-there-no-color-in-the-scene-i-exported-with-vtkvrmlexporter/7344/1 "2021-12-06T13:00:11Z")

</div>

I want to export the result, but there is always no correct color after opening it with ParaView. If you have any other suggestions please let me know.

```auto
polydata = vtkAppendPolyData()
    reader = vtkNIFTIImageReader()
    reader.SetFileName('Brats18_2013_10_1_seg.nii.gz')

    for label,color,name in zip(labels,Colors,CC):
        pointColors = vtkUnsignedCharArray()
        pointColors.SetNumberOfComponents(3)
        pointColors.SetName('Colors')

        dmc = vtkDiscreteMarchingCubes()
        dmc.SetInputConnection(reader.GetOutputPort())
        dmc.SetValue(0, label)

        smooth = smooth_functions(dmc, 1)

        output = smooth.GetOutput()

        for i in range(output.GetNumberOfPoints()):
            pointColors.InsertNextTuple3(*color)

        output.GetPointData().Update()
        output.GetPointData().SetScalars(pointColors)
        polydata.AddInputData(output)

    mapper = vtkPolyDataMapper()
    mapper.SetInputConnection(polydata.GetOutputPort())
    actor = vtkActor()

    actor.SetMapper(mapper)

    ren = vtkRenderer()
    ren.AddActor(actor)
    renWin = vtkRenderWindow()
    renWin.AddRenderer(ren)
    iren = vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)

    iren.Initialize()
    iren.Start()

    exporter = vtkVRMLExporter()
    exporter.SetRenderWindow(renWin)
    exporter.SetActiveRenderer(ren)

    exporter.SetFileName("cylinders11.wrl")
    exporter.Write()

```

I originally used multiple actors to display different parts, but the exported result cannot be opened by ParaView, so I used vtkAppendPolyData

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicolas.vuaille/32/5363_2.png) [@nicolas.vuaille](https://discourse.vtk.org/u/nicolas.vuaille)
#### Post date: [December 6, 2021, 3:39pm UTC](https://discourse.vtk.org/t/why-is-there-no-color-in-the-scene-i-exported-with-vtkvrmlexporter/7344/2 "2021-12-06T15:39:20Z")

</div>

On it on StackOverflow : [vtk - Why is there no color in the scene I exported with vtkVRMLExporter - Stack Overflow](https://stackoverflow.com/questions/70245850/why-is-there-no-color-in-the-scene-i-exported-with-vtkvrmlexporter/70247927#70247927)
