The animator exported the mesh in OBJ format directly from 3DSMax. Here is the resulting file :
Code: Select all
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 02.08.2016 16:37:53
mtllib twelvesidedwheel.mtl
#
# object 12
#
v 12.5000 48.2963 -12.9410
v 12.5000 35.3553 -35.3554
v -12.5000 35.3553 -35.3554
v -12.5000 48.2963 -12.9410
# 4 vertices
vn 0.0000 0.8660 -0.5000
# 1 vertex normals
vt 0.0000 0.0000 1.0000
vt 0.0833 0.0000 1.0000
vt 0.0833 1.0000 1.0000
vt 0.0000 1.0000 1.0000
# 4 texture coords
g 12
usemtl wire_088199225
s 8
f 1/1/1 2/2/1 3/3/1 4/4/1
# 1 polygons
#
# object 1
#
v 12.5000 48.2963 12.9409
v 12.5000 48.2963 -12.9410
v -12.5000 48.2963 -12.9410
v -12.5000 48.2963 12.9409
# 4 vertices
vn 0.0000 1.0000 -0.0000
# 1 vertex normals
vt 0.9167 0.0000 1.0000
vt 1.0000 0.0000 1.0000
vt 1.0000 1.0000 1.0000
vt 0.9167 1.0000 1.0000
# 4 texture coords
g 1
usemtl wire_088199225
s 8
f 5/5/2 6/6/2 7/7/2 8/8/2
# 1 polygons
#
# object 2
#
v 12.5000 35.3554 35.3553
v 12.5000 48.2963 12.9409
v -12.5000 48.2963 12.9409
v -12.5000 35.3554 35.3553
# 4 vertices
vn 0.0000 0.8660 0.5000
# 1 vertex normals
vt 0.8333 0.0000 1.0000
vt 0.9167 0.0000 1.0000
vt 0.9167 1.0000 1.0000
vt 0.8333 1.0000 1.0000
# 4 texture coords
g 2
usemtl wire_088199225
s 8
f 9/9/3 10/10/3 11/11/3 12/12/3
# 1 polygons
#
# object 3
#
v 12.5000 12.9410 48.2963
v 12.5000 35.3554 35.3553
v -12.5000 35.3554 35.3553
v -12.5000 12.9410 48.2963
# 4 vertices
vn 0.0000 0.5000 0.8660
# 1 vertex normals
vt 0.7500 0.0000 1.0000
vt 0.8333 0.0000 1.0000
vt 0.8333 1.0000 1.0000
vt 0.7500 1.0000 1.0000
# 4 texture coords
g 3
usemtl wire_088199225
s 8
f 13/13/4 14/14/4 15/15/4 16/16/4
# 1 polygons
#
# object 4
#
v 12.5000 -12.9410 48.2963
v 12.5000 12.9410 48.2963
v -12.5000 12.9410 48.2963
v -12.5000 -12.9409 48.2963
# 4 vertices
vn -0.0000 0.0000 1.0000
# 1 vertex normals
vt 0.6667 0.0000 1.0000
vt 0.7500 0.0000 1.0000
vt 0.7500 1.0000 1.0000
vt 0.6667 1.0000 1.0000
# 4 texture coords
g 4
usemtl wire_088199225
s 8
f 17/17/5 18/18/5 19/19/5 20/20/5
# 1 polygons
#
# object 5
#
v 12.5000 -35.3553 35.3553
v 12.5000 -12.9410 48.2963
v -12.5000 -12.9409 48.2963
v -12.5000 -35.3553 35.3553
# 4 vertices
vn -0.0000 -0.5000 0.8660
# 1 vertex normals
vt 0.5833 0.0000 1.0000
vt 0.6667 0.0000 1.0000
vt 0.6667 1.0000 1.0000
vt 0.5833 1.0000 1.0000
# 4 texture coords
g 5
usemtl wire_088199225
s 8
f 21/21/6 22/22/6 23/23/6 24/24/6
# 1 polygons
#
# object 6
#
v 12.5000 -48.2963 12.9410
v 12.5000 -35.3553 35.3553
v -12.5000 -35.3553 35.3553
v -12.5000 -48.2963 12.9410
# 4 vertices
vn -0.0000 -0.8660 0.5000
# 1 vertex normals
vt 0.5000 0.0000 1.0000
vt 0.5833 0.0000 1.0000
vt 0.5833 1.0000 1.0000
vt 0.5000 1.0000 1.0000
# 4 texture coords
g 6
usemtl wire_088199225
s 8
f 25/25/7 26/26/7 27/27/7 28/28/7
# 1 polygons
#
# object 7
#
v 12.5000 -48.2963 -12.9409
v 12.5000 -48.2963 12.9410
v -12.5000 -48.2963 12.9410
v -12.5000 -48.2963 -12.9409
# 4 vertices
vn -0.0000 -1.0000 0.0000
# 1 vertex normals
vt 0.4167 0.0000 1.0000
vt 0.5000 0.0000 1.0000
vt 0.5000 1.0000 1.0000
vt 0.4167 1.0000 1.0000
# 4 texture coords
g 7
usemtl wire_088199225
s 8
f 29/29/8 30/30/8 31/31/8 32/32/8
# 1 polygons
#
# object 8
#
v 12.5000 -35.3554 -35.3553
v 12.5000 -48.2963 -12.9409
v -12.5000 -48.2963 -12.9409
v -12.5000 -35.3554 -35.3553
# 4 vertices
vn -0.0000 -0.8660 -0.5000
# 1 vertex normals
vt 0.3333 0.0000 1.0000
vt 0.4167 0.0000 1.0000
vt 0.4167 1.0000 1.0000
vt 0.3333 1.0000 1.0000
# 4 texture coords
g 8
usemtl wire_088199225
s 8
f 33/33/9 34/34/9 35/35/9 36/36/9
# 1 polygons
#
# object 9
#
v 12.5000 -12.9410 -48.2963
v 12.5000 -35.3554 -35.3553
v -12.5000 -35.3554 -35.3553
v -12.5000 -12.9410 -48.2963
# 4 vertices
vn -0.0000 -0.5000 -0.8660
# 1 vertex normals
vt 0.2500 0.0000 1.0000
vt 0.3333 0.0000 1.0000
vt 0.3333 1.0000 1.0000
vt 0.2500 1.0000 1.0000
# 4 texture coords
g 9
usemtl wire_088199225
s 8
f 37/37/10 38/38/10 39/39/10 40/40/10
# 1 polygons
#
# object 10
#
v 12.5000 12.9409 -48.2963
v 12.5000 -12.9410 -48.2963
v -12.5000 -12.9410 -48.2963
v -12.5000 12.9409 -48.2963
# 4 vertices
vn 0.0000 -0.0000 -1.0000
# 1 vertex normals
vt 0.1667 0.0000 1.0000
vt 0.2500 0.0000 1.0000
vt 0.2500 1.0000 1.0000
vt 0.1667 1.0000 1.0000
# 4 texture coords
g 10
usemtl wire_088199225
s 8
f 41/41/11 42/42/11 43/43/11 44/44/11
# 1 polygons
#
# object 11
#
v 12.5000 35.3553 -35.3554
v 12.5000 12.9409 -48.2963
v -12.5000 12.9409 -48.2963
v -12.5000 35.3553 -35.3554
# 4 vertices
vn 0.0000 0.5000 -0.8660
# 1 vertex normals
vt 0.0833 0.0000 1.0000
vt 0.1667 0.0000 1.0000
vt 0.1667 1.0000 1.0000
vt 0.0833 1.0000 1.0000
# 4 texture coords
g 11
usemtl wire_088199225
s 8
f 45/45/12 46/46/12 47/47/12 48/48/12
# 1 polygons
Code: Select all
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 02.08.2016 16:37:53
newmtl wire_088199225
Ns 32
d 1
Tr 0
Tf 1 1 1
illum 2
Ka 0.3451 0.7804 0.8824
Kd 0.3451 0.7804 0.8824
Ks 0.3500 0.3500 0.3500
Code: Select all
scene::IAnimatedMesh* wheelMesh = device->getSceneManager()->getMesh("./Resources/twelvesidedwheel.obj");
IMeshSceneNode* wheel = smgr->addMeshSceneNode(wheelMesh->getMesh(0),
0, // parent
-1, // id
vector3df(0, 0, 0), // position
vector3df(0, 0, 0), //rotation
vector3df(4.0f, 4.0f, 4.0f) // scale
);
wheel->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
for(int i = 0; i < wheel->getMaterialCount(); i++) // Material count value is 12
{
wheel->getMaterial(i).TextureLayer[0].Texture = driver->getTexture("./Resources/Test.png");
}
I finally got it to work by adding the following line inside my loop :
Code: Select all
wheel->getMaterial(i).getTextureMatrix(0).setTextureScale(12.0f, 1.0f);
What I'm trying to achieve is to have a X-sided polygon that I can texture each side independently. Given that we're both inexperienced in 3D engines (I have a lot of experience in 2D that I'm trying to port to Irrlicht, and the animator is experienced in making high resolution models for prerendering in 2D games), I'm sure we did something wrong. The fact that I could import a polygon in Irrlicht and that it had the correct count of material encourages me, though.
Did we take the good approach? Is it default behaviour to have to scale each texture when there's that much material count? Should we have done something with our model in 3DSMax to have texture scaling working correctly once it's imported? Is OBJ a good exporting format, or should we use something else?
As a side question, is there a good tutorial aimed at 3DS Max animators who wish to create models for Irrlicht? I found a few in the forum, but it's more advanced, and we need to start from the base.
Any help would be appreciated. Thank you in advance!