0
\$\begingroup\$

I've created a Playing_Card class which is of course for card games such as Blackjack. The class works fine, except until now I have not used graphics.

I have now started using Unreal Engine and have started getting to grips with the less advanced parts such as making my own GameModeBase and Player/Pawn class.

But until now, I have made-do with just starter content only.

So this is the first model I've ever imported to UE4. I created the model in Maya and have the UV-Mapping all in place. The rear of the card is of course the same for every card, so I have made that built-in to my exported fbx. But for the face, I am not sure how to deal with it.

What I'd like is to be able to create a "Texture Atlas" of sorts. Ie) a bunch of Vector2D values along with the single width/height values for the portion I need.

But Unreal is mindblowing to me with all the options and even the docs are mindblowing to me. I would really like to learn it though. I realise this might not something that can be easily written up as an answer.

I guess what I need to get started is just to know where in the documentation does it refers to all this stuff AND even better where in the UE4 UI can I find it (what do they call this stuff?).

ONE OTHER RELATED THING: I wondered if it would hurt the program/game if I made one long texture of the card faces. So the texture file would be something like 1300x150 or something (rather than the faces texture shown in my picture)?

Any help is greatly appreciated. Here are some images to help you understand what stage I am at:

(EDIT: Well I mapped the face side to be the size of just the Ace. So in theory if I want to make it a Two I just need to move the UV forward a little bit along U (or V? Lol). I found TexCoord node but that seems only for tiling, not positioning the UV. I have looked for hours but can't find the right node. One more picture I add below might help to explain what's happening)

enter image description here

[enter image description here

[enter image description here

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Well I figured I'd have a go at answering my own question since there wasn't any responses yet and I made a little progress.

I really dislike using visual scripting/material editing but this was the only way I can get it to work. I still haven't managed to connect my Card.cpp script in so that I can adjust that value to which card, but in the Material Editor I have set it up so I can just increase the Multiply node to show the card I want.

I had to edit the texture so all cards are in a line, and I decided to remove any padding so that its easier to calculate.

So I use TexCoord node. The Y value is 1.0 showing all height of texture. The X is 1/13 (there's 13 types of card face).

Then I had to add those other nodes you will see in the picture. This took me absolutely hours to figure out. Also the UV Map in Maya had to be changed so that the card face UV just covered the entire texture.

The constant at the top-left is also '1/13' .

I would love to hear any suggestion of better way to handle this. I suppose I could easily have done the same with Y-Axis if I wanted to have a more square texture (for example to add the other suits below it). But ideally I would like to avoid all this node dragging stuff and find a way to code this stuff in C++.

enter image description here

I had hoped there would be a way to simply have two constants (UV_WIDTH, UV_HEIGHT) and then a constant array of points ((0,0) (130,0) etc etc) . Then simply use that array to move the UV via script. Is there a way to make it that simple?

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .