3D object and Tiling Textures

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Mr_Ridd
Posts: 63
Joined: Tue Sep 28, 2004 5:16 am

3D object and Tiling Textures

Post by Mr_Ridd »

Hey

I'm not sure if this has been asked before but here goes.

Have any of you played around with the Morrowind level editor. Well if you haven't, they basically have a 3D terrain editor, it could also be a mesh though, but that doesn't matter. When you apply the textures you do it in tile format. And therefore you can apply as many textures as you like, of any type.

I want to do a simliar thing in my editor except you will import a mesh and then apply the textures. So I guess what I need to know is how to tile multiple textures on a 3D object (It could be a mesh or a terrain map). Is this possible in Irrlicht? If so please could you show me how to do it.

Thanks
Guest

Post by Guest »

You don't (well not really).

The hardware does not support it.
You can't tile multiple textures onto one triangle (the basic 3d element).
That leaves you with a couple of options.

-What can be done is create one big texture that holds multiple textures, but there is an issue of edges of the separate "tile textures" bleeding into each other due to mipmapping.
Here you just use one texture, and you assign a tile texture using texture coordinates per vertex.
Say you use grass, sand, road tile textures. Your big texture simply contains all of the possible tile textures.

-What can also be done is splitting up the triangles into groups, and using different skins for each group.

Both of these are skinning features - one uses coordinates to assign tile textures, the other uses different base textures.

-You could also create a bunch of BIG textures that you assemble from the tile textures. This might not perform very well, it all depends on the size of those combined textures.
Here you assign a big texture over a whole bunch of triangles, and you create the big texture by copying the tile textures in the order in which the user has arranged them. This does of course result in stretched textures on slopes.
Say the user places a bit of grass, a bit of road, and a bit of grass next to each other, the big texture would then contain grass, road, and grass next to each other.

-And I guess a pixel/fragment shader might be somewhat usable for this sort of stuff - but at a performance cost, and you'd probably be restricted to procedural texturing or a very small number of tile textures (say about 7, and it depends on what hardware you have).
This would basically use one texture to provide the number of the texture to apply to the "pixel".


Unfortunately of all these options, none are easy - that is, if you use an existing mesh, you can't easily change the vertex coordinates, skin numbers etc. I think your best bet is a custom scenenode
Mr_Ridd
Posts: 63
Joined: Tue Sep 28, 2004 5:16 am

Post by Mr_Ridd »

See the reason why I wanted tiled textures is so that it doesn't take up to much memory. If I import a large mesh and then add a texture, it's gonna take up a lot of ram. Now I'm gonna have to load lots of large meshes to make up the terrain. I would use heightmaps but bad things happen when I do.
Post Reply