Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Created January 10, 2017 12:09
Show Gist options
  • Select an option

  • Save MaikKlein/0b6d6bb58772c13593d0a0add6004c1c to your computer and use it in GitHub Desktop.

Select an option

Save MaikKlein/0b6d6bb58772c13593d0a0add6004c1c to your computer and use it in GitHub Desktop.
# Blender v2.76 (sub 0) OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
vt 1.000000 0.333333
vt 1.000000 0.666667
vt 0.666667 0.666667
vt 0.666667 0.333333
vt 0.666667 0.000000
vt 0.000000 0.333333
vt 0.000000 0.000000
vt 0.333333 0.000000
vt 0.333333 1.000000
vt 0.000000 1.000000
vt 0.000000 0.666667
vt 0.333333 0.333333
vt 0.333333 0.666667
vt 1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 1.000000 0.000000 0.000000
vn -0.000000 0.000000 1.000000
vn -1.000000 -0.000000 -0.000000
vn 0.000000 0.000000 -1.000000
usemtl Material
s off
f 2/1/1 3/2/1 4/3/1
f 8/1/2 7/4/2 6/5/2
f 5/6/3 6/7/3 2/8/3
f 6/8/4 7/5/4 3/4/4
f 3/9/5 7/10/5 8/11/5
f 1/12/6 4/13/6 8/11/6
f 1/4/1 2/1/1 4/3/1
f 5/14/2 8/1/2 6/5/2
f 1/12/3 5/6/3 2/8/3
f 2/12/4 6/8/4 3/4/4
f 4/13/5 3/9/5 8/11/5
f 5/6/6 1/12/6 8/11/6
@HugoPeters1024

Copy link
Copy Markdown

I can't find a right texture for this. What is the expected layout? I'm guessing a 2*3 grid but there are few cube textures in that layout. Is there a name for that layout?

@Mohido

Mohido commented Feb 12, 2022

Copy link
Copy Markdown

A javascript cube. Same as the above .obj but in javascript (If you are doing a webgl proj.)

/** vertices */
const cube_vs = [
1.0 , -1.0, -1.0,
1.0 , -1.0, 1.0,
-1.0 , -1.0, 1.0,
-1.0 , -1.0, -1.0,
1.0 , 1.0, -1.0,
1.0 , 1.0, 1.0,
-1.0 , 1.0, 1.0,
-1.0 , 1.0, -1.0,
];

/** Indices */
const cube_i = [
2,1,1, 3,2,1, 4,3,1,
8,1,2, 7,4,2, 6,5,2,
5,6,3, 6,7,3, 2,8,3,
6,8,4, 7,5,4, 3,4,4,
3,9,5, 7,10,5, 8,11,5,
1,12,6, 4,13,6, 8,11,6,
1,4,1, 2,1,1, 4,3,1,
5,14,2, 8,1,2, 6,5,2,
1,12,3, 5,6,3, 2,8,3,
2,12,4, 6,8,4, 3,4,4,
4,13,5, 3,9,5, 8,11,5,
5,6,6, 1,12,6, 8,11,6,
];

/** Cube normals cords */
const cube_n = [
0.0, -1.0, 0.0,
0.0, 1.0, 0.0,
1.0, 0.0, 0.0,
-0.0, 0.0, 1.0,
-1.0, -0.0, -0.0,
0.0, 0.0, -1.0
];

/** Cube textures cords */
const cube_t = [
1.0, 0.3,
1.0, 0.6,
0.6, 0.6,
0.6, 0.3,
0.6, 0.0,
0.0, 0.3,
0.0, 0.0,
0.3, 0.0,
0.3, 1.0,
0.0, 1.0,
0.0, 0.6,
0.3, 0.3,
0.3, 0.6,
1.0, 0.0
];

@silvertakana

Copy link
Copy Markdown

for some reason, Assimp doesn't load the last triangle if it doesn't have an enter character at the end of the file. You should add an enter character there. Took me a while to find out.

@mathew-odwyer

Copy link
Copy Markdown

Thank you so much @silvertakana. I would've spent ages figuring out what was going on if it wasn't for you ❤

@ahmedsat

Copy link
Copy Markdown

thanks that helps a lot

@shadowengine10

Copy link
Copy Markdown

where tf is the line thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment