- Home /
simple texture question
Hi.. I am planning to make a 2d Platform Game.
But first i have to ask you something about textures.
Lets say that i want to put a cube in my scene. And i want to put a texture on my cube. Like the image below..
Its a cube and a texture applied on the cube.
Well if i want to do the same thing like the image above what i have to.. I mean in the photoshop ?
Possible answer
Just do the picture on the photoshop exactly as the image above, add it to unity, create a material, add the texture(image) in the material and add it to the cube.
Is this ok to do it...??
And if i do this i will have the same result ass the picrure??
Thank you
Answer by pyro · Dec 03, 2010 at 12:47 AM
2D Textures are usually square textures (256x256, 512x512, 1024x1024) created in photoshop. You can create a bunch of 2D graphics and squeeze them on one 1024x1024 texture usually referred to as a sprite sheet.
In order to show a 2D texture on a 3D object, the 3D object needs to be UV Mapped, this is done in a 3D modeling application.
In your example, a cube, depending on how you UV map your cube, it will affect the look of the texture on the cube. In some cases where each face is mapped to the same UV coordinates, you can drop a texture on it and it will show up on each face like how you are thinking.
However, if you're doing 2D you should forget about using cubes and focus on one face of the cube (aka a plane). In particular your plane should only consist of 4 vertices (a quad), then you would UV map that plane to a particular spot on your 2D texture sprite sheet. Make sure the 3D quad objected is rotated so that its always facing the camera and you have yourself a basic billboard sprite.
If you don't feel like doing all of that work though you could always look into SpriteManager (SM2) which will make the process of creating sprite sheets and mapping them easier as well as greatly simplifying sprite animation.