Is there an option to add texture-coordinates?
See original GitHub issueI really like this python package, as it is simple to use for a beginner like me. I have a small question: is there a way to add in texture coordinates? I have a few simple 3D objects consisting of polygons, each with a texture that needs to be mapped to it according to X and Y texture coordinates within a [0, 1] interval. Through the tutorials in the documentation I was able to create a sample 3D object and add the textures, but without the texture coordinates the objects look quite wrong. Do you have any suggestions that could help me?
Here is a small example:
from vtkplotter import *
# six polygons consisting of points with X, Y, and Z coordinates
polygon_a = [
[
(371982, 5812893, 47),
(371987, 5812889, 47),
(371993, 5812896, 47),
(371988, 5812900, 47),
(371982, 5812893, 47),
],
[[0, 1, 2, 3, 4]],
]
polygon_b = [
[
(371987, 5812889, 44),
(371987, 5812889, 47),
(371982, 5812893, 47),
(371982, 5812893, 44),
(371987, 5812889, 44),
],
[[0, 1, 2, 3, 4]],
]
polygon_c = [
[
(371993, 5812896, 44),
(371993, 5812896, 47),
(371987, 5812889, 47),
(371987, 5812889, 44),
(371993, 5812896, 44),
],
[[0, 1, 2, 3, 4]],
]
polygon_d = [
[
(371982, 5812893, 44),
(371982, 5812893, 47),
(371988, 5812900, 47),
(371988, 5812900, 44),
(371982, 5812893, 44),
],
[[0, 1, 2, 3, 4]],
]
polygon_e = [
[
(371988, 5812900, 44),
(371988, 5812900, 47),
(371993, 5812896, 47),
(371993, 5812896, 44),
(371988, 5812900, 44),
],
[[0, 1, 2, 3, 4]],
]
polygon_f = [
[
(371987, 5812889, 44),
(371982, 5812893, 44),
(371988, 5812900, 44),
(371993, 5812896, 44),
(371987, 5812889, 44),
],
[[0, 1, 2, 3, 4]],
]
# texture coordinates of X, Y with interval [0, 1]
texture_coords_a = [
0.993515,
0.590665,
0.583403,
0.995886,
0.001318,
0.409513,
0.411194,
0.00281,
0.993515,
0.590665,
]
texture_coords_b = [
0.814495,
0.004965,
0.986562,
0.175202,
0.172649,
0.994582,
0.004011,
0.820917,
0.814495,
0.004965,
]
texture_coords_c = [
0.992976,
0.869131,
0.867654,
0.99699,
0.009377,
0.134356,
0.138307,
0.010153,
0.992976,
0.869131,
]
texture_coords_d = [
0.007693,
0.148416,
0.15451,
0.00767,
0.994519,
0.86112,
0.844256,
0.998197,
0.007693,
0.148416,
]
texture_coords_e = [
0.997322,
0.660826,
0.89938,
0.990736,
0.006374,
0.337104,
0.106732,
0.00748,
0.997322,
0.660826,
]
# textures for some of the polygons as .jpg-files
img_a = "tex_2962910"
img_b = "tex_2962971"
img_c = "tex_2962990"
img_d = "tex_2962933"
img_e = "tex_2962915"
a = Actor(polygon_a)
b = Actor(polygon_b)
c = Actor(polygon_c)
d = Actor(polygon_d)
e = Actor(polygon_e)
f = Actor(polygon_f)
a.texture(img_a)
b.texture(img_b)
c.texture(img_c)
d.texture(img_d)
e.texture(img_e)
polygons = actors.Assembly([a, b, c, d, e, f])
printc("getPolygons() format is :", a.getPolygons(), c=3)
printc("getConnectivity() format is:", a.getConnectivity(), c=3)
show(polygons, Text(__doc__), viewup="z", axes=8)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Texture Coordinate Node — Blender Manual
Automatically-generated texture coordinates from the vertex positions of the mesh without deformation, keeping them sticking to the surface under animation.
Read more >Quickly add texture coordinate and mapping nodes shortcut?
The short answer is Ctrl - T which is the shortcut for the command Add Texture Setup . But this works only if...
Read more >LearnOpenGL - Textures
A texture is a 2D image (even 1D and 3D textures exist) used to add detail to an ... point texture coordinate), but...
Read more >How to add a texture to an object in Blender
Texture coordinates and procedural textures ... With procedural textures, we don't use the image texture node. Instead, we go to the add menu...
Read more >10.5 - Texture Mapping - Texture Coordinates — LearnWebGL
For the “Coordinates:” drop-down menu select the “Generated” option. This means Blender will automatically generate the texture coordinates. For the “Projection ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It works perfectly! Thank you very much for your quick help!
Yep! Indeed I’ve already added the functionality - it was fairly trivial… Later today I will commit a new version, Thanks