texture tiling problem with Direct3D mesh

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
cpaganucci
Posts: 4
Joined: Tue Nov 13, 2007 9:18 pm

texture tiling problem with Direct3D mesh

Post by cpaganucci »

I'm trying to export a model with a non-tiling texture from Cinema 4D as a .X file. Turning off tiling in the modeler and exporting leads to an identical .x file as with tiling turned on. So it looks like I either need to modify the .x file by hand to disable tiling, or force tiling to be turned off once the model is loaded into irrlicht. I tried using the following code to force the texture to clamp, but I think I must be doing something wrong. Can I do this in code once the model is loaded? If not, is there a way to disable tiling directly in the .X file?

Code: Select all

	irr::scene::IAnimatedMesh* mesh = smgr->getMesh( "geometry/card4.x" );
	stack[0] = smgr->addAnimatedMeshSceneNode( mesh, sceneNode );
	irr::video::ITexture* tex = driver->getTexture( data->imagePaths[0] );
	stack[0]->setMaterialTexture( 0, tex );
	stack[0]->getMaterial(0).TextureWrap[0] = irr::video::ETC_CLAMP;
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I guess you have to change some export properties to export texture coords correctly. There is no tiling option in .x, so the texture coords must be made explicit.
In case you use Irrlicht 1.3.1 your code should be correct. But it might be that more than one mesh buffer is in the mesh, so you have to change the clamping for all of those in the mesh.
cpaganucci
Posts: 4
Joined: Tue Nov 13, 2007 9:18 pm

Post by cpaganucci »

Thanks for the quick reply.

I am using 1.3.1, and there's only one mesh in the file (it's a simple plane), so I'm not sure why the code isn't working. Here's a link to the .x file:

http://redmalicious.com/temp/card4.x

Even with tiling on it should look ok because the UV coordinates are correct, but I can see about 1 pixel of the bottom of the texture peeking out at the top of the mesh:

Image

I just figured out that I can get rid of the problem by offsetting the texture by a small amount, but it seems like kind of a hack.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

try this: remove setMaterial() and all about set material. in irrlicht.x format loaded with their textures and texture coordinates that u set when u sreate your model on your 3d software, even if u don't use setMaterial() they sure be loaaded. so if u sure u map them correctly ?
Post Reply