How to add texture coordinates to an XML VTK File?

Hi, I haven’t been able to find any information on how to do this. I want to be able to add texture coordinates to .vtu file. A simple example being the following shape:


…which is defined by the following .vtu in XML format:

<?xml version="1.0"?>
<VTKFile version="0.1" type="UnstructuredGrid">
  <UnstructuredGrid>
    <Piece NumberOfPoints="32" NumberOfCells="4">
      <Points>
        <DataArray type="Float64" Name="points" NumberOfComponents="3" format="ascii">
          0.0 1.0 99.0 1.0 1.0 99.0 0.0 2.0 99.0 1.0 2.0 99.0 0.0 1.0 100.0 1.0 1.0 100.5 0.0 2.0 100.0 1.0 2.0 100.5
          1.0 1.0 99.0 2.0 1.0 99.0 1.0 2.0 99.0 2.0 2.0 99.0 1.0 1.0 100.5 2.0 1.0 101.0 1.0 2.0 100.5 2.0 2.0 101.0
          0.0 0.0 99.0 1.0 0.0 99.0 0.0 1.0 99.0 1.0 1.0 99.0 0.0 0.0 100.0 1.0 0.0 100.5 0.0 1.0 100.0 1.0 1.0 100.5
          1.0 0.0 99.0 2.0 0.0 99.0 1.0 1.0 99.0 2.0 1.0 99.0 1.0 0.0 100.5 2.0 0.0 101.0 1.0 1.0 100.5 2.0 1.0 101.0
        </DataArray>
      </Points>
      <Cells>
        <DataArray type="Int32" Name="connectivity" NumberOfComponents="1" format="ascii">
          0 1 2 3 4 5 6 7
          8 9 10 11 12 13 14 15
          16 17 18 19 20 21 22 23
          24 25 26 27 28 29 30 31
        </DataArray>
        <DataArray type="Int32" Name="offsets" NumberOfComponents="1" format="ascii">
          8
          16
          24
          32
        </DataArray>
        <DataArray type="UInt8" Name="types" NumberOfComponents="1" format="ascii">
          11
          11
          11
          11
        </DataArray>
      </Cells>
      <CellData>
        <DataArray type="Float64" Name="top" NumberOfComponents="1" format="ascii">
          100.0 101.0 100.0 101.0
        </DataArray>
        <DataArray type="Float64" Name="botm" NumberOfComponents="1" format="ascii">
          99.0 99.0 99.0 99.0
        </DataArray>
        <DataArray type="Float64" Name="idomain" NumberOfComponents="1" format="ascii">
          1.0 1.0 1.0 1.0
        </DataArray>
      </CellData>
    </Piece>
  </UnstructuredGrid>
</VTKFile>

However, I when I visualise this in ParaView it tells me:
image

Is it possible to add the tcoords to the .vtu file so that I apply a texture to the top surface something like this:

I know that if I have a plane and use the texture coordinates to plan filter that I can get a texture rendered that way, but I would like to apply it to a specific surface on a 3D shape. Using the texture coord to plane filter on a 3D shape just results in the texture being stretched all round the edges and rendered on all sides.

I think that you need to set NumberOfComponents="2" so an array can be used as texture coordinates.

Thanks!