Page 1 of 1
Two textures one mesh
Posted: Tue Oct 30, 2012 11:56 am
by TheSentry
Is there a way of creating a mesh using two different .png?
I want to make all 52 cards for a Blackjack game and I have:
CardSkin
(Attached)
and the faces for the 52 cards that are in one cardstack
I really don't want to have to add the cardskin to each cardface texture -.- that would be a lot of work and a lot wasted memory!
Is there a workaround which I'm not aware of?
I'm using 3dsMax 2013 with the EasyOgreExporter
In my game I have the card object and I'd love to just have different materials for the cards. That should allow me to do:
Code: Select all
m_card.m_mesh.setmaterial("Ass-Heart");
That would be great but I have no clue how to accomplish that

Re: Two textures one mesh
Posted: Tue Oct 30, 2012 2:09 pm
by metaldev
Your game will probably run a lot faster if you use the same material for all the cards.
My approach would be:
Lay out all the card textures on 1 texture sheet, and UV all the different cards and export them as separate models, and choose them like that.
If you want to do it your way, you need to export 1 card with 2 different materials. In Ogre, you will find that the card has 2 submeshes. You can assign a material to the appropriate submesh.
Re: Two textures one mesh
Posted: Tue Oct 30, 2012 3:31 pm
by TheSentry
Do you really think its better to load a 5000x5000 texture to the GPU?
And then i'd have like one material and just choose between the models not the material?
But then i'd have the same cardmesh over and over again?
But thanks i'll give it a try

Re: Two textures one mesh
Posted: Tue Oct 30, 2012 3:45 pm
by metaldev
well, my suggestion is best for performance....
but you are right of course, there are other considerations.
I would only include into the texture the relevant parts... the image of the club, and heart, the numbers, the joker etc.... basically the designs on the texture space would be repeated with the UVs. You can probably get it to a 1024 texture by cutting up the geometry of the cards only a little bit.
Re: Two textures one mesh
Posted: Tue Oct 30, 2012 5:15 pm
by TheSentry
Right thx ^^
I'd just have to work on optimizing the texture
EDIT: I guess the texture size has to be a power of two?
Re: Two textures one mesh
Posted: Tue Oct 30, 2012 8:00 pm
by metaldev
it doesn't HAVE to be.
But it might depending on the hardware (for example some iOS devices won't even displaly non power of 2, as well as some consoles).
Regardless, it is best practice to optimize the way the video card loads the textures in by using power of 2.
good luck

Re: Two textures one mesh
Posted: Tue Oct 30, 2012 10:15 pm
by TheSentry
Thx
I was just asking because I used to work in bare DirectX and there you had to get it to be a power of two ^^ same for XNA...
Wow I have a lot of UVs to do

Re: Two textures one mesh
Posted: Thu Nov 01, 2012 12:55 am
by syedhs
I think you can just use maximum 7 textures, but there will be a need for programming for the reasons which will be stated later on in this post:-
The textures:-
1) The texture for the back of your card
2) The texture which contains the 4 card symbols (I dont know if this is the correct way to say it lol) : spade, love etc
3) The additional textures like 'king' and 'queen' card which has the picture of king or queen
The programming involved will be:-
1) First you have to know the coordinate of the all the symbols and also the size.
2) Depending on the card, the 3rd texture is supplied (some card doesn't need this).
3) All these information are then fed into shader which does all the rendering.
So total textures would be 1+1+probably up to 5 textures from texture (3) above. I said up to 5 because I didn't look up the cards to find all the unique background image of the cards.
Re: Two textures one mesh
Posted: Thu Nov 01, 2012 12:26 pm
by TheSentry
Yes I also thought that it would be possible that way but I'd like to keep it really simple because its just a small project for school and I don't want to fiddle that long with getting right coords and stuff just for the cards
The solution with one bog texture works just fine
But thanks anyway I'm sure that'll help me later ^^