Bonjour,
Je viens enfin de finaliser mon viewer de model 3D en OpenGL ES, mais là en testant un cas bien précis, je suis tombé sur un os...
Dans mon logiciel pour modéliser, j'ai dessiné une forme quelconque, et sur quelques triangles, j'ai appliqué une texture. Cette texture, j'ai choisi de la placer correctement, et du coup j'ai dû bouger l'offset, et le tiling.
Du coup, dans mon fichier matériel, j'ai ça :
Dans tous les autres parseurs de MTL, je n'en ai pas trouvé qui intègre cette information.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 newmtl 03_-_Default Ka 0.6 0.6 0.6 Kd 0.6 0.6 0.6 Ks 0.9 0.9 0.9 d 1.0 Ns 0.0 illum 2 map_Kd -o -0.1 -0.3 0.0 -s -3.4 3.2 1.0 map1.png
D'après une rapide analyse, je dirais que :
(d'après ici : http://www.fileformat.info/format/material/)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
39
40
41
42 -o u v w The -o option offsets the position of the texture map on the surface by shifting the position of the map origin. The default is 0, 0, 0. "u" is the value for the horizontal direction of the texture "v" is an optional argument. "v" is the value for the vertical direction of the texture. "w" is an optional argument. "w" is the value used for the depth of a 3D texture. -s u v w The -s option scales the size of the texture pattern on the textured surface by expanding or shrinking the pattern. The default is 1, 1, 1. "u" is the value for the horizontal direction of the texture "v" is an optional argument. "v" is the value for the vertical direction of the texture. "w" is an optional argument. "w" is a value used for the depth of a 3D texture. "w" is a value used for the amount of tessellation of the displacement map. -t u v w The -t option turns on turbulence for textures. Adding turbulence to a texture along a specified direction adds variance to the original image and allows a simple image to be repeated over a larger area without noticeable tiling effects. turbulence also lets you use a 2D image as if it were a solid texture, similar to 3D procedural textures like marble and granite. "u" is the value for the horizontal direction of the texture turbulence. "v" is an optional argument. "v" is the value for the vertical direction of the texture turbulence. "w" is an optional argument. "w" is a value used for the depth of the texture turbulence. By default, the turbulence for every texture map used in a material is uvw = (0,0,0). This means that no turbulence will be applied and the 2D texture will behave normally. Only when you raise the turbulence values above zero will you see the effects of turbulence.
Du coup, je me demandais comment intégrer ces données à mon viewer. A quel moment cela intervient pour le dessin de mes textures ? Ce sont mes coordonnées de textures qui doivent être changées ?
Partager