Calculator and texture coordinates

Hi everyone.

To try to improve my paraview output, I tried to apply a texture to a contour (free surface with the wave pattern of a ship). I tried defining the texture coordinates by checking the Tcoords checkbox, and then specified the following formula:
((sin(coordsX)+1)/2)*iHat+((sin(coordsY)+1)/2)*jHat (basicaly a repeating pattern)
Following this, the calculator creates an array with 3 dimensions (zeros in the third dimension), and I can now load a texture. When I do this, the texture is however not applied …

What should I do in the calculator to see my texture ?

Thanks in advance

Does anyone has thoughts on this ?

currently, ParaView needs the array to be marked as texture coordinates. In the Calculator panel, just make sure you check the Result TCoords checkbox.

image

It’s an advanced parameter, so either search for it by name using the search box or click on the image icon.

That is what I am doing.

I tried again without luck, also using the 5.6.0RC2.

Load my dataset, extract the block I want, extract the surfaces to be sure I only have surface data.
Add a calculator, specify the expression and check “Result TCoords”.
This appends a new array with 3 dimensions to the surface data. the Z direction is filled with zeros.
Load the texture, but the texture does not show up.

If I append a " Texture Map to Plane" filter, and select the loaded jpg, then the texture is visible.

If you have dataset/state file to reproduce the issue, that’d be great.

Sure here is are the files.

texture.zip (2.0 MB)

Three files: a vtp file with the data, state file and jpg for the texture. you may have to change the path to the texture file.

Ah! Two issues:

  1. calculator filter is producing 3-component arrays alone, even when 2 component was requested.
  2. 3-component tcoords don’t correctly map 2D texture images.

Solution is to use Python Progammable filter instead. I applied a Python Programmable filter with the following script after your Calculator filter and then things worked as expected.

output.PointData.append(inputs[0].PointData["Result"][:,0:1], "Result2")
output.PointData.SetActiveTCoords("Result2")

You can totally ditch the Calculator and just update the expression in the Programmable Filter instead, as well.

That does the trick! Thanks

Only, the texture array only had one coordinate, buy doing the following, everything is back on track:

output.PointData.append(inputs[0].PointData["Result"][:,0:2], "Result2")
output.PointData.SetActiveTCoords("Result2")