Ok, I’m confused about something. When importing pictures into Unity I get an error about the sides of the texture needing to be powers of 2. I read up on the importing of textures and it is in the documentation as follows.
“Texture Sizes
In order for textures to work in real-time enignes, their size must be a power of two on the sides. The allowed sizes are as follows: 2, 4, 8, 16, 32, 64, 128, 256, 512 or 1024 pixels. The textures do not need to have the same size horizontally and vertically, but each side have one of lengths mentioned above.”
My question is this. Lets say I’m making a room that has paintings hanging on the wall. If I want to use a painting that is some type of panoramic image Unity won’t import it. Or if I just take a pic with a digital camera and want to import it…that won’t work either.
I try to resize the pics and always end up fighting with the size of the file to use. Is there any way to import a picture that can have it’s own dimensions? Or even a better question what program do you recommend I use to resize pictures? Every time I get the image into Unity it looks so different from the image I wanted to import.
-Tom
If you want a panoramic shape just use the two closest power of 2 numbers like 256 wide by 128 tall. You can always leave an area in the texture transparent to make a non panoramic shaped texture look panoramic. If you need help with learning how to create an alpha (transparency) that Unity can use head over to the http://unify.bluegillweb.com site and go through the tutorial on creating a true alpha channel.
As far as using images from a digital camera you are always going to need to edit them in some form or another. If you need them in there original aspect ratio just use the trick mentioned above to place it in a larger texture and use transparency. If you want to create a tilable texture (like grass for example) there is also another tutorial on the http://unify.bluegillweb.com site that tells you how to take a digital image and create a tilable texture from it.
I would suggest Adobe PhotoShop for image editing and texture creation. Jeff
Remember that it’s OK to stretch or squeeze your textures to the nearest power of 2. Your UV’s on your objects will bring them back to their correct proportions.
For example:
If i have a mesh plane that represents my panoramic picture that is 4" x 2" and I size my texture to the closest power of 2, say 512x256 then once it’s applied to my mesh it will size the texture to my mesh using the UV information in effect making it 4" x 2" again.
hope that’s clear…
Also, with the example of the painting. You could use a program like Photoshop to squeeze the image into a square. Then, when you stretch it to the right aspect ratio on the model, it will look normal. This gives a little more flexibility than using 2:1 ratios.
This is essentially how anamorphic lenses work in filmmaking. The actual 35mm frame on film is no where near as wide aspect ratio as the theater screen. The image was “squished” with a lens, however, and then it’s “unsquished” with a lens on the projector.
“If you want a panoramic shape just use the two closest power of 2 numbers like 256 wide by 128 tall. You can always leave an area in the texture transparent to make a non panoramic shaped texture look panoramic.”
That’s just the answer I was looking for. Thanks a million.
-Tom