Hi, I hope this is the right forum for asking this question.
I’m new to the engine and I’m trying to build a simple puzzle game.
what I’m trying to achieve is to spawn a certain number of blocks, each box will have its own number (i.e from 1-8).
Each block would have the number displayed on one of the faces of that box.
How can I achieve this using the material editor/engine editor.
I have no idea on how to project text on an object, also I would like it to be one material for all the cubes and have the text given as a parameter.
I assume its a pretty easy task for an experienced user.
Doing this in material only is not easy task, so if you insist (or if its really that you need it as material, we can dig into that later)
There is “render text” component. You could make your block plus render text actor as single blueprint, expose on spawn text to render. Then manipulate those blueprint actors instead off blocks.
To make this work: create new blueprint, lets say BP_Block, add 2 components to it: block and render text. Create variable that holds text to display, and maybe second for text color etc. Expose them to editor and on spawn.
Now to add those actors from another bp: you spawn actor from class and use BP_Block as its class.
But if you want more than 200-300ish of those blocks then indeed you need single mesh with material per one.
So if you really need that display digit material:
give me exact shape of block, ie dimensions if its box,
which faces and orientation you want to have digits displayed, this is needed for uv mapping of mesh
If i have time this weekend i can make mesh, material for it and uv layout texture.
I added an image that shows what I’m trying to achieve.
Basically for starters I want it to be as simple as I can in order to distinguish between the tiles so I can test my game logic.
Later on I might want to change the size of the puzzle and the material for the tiles and board (have different sets) and maybe even replace the text with parts of an image.
What do you think would my the simpler choice in order to get this working as fast as I can?
Ahh so you need instanced material with x,y for face. Then you need picture that has all pieces of image (or numbers).
Brute force method is making 16 boxes each covering different part of image, but that’s lame and inefficient.
Keywords you are looking for (to use in google) are “unreal atlas material”
Your case is the simplest version of it all.
Basically make master material, make nodes as those:
ok, I thought about using a texture atlas with number on it, but since its just numbers in my case I thought there might be a simpler solution so I can change the label on the box later on if I wanted to.
for example replace and numbers with letters.
I guess if I make this a texture atlas I can use a texture atlas for the numbers and a different texture for the wood for example and combine them both somehow.
I guess I should really watch some basic materials tutorials. Up until now I only focused on programming and blueprints.
For your game, if you use render text actors, you are stuck with text.
If you make material you can have any picture as puzzle.
That is why i suggested material way.
You can always skip whole material panning trickery.
Make array of your boxes in 3d application, select them all and apply 1uv space to top surfaces
You get picture nicely cut and apply do top surfaces.
But material atlas is more flexible.
btw. There may be some dedicated material function now that does what i described.
ok now the cube is all black, I assume its because my digits are black and transparent background produces a black color.
so in order to solve this I should combine with another color or a wood texture?
You forgot to put your numbers texture into that texture node.
Also expand all nodes (small grey triangle) so i can see what is inside.
Unless you want to change that numbers material from instance, you do not need texture as parameter, simple texture node will do fine.
ps. Follow material tutorials, you lack some basic knowledge here. Watch at least basic tuts.
ok so I watched the materials tutorial, what I’m still missing is so basic understanding of how UV layout works in unreal.
I tried to use my material on the blocks and as you can see in the picture, the numbers are on the bottom side of the cube, how can I change this without rotating the cube?
can someone recommend a good tutorial for these UV layout issues?
how do I give each face different material? this is what I couldn’t find.
I’m not even sure what to search for.
Also I’m setting the material for the digit from blueprints according to the index, can I do it when there are more than one material on the mesh and keep the other materials the same?
How can I do this?