Textures

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
LE_Shatai
Posts: 6
Joined: Fri Jul 06, 2007 7:02 am

Textures

Post by LE_Shatai »

Hi @all.

I'm new to irrLicht, so I have some questions on it.
When loading an ordinary box form a mesh file and assigning a texture, how has
the texture look a like. I mean has the texture to be an U/V Map with the unwrapped cube,
or is a plain picture enough.
How do I know in which size to scale the texture, and what if i want the texture to only on one side?

Tnx
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If the box has a different texture on each side you can either use an unwrapped cube or 6 materials with different textures (and different materials assigned to each side). Otherwise it's ok to use just one plain image. The texture coords are usually between 0 and 1. If you choose different range or if you scale the texture coords you will get a repeating texture (or a partial texture when scaling smaller). That depends on what you're going to do.
Applying it only to one side is either done with different materials or by blending a transparent texture with the vertex color (not sure if such a material exists, though).
LE_Shatai
Posts: 6
Joined: Fri Jul 06, 2007 7:02 am

Post by LE_Shatai »

Ok, thanks for the fast reply.

So I don't understand why my texture is not drwan correctly, or I can't see it.
I see a brown cube instead of a black one, so the texture is apllied.
But what I expected to see are the stones from the picture.

This is the code:

Code: Select all

	ISceneNode *node = scenemgr->addAnimatedMeshSceneNode(scenemgr->getMesh("../tiles/box.3ds"));
	node->setPosition(core::vector3df(0,0,0));
	node->setMaterialTexture(0, driver->getTexture("../textures/mosaic_floor_tile_scaled2.jpg"));
	node->setMaterialFlag(EMF_LIGHTING, false);

	ICameraSceneNode* cam = scenemgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
	cam->setPosition(core::vector3df(5,5,0));
	cam->setTarget(core::vector3df(0,0,0));	


	while(device->run() && driver){
		if (device->isWindowActive()){
			driver->beginScene(true, true, SColor(255,100,101,140));
			scenemgr->drawAll();
			driver->endScene();
		}
	}
So nothing special I'd say. Do I have to rescale the texture, and if yes, how do I do it?

Tnx
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Does your mesh have texture coords? And why don't you use the 3ds texture that is automatically loaded as set in the mesh?
LE_Shatai
Posts: 6
Joined: Fri Jul 06, 2007 7:02 am

Post by LE_Shatai »

I exported just a plain cube from blender into 3ds format, without any textures.
(I also tried obj-format, but the same result)
Ok, i did not make any texture coords. and I guess this is the problem.
I need to have a look in blender how to create those coords.
Thanks so far. :)
Post Reply