Adding texture to cube
-
- Posts: 15
- Joined: Sun Aug 22, 2004 2:06 pm
- Location: Estonia
Adding texture to cube
Hi,
How to add texture to only one side of a cube model?
How to add texture to only one side of a cube model?
-
- Posts: 15
- Joined: Sun Aug 22, 2004 2:06 pm
- Location: Estonia
-
- Posts: 15
- Joined: Sun Aug 22, 2004 2:06 pm
- Location: Estonia
Could somebody please help me, I am making a GTA2 like top down game...
I want to add a texture to only on the top of the cube. So it looks like only a texture. Why I want it? Because there are no functions to rotate textures by given degree. However, it is possible with 3D objects.
One way is to make a big texture with my Car picture in the center of it. But how to put it on the cube the way it only is on top of the cube and not on the other sides. The other sides must be transparent.
I want to know how the texture is placed on the object. For example when adding texture to a human model then the texture must be placed very precisely. I just don't understand how it works. What is the coordination of the object(3D model) where the texture is placed.
I want to add a texture to only on the top of the cube. So it looks like only a texture. Why I want it? Because there are no functions to rotate textures by given degree. However, it is possible with 3D objects.
One way is to make a big texture with my Car picture in the center of it. But how to put it on the cube the way it only is on top of the cube and not on the other sides. The other sides must be transparent.
I want to know how the texture is placed on the object. For example when adding texture to a human model then the texture must be placed very precisely. I just don't understand how it works. What is the coordination of the object(3D model) where the texture is placed.
-
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
i think you should use a normal texture for the whole cube. If you use a compressed format like jpg and let the other parts white, i think the white parts are compressed to something like some bytes and thats no problem. And the best like i wrote before, if you later want not only look from above, you can paint the white parts, too and have real 3D.
Each vertex of model have its coordinates in 3d space + it have its coordinates in texture space ..its caled UV coordinates.
Texture space is only 2d with U=0, V=0 in upper left corner of texture and U=1, V=1 in bottom right corner. Means that regardles on pixel size, texture have allways size of 1,1. Even texture of 256/128 pixels is 1,1 big.
U is horizontal coordinate while V is vertical.
To edit UV coords of model there are editors called UV editors. Most of modeling progs. have one built in. There are also pure UV editors. You can download one freeware one on my site. Its called LithUnwrap and its one of the best.
Another freeware one is here: http://www.uvmapper.com/ but I have no experience with this one.
Bye the way from what you described I think that simple plane (box) would serve you better than cube since you need only top side of it.
Texture space is only 2d with U=0, V=0 in upper left corner of texture and U=1, V=1 in bottom right corner. Means that regardles on pixel size, texture have allways size of 1,1. Even texture of 256/128 pixels is 1,1 big.
U is horizontal coordinate while V is vertical.
To edit UV coords of model there are editors called UV editors. Most of modeling progs. have one built in. There are also pure UV editors. You can download one freeware one on my site. Its called LithUnwrap and its one of the best.
Another freeware one is here: http://www.uvmapper.com/ but I have no experience with this one.
Bye the way from what you described I think that simple plane (box) would serve you better than cube since you need only top side of it.
You mean a cube created with Irrlicht or by a 3d modeling package? (BTW, does Irrlicht have commands to create basic geometrical solids, or everything has to be modeled in a package and imported?)
The easiest way is to create your cube (in something like 3dsmax or maya or even milkshape3d), then go into face/polygon selection mode and apply your texture to only one of the faces (side). Then export your model as an Irrlicht compatible one preserving your UV coordinates and finally load it.
cheers!
The easiest way is to create your cube (in something like 3dsmax or maya or even milkshape3d), then go into face/polygon selection mode and apply your texture to only one of the faces (side). Then export your model as an Irrlicht compatible one preserving your UV coordinates and finally load it.
cheers!
-
- Posts: 15
- Joined: Sun Aug 22, 2004 2:06 pm
- Location: Estonia
It has. Check the CustomSceneNode example.afecelis wrote:(BTW, does Irrlicht have commands to create basic geometrical solids, or everything has to be modeled in a package and imported?)
To add a standard cube (http://irrlicht.sourceforge.net/docu/cl ... er.html#a3):
smgr->addTestSceneNode();
Though this contains some bugs with the normals (so textures get stretched and placed wrong), but are fixed in IrrlichtNX .
There is official help in pdf format somevere on the home page of Anim8tor. Look at it.
What you need is probably under:
Applying multiple materials
Material editor
Texture editor
Texture mode
Oh ...one more thing. Something so simple as cube or plane you can do directly in Irrlicht, just look at Custom scene node example.
What you need is probably under:
Applying multiple materials
Material editor
Texture editor
Texture mode
Oh ...one more thing. Something so simple as cube or plane you can do directly in Irrlicht, just look at Custom scene node example.
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
-
- Posts: 15
- Joined: Sun Aug 22, 2004 2:06 pm
- Location: Estonia
OK, but when I add a texture to cube in anim8or then will it be added inside the model file or not? If I remember correct, it was not added into the model file so
I have to load it "externally" via node->setMaterialTexture(). Or does the model file store the coordinates of the texture(UV mapping) and when I load the model in irrlicht and then load and add the texture, then will it be correctly placed onto the map? And what happens if I want to add many texture to a model?
For example:
I create a cube or plane in anim8or. Add it a texture on the top side. Then I'll add another to the right side for example. Ok, now I'll export it to .3ds. And what I see is three files: model file and two texture files. Now how do I add it to irrlicht project the way everything looks exatly like in anim8or? I can't set the material texture twice, can I.
I have to load it "externally" via node->setMaterialTexture(). Or does the model file store the coordinates of the texture(UV mapping) and when I load the model in irrlicht and then load and add the texture, then will it be correctly placed onto the map? And what happens if I want to add many texture to a model?
For example:
I create a cube or plane in anim8or. Add it a texture on the top side. Then I'll add another to the right side for example. Ok, now I'll export it to .3ds. And what I see is three files: model file and two texture files. Now how do I add it to irrlicht project the way everything looks exatly like in anim8or? I can't set the material texture twice, can I.
StargateSG1>> no, texture is not inside model file, it contain only data about vertex position, normals, UV and possibly animation. But normaly it links to texture file which usualy have the same name like model (not neceserily). Normaly when you load model in to the Irrlicht, it automaticly load texture too if its at the right path (usualy along model file)
If not, you have to load texture separately. Bye the way, you can load any texture on any model if it have been UV maped. And in any time during your program is running you can change texture.
As for several textures on one model ...up to my knoweledge you can use only one texture in Irrlicht for one model (you can use more but you have to apply them to diferent layers which owerlap so its not what you ask about)
If you want to have more, you have to put those two or more textures in to the one texture file (for example like diferent tilles) and UV map your model in way that diferent sides of cube use diferent parts of texture (diferent tiles).
Or you have to broke your model and load its parts separately and make them child to each other.
If not, you have to load texture separately. Bye the way, you can load any texture on any model if it have been UV maped. And in any time during your program is running you can change texture.
As for several textures on one model ...up to my knoweledge you can use only one texture in Irrlicht for one model (you can use more but you have to apply them to diferent layers which owerlap so its not what you ask about)
If you want to have more, you have to put those two or more textures in to the one texture file (for example like diferent tilles) and UV map your model in way that diferent sides of cube use diferent parts of texture (diferent tiles).
Or you have to broke your model and load its parts separately and make them child to each other.