# Textured Terrain being inverted

**URL:** <https://discourse.vtk.org/t/textured-terrain-being-inverted/1558>\
**Category:** Support\
**Created:** [August 12, 2019, 1:57pm UTC](https://discourse.vtk.org/t/textured-terrain-being-inverted/1558 "2019-08-12T13:57:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)\
**Post date:** [August 13, 2019, 5:55pm UTC](https://discourse.vtk.org/t/textured-terrain-being-inverted/1558/2 "2019-08-13T17:55:26Z")

</div>

You’ll need to set the plane explicitly when using the `vtkTextureMapToPlane` filter - it chooses an arbitrarily best-fitting plane by default which is likely not what you want in this case.

Experiment with the following methods of the `vtkTextureMapToPlane` class:

- `SetOrigin`
- `SetPoint1`
- `SetPoint2`

* * *

There are some convenience methods in [PyVista](http://docs.pyvista.org) to make this whole example way easier:

```python
import pyvista as pv
import numpy as np

image_name = 'C:/VTK/Data/normalMapping.png'

points = np.array([[0., 0., 0.],
                 [100., 0., 0.],
                 [200., 0., 0.],
                 [300., 0., 0.],
                 [400., 0., 0.],
                 [0., 100., 10.],
                 [100., 100., 0.],
                 [200., 100., 0.],
                 [300., 100., 0.],
                 [400., 100., 0.],
                 [0., 200., 0.],
                 [100., 200., 0.],
                 [200., 200., 0.],
                 [300., 200., 0.],
                 [400., 200., 0.],
                 [0., 300., 10.],
                 [100., 300., 0.],
                 [200., 300., 0.],
                 [300., 300., 0.],
                 [400., 300., 0.],
                 [0., 400., 0.],
                 [100., 400., 0.],
                 [200., 400., 0.],
                 [300., 400., 0.],
                 [400., 400., 0.]])

# Make point cloud
poly = pv.PolyData(points)
# Traingulate the surface
surf = poly.delaunay_2d()
# Read the texture
texture = pv.read_texture(image_name)

# Define your mapping plane
origin = surf.bounds[0], surf.bounds[2], surf.bounds[4]
point_u = surf.bounds[1], surf.bounds[2], surf.bounds[4]
point_v = surf.bounds[0], surf.bounds[3], surf.bounds[4]

# Mapp the texture coordinates
mapped = surf.texture_map_to_plane(origin=origin, point_u=point_u, point_v=point_v)

# Display it from the top down
mapped.plot(texture=texture, cpos='xy')

```

Note that I took a screenshot of your image so it has some white edges

 ![download](https://discourse.vtk.org/uploads/default/original/1X/ad455ccfcd7d57b636bbd670aea29a8c73d1171a.jpeg)

---

_[View the full topic](https://discourse.vtk.org/t/textured-terrain-being-inverted/1558)._
