Open ido-plat opened 4 years ago
You may want to read up on texture mapping: https://en.wikipedia.org/wiki/UV_mapping
You'll have to generate those UV coordinates appropriately. The project_points_to_plane
is likely messing you up massively.
And for this particular mesh, you probably do not want texture coordinates mapped to a best fitting plane.
Also, which UV mapping are you using to dress the img onto the 3d mesh?
We use the standard convention as outlined in the Wikipedia page
Thank you, i have decided not to use that projection in the end but i still have a small question regarding texture. Can I use pyvista/vtk tools to automatically apply the texture on the left plot like on the right? As in inverse the projection matrix only on the texture and not the rest of the mesh?
Plus, in order of changing the type of texture mapper to use vtk.vtkTextureMapToCylinder() instead of the plane mapping how should i do so? I couldn't find a way to make a SetInputConnection() work with pyvista's polydata.
Thank you so much, I appreciate it a lot.
Don't use SetInputConnection
, use SetInputDataObject
as you are passing a data object not a connection.
Description
Hello, I have been using Pyvista for a few weeks, right now i tried attaching some texture to a mesh i made after projecting it using "project_points_to_plane" method. The texture i received was unstable (picture below where i moved a single point with the camera) and very off. I couldn't find a better way to attach a texture other then the add mesh method (or the plot method which i don't want to use) and using the project points to plane worked without a texture. Below is the code and some pictures.
Also, which UV mapping are you using to dress the img onto the 3d mesh?
Thank you so much, Ido
if texture is not None:
//any texture that passed would result in the same bugtex = pv.read_texture(texture)
pv_mesh.texture_map_to_plane(inplace=True)
og = pv_mesh.center
projected = pv_mesh.project_points_to_plane(origin=og, normal=normal)
//normal is (1,1,1) but every normal have the same issueprojected.texture_map_to_plane()
plotter.add_mesh(projected, texture=tex)
if show:
//passed argumentplotter.show()
Example Data
the texture I use, every texture would cause the same issue: