Skip to content

Commit 65f3355

Browse files
committedApr 13, 2023
Add textures
1 parent 31489f9 commit 65f3355

File tree

8 files changed

+165
-0
lines changed

8 files changed

+165
-0
lines changed
 

‎textures/cat-cube/cat-result.png

143 KB
Loading

‎textures/cat-cube/cat.jpg

6.18 KB
Loading

‎textures/cat-cube/cube.mtl

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
newmtl cube
2+
Ns 10.0000
3+
Ni 1.5000
4+
d 1.0000
5+
Tr 0.0000
6+
Tf 1.0000 1.0000 1.0000
7+
illum 2
8+
Ka 0.0000 0.0000 0.0000
9+
Kd 0.5880 0.5880 0.5880
10+
Ks 0.0000 0.0000 0.0000
11+
Ke 0.0000 0.0000 0.0000
12+
map_Ka cat.jpg
13+
map_Kd cat.jpg

‎textures/cat-cube/cube.obj

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# cube.obj
2+
#
3+
4+
o cube
5+
mtllib cube.mtl
6+
7+
v -0.500000 -0.500000 0.500000
8+
v 0.500000 -0.500000 0.500000
9+
v -0.500000 0.500000 0.500000
10+
v 0.500000 0.500000 0.500000
11+
v -0.500000 0.500000 -0.500000
12+
v 0.500000 0.500000 -0.500000
13+
v -0.500000 -0.500000 -0.500000
14+
v 0.500000 -0.500000 -0.500000
15+
16+
vt 0.000000 0.000000
17+
vt 1.000000 0.000000
18+
vt 0.000000 1.000000
19+
vt 1.000000 1.000000
20+
21+
vn 0.000000 0.000000 1.000000
22+
vn 0.000000 1.000000 0.000000
23+
vn 0.000000 0.000000 -1.000000
24+
vn 0.000000 -1.000000 0.000000
25+
vn 1.000000 0.000000 0.000000
26+
vn -1.000000 0.000000 0.000000
27+
28+
g cube
29+
usemtl cube
30+
s 1
31+
f 1/1/1 2/2/1 3/3/1
32+
f 3/3/1 2/2/1 4/4/1
33+
s 2
34+
f 3/1/2 4/2/2 5/3/2
35+
f 5/3/2 4/2/2 6/4/2
36+
s 3
37+
f 5/4/3 6/3/3 7/2/3
38+
f 7/2/3 6/3/3 8/1/3
39+
s 4
40+
f 7/1/4 8/2/4 1/3/4
41+
f 1/3/4 8/2/4 2/4/4
42+
s 5
43+
f 2/1/5 8/2/5 4/3/5
44+
f 4/3/5 8/2/5 6/4/5
45+
s 6
46+
f 7/1/6 1/2/6 5/3/6
47+
f 5/3/6 1/2/6 3/4/6

‎textures/garykac-cube/cube-result.png

12.7 KB
Loading

‎textures/garykac-cube/cube-tex.obj

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# cube-tex.obj
2+
# Import into Blender with Y-forward, Z-up
3+
#
4+
# Vertices: Faces:
5+
# f-------g +-------+
6+
# /. /| /. 5 /| 3 back
7+
# / . / | / . / |
8+
# e-------h | 2 +-------+ 1|
9+
# | b . .|. c z right | . . .|. +
10+
# | . | / | /y | . 4 | /
11+
# |. |/ |/ |. |/
12+
# a-------d +---- x +-------+
13+
# 6
14+
# bottom
15+
16+
# Material defined in separate file.
17+
mtllib cube.mtl
18+
19+
g cube
20+
21+
# Vertices
22+
v 0.0 0.0 0.0 # 1 a
23+
v 0.0 1.0 0.0 # 2 b
24+
v 1.0 1.0 0.0 # 3 c
25+
v 1.0 0.0 0.0 # 4 d
26+
v 0.0 0.0 1.0 # 5 e
27+
v 0.0 1.0 1.0 # 6 f
28+
v 1.0 1.0 1.0 # 7 g
29+
v 1.0 0.0 1.0 # 8 h
30+
31+
# Normal vectors
32+
# One for each face. Shared by all vertices in that face.
33+
vn 1.0 0.0 0.0 # 1 cghd
34+
vn -1.0 0.0 0.0 # 2 aefb
35+
vn 0.0 1.0 0.0 # 3 gcbf
36+
vn 0.0 -1.0 0.0 # 4 dhea
37+
vn 0.0 0.0 1.0 # 5 hgfe
38+
vn 0.0 0.0 -1.0 # 6 cdab
39+
40+
# Texture
41+
# (u,v) coordinate into texture map image, ranging from 0.0 - 1.0.
42+
# +---f---g---+---+
43+
# | | 5 | | |
44+
# f---e---h---g---+
45+
# | 2 | 4 | 1 | | v
46+
# b---a---d---c---+ |
47+
# | | 6 | | | |
48+
# +---b---c---+---+ +---- u
49+
# | | 3 | | |
50+
# +---f---g---+---+
51+
vt 0.25 1.00 # 1 f(5) = f for face 5
52+
vt 0.50 1.00 # 2 g(5)
53+
vt 0 0.75 # 3 f(2)
54+
vt 0.25 0.75 # 4 e(2,4,5)
55+
vt 0.50 0.75 # 5 h(1,4,5)
56+
vt 0.75 0.75 # 6 g(1)
57+
vt 0 0.50 # 7 b(2)
58+
vt 0.25 0.50 # 8 a(2,4,6)
59+
vt 0.50 0.50 # 9 d(1,4,6)
60+
vt 0.75 0.50 # 10 c(1)
61+
vt 0.25 0.25 # 11 b(3,6)
62+
vt 0.50 0.25 # 12 c(3,6)
63+
vt 0.25 0 # 13 f(3)
64+
vt 0.50 0 # 14 g(3)
65+
66+
# Define material for the following faces
67+
usemtl texture
68+
69+
# Faces v/vt/vn
70+
# 3-------2
71+
# | - |
72+
# | # | Each face = 2 triangles (ccw)
73+
# | - | = 1-2-3 + 1-3-4
74+
# 4-------1
75+
76+
# Face 1: cghd = cgh + chd
77+
f 3/10/1 7/6/1 8/5/1
78+
f 3/10/1 8/5/1 4/9/1
79+
80+
# Face 2: aefb = aef + afb
81+
f 1/8/2 5/4/2 6/3/2
82+
f 1/8/2 6/3/2 2/7/2
83+
84+
# Face 3: gcbf = gcb + gbf
85+
f 7/14/3 3/12/3 2/11/3
86+
f 7/14/3 2/11/3 6/13/3
87+
88+
# Face 4: dhea = dhe + dea
89+
f 4/9/4 8/5/4 5/4/4
90+
f 4/9/4 5/4/4 1/8/4
91+
92+
# Face 5: hgfe = hgf + hfe
93+
f 8/5/5 7/2/5 6/1/5
94+
f 8/5/5 6/1/5 5/4/5
95+
96+
# Face 6: cdab = cda + cab
97+
f 3/12/6 4/9/6 1/8/6
98+
f 3/12/6 1/8/6 2/11/6

‎textures/garykac-cube/cube.mtl

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
newmtl texture
2+
Ka 0.0 0.0 0.0
3+
Kd 0.5 0.5 0.5
4+
Ks 0.0 0.0 0.0
5+
Ns 10.0
6+
illum 2
7+
map_Kd texture.png

‎textures/garykac-cube/texture.png

294 Bytes
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.