uploading wide textures
|
Khaal Bakalava
Registered User
Join date: 3 Sep 2005
Posts: 21
|
09-20-2005 03:03
hello all, i'd like to know how to upload textures in a wide format, rather than in a cubic? i have a texture that was 400 pixels wide and 200 in height, but unfortunatly the live help wasnt too good so i ended up cutting it into 200X200 shape and uploading it twice, and it didnt look too pretty in the end.
is there a solution around for this?
|
Julian Fate
80's Pop Star
Join date: 19 Oct 2003
Posts: 1,020
|
09-20-2005 03:37
As long as the dimensions of your texture are powers of 2 (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024) you don't have to use a 1:1 aspect ratio. 32x64, 128x512, 16x1024, etc.; all should be fine.
The powers of 2 rule goes for 1:1 aspect ratio textures too.
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
09-20-2005 08:44
Just to elaborate on what Julian said, resize that 200x400 to 256x512 and it should be just fine. If you don't do it yourself, SL's gonna do it anyway when you upload it, and trust me, Photoshop will do a better job of it than SL will.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Forseti Svarog
ESC
Join date: 2 Nov 2004
Posts: 1,730
|
09-20-2005 09:28
hey chosen, what exactly is the SL engine doing?
I mean, if I bring in a picture that is 512 x 397, it still looks decent in Second Life. Is the image getting distorted during the import then undistorted to display? I'm a bit clueless as to what's going on beneath the surface here.
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
09-20-2005 13:43
From: Forseti Svarog hey chosen, what exactly is the SL engine doing?
I mean, if I bring in a picture that is 512 x 397, it still looks decent in Second Life. Is the image getting distorted during the import then undistorted to display? I'm a bit clueless as to what's going on beneath the surface here. It's gonna resize it to the nearest power of two in each direction. 512x397 would come out to 512x256. Chances are it's still gonna look okay after resizing, although it'll obviously be squashed a bit, but it won't look as good as if you had done it yourself since you'd be able to fix any artifacts by hand, and the software can't. Here's an example image, with the dimsions you specified, 512x397. The first window is Photoshop; the second is SL. Notice the circle becomes an elipse. Sure you could straighten it out by placing it on a 5.12x3.97 meter prim, but it's not gonna look as good as it could have because there are pixels missing.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Forseti Svarog
ESC
Join date: 2 Nov 2004
Posts: 1,730
|
09-20-2005 14:31
From: Chosen Few It's gonna resize it to the nearest power of two in each direction. 512x397 would come out to 512x256. Chances are it's still gonna look okay after resizing, although it'll obviously be squashed a bit, but it won't look as good as if you had done it yourself since you'd be able to fix any artifacts by hand, and the software can't.
Here's an example image, with the dimsions you specified, 512x397. The first window is Photoshop; the second is SL. Notice the circle becomes an elipse. Sure you could straighten it out by placing it on a 5.12x3.97 meter prim, but it's not gonna look as good as it could have because there are pixels missing. So if you have to load a cezanne painting which lands between 512x256 and 512x512, you either have to add pixels to the side (with what?) or crop the painting (can't do that either) or have pixels forcibly removed? I am only semi-technically literate, lol, so if anyone is inspired to explain why this is necessary, I'd love to hear.
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
09-20-2005 15:06
From: Forseti Svarog So if you have to load a cezanne painting which lands between 512x256 and 512x512, you either have to add pixels to the side (with what?) or crop the painting (can't do that either) or have pixels forcibly removed?
I am only semi-technically literate, lol, so if anyone is inspired to explain why this is necessary, I'd love to hear. For highest quality, I'd suggest mounting the painting on a 512x512 background. Then, after it's uploaded to SL, set the repeats per face so that the just the painting is showing. To go back to your 512x397 example, you'd set the repeats to 1x0.775, the reason being that 397 is 77.5% of 512. For best results, keep the painting centered on the canvas. To do that, just open it as is in Photoshop, and then go Image -> Canvas Size, set it to 512x512, and save.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Quin Quatro
design
Join date: 21 Jul 2005
Posts: 23
|
09-20-2005 15:07
Actually, if you going to be picky about resizing those odd sized images, what you can do is have photoshop do the stretching first and then have SL squeaze them back in place.
So, if you had a 512x400 image in photoshop, you'd use 'Image Size' to convert it to 512z512, and thus the short dimension would be stretched to 512. You upload that way but then apply the square image on a rectangular face and it will be squeezed back to the correct proportions via SL software. The method, to me, seems rather archaic because both photoshop AND SL are interpolating the pixels, but I've tried it and it works and looks fine.
The other option is to add white space on the one end to make a square and then play with the texture settings to not show the white space area, but that seems like a lot of trouble.
All and all, though, I'm not really sure there is much quality difference in loading different sizes. I've done all types and haven't seen a problem. However, I do wonder if the rezzing time is affected by whether your image fits within the power of 2 rule, or not.
Just some thoughts. YMMV.
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
09-20-2005 15:19
From: Quin Quatro Actually, if you going to be picky about resizing those odd sized images, what you can do is have photoshop do the stretching first and then have SL squeaze them back in place.
So, if you had a 512x400 image in photoshop, you'd use 'Image Size' to convert it to 512z512, and thus the short dimension would be stretched to 512. You upload that way but then apply the square image on a rectangular face and it will be squeezed back to the correct proportions via SL software. The method, to me, seems rather archaic because both photoshop AND SL are interpolating the pixels, but I've tried it and it works and looks fine. Your last statement here is correct. You're gonna end up with some artifacts since pixels are being added to the image. Chances are it's still gonna look okay, but be it great or small, loss is loss. There's not much point in resizing things twice. From: Quin Quatro The other option is to add white space on the one end to make a square and then play with the texture settings to not show the white space area, but that seems like a lot of trouble. It's more trouble if you only add blank space to one side than if you add it to both. As long as the image is centered, it's just a simple question of percentage to calculate the serttings. The big side will be 1 repeat per face, and the little side repeat will be whatever percentage the ratio is between that side of the painting and that side of the canvas. In other words, just divide the little side by the big side and you've got it. For images that are not powers of 2 in either direction, it's just as easy. Just use the same formula on both sides. If you've got a 460x460 mounted on a 512x512 canvas, then the repeats in each direction would be 0.90, since 460 is 90% of 512. Easy as pie. From: Quin Quatro All and all, though, I'm not really sure there is much quality difference in loading different sizes. I've done all types and haven't seen a problem. However, I do wonder if the rezzing time is affected by whether your image fits within the power of 2 rule, or not.
Just some thoughts. YMMV. As for the quality question, you're right that in most cases the image will still look okay even if you don't bother mounting it first, but as I said earlier, any amount of quality loss is still a loss, and since it's so easily preventable, why not do it? As for rezzing time, and the power of 2 rule, that question is moot since each and every image gets automatically resized to a power of 2 the moment it enters SL.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Forseti Svarog
ESC
Join date: 2 Nov 2004
Posts: 1,730
|
09-20-2005 15:27
thanks you two. This is illuminating. I already find myself playing both with tiling and offset for most of my textures on various sides of prims, so I guess when I find myself in a position where clarity of image is really important, I'll try chosen's approach.
learn something new every day!
(course I don't know why SL engine requires this to be done... obviously for performance reasons)
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
09-20-2005 15:50
I don't know why either, although I'd imagine it must be for performance reasons. Regardless of technical reasons though, it is common practice for texture artists to work in powers of two, so from my point of view, that reason alone is enough justification. It pretty much always makes sense to work along established guidelines if there's no reason not to.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
09-21-2005 02:48
From: Chosen Few I..although I'd imagine it must be for performance reasons. Exactly - powers of two turn (slow)multiplication into (really really fast)bit shifting. Remember that while the debate on padding or stretching a 512x400 image is really interesting and informative, it only applies to images that are already that size - i.e. your legacy stuff. Chances are you can create all your new content at power-of-two sizes right from the start - and you should do so.
|
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
|
09-21-2005 05:12
A quick skim did not make this point very clear, so I will. Let's say you have a 300x400 pixel photograph that you'd like to make "right" in SL. Use your favorite image editor to bicubic resample the image to 256x256, import to SL, and put it on a prim face that is 3x4m. Tada!
|
Elianna Malaprop
Registered User
Join date: 24 Jul 2005
Posts: 15
|
09-22-2005 08:37
Actually...I think it would be better to add white space around the edges of your painting, as Chosen Few describes, centering the original painting on a 512x512 square. Upload and apply it to a prim, setting the texture repeat to 1 repeat per meter (or whatever) in both directions. Don't base the size on "repeats per face". Uncheck the "stretch textures" box, then resize the prim so that only the picture shows and the whitespace is hidden. You would probably have to adjust the offset too.
That way, the picture should be resized as little as possible, and always proportionally.
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
09-22-2005 08:55
From: Elianna Malaprop Actually...I think it would be better to add white space around the edges of your painting, as Chosen Few describes, centering the original painting on a 512x512 square. Upload and apply it to a prim, setting the texture repeat to 1 repeat per meter (or whatever) in both directions. Don't base the size on "repeats per face". Uncheck the "stretch textures" box, then resize the prim so that only the picture shows and the whitespace is hidden. You would probably have to adjust the offset too.
That way, the picture should be resized as little as possible, and always proportionally. Well, that's a way to get around doing the math if you really don't want to figure out percentages. In the end, it comes out exactly the same though. Personally, I feel it's much quicker to just do the simple division and plug the numbers into the repeats per face, but if you'd rather eyeball it by unchecking "stretch textures" and then doing some trial and error, that's up to you. I gotta say though, I really don't see the advantage of working with repeats per meter over repeats per face. If you're using a default cube, which is 0.5M^3, you're only going to see part of the image at first, making your resizing into a lot of guess work. The only way around that is to start with a cube that's already the right size, which means you're going to have to do the math anyway. From my point of view, this is just a very round about way of getting the same results you would have gotten in the first place, simply to avoid doing about 3 seconds worth of division on a calculator. Nothing wrong with that though; it'll certainly work. It'll just take a little longer. To each his own, I guess.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Mack Echegaray
Registered Snoozer
Join date: 15 Dec 2005
Posts: 145
|
12-18-2005 18:23
The power of 2 limitation affects all 3D engines as it's a hardware requirement: OpenGL drivers will refuse to let you upload a texture that doesn't use ^2 dimensions. The video cards themselves won't deal with them, which is why the 3D engine will resize it for you if you don't.
And yes the underlying reason has already been stated: powers of two can be manipulated using extremely fast bit-shift operations. When you're trying to render millions of triangles per second a performance improvement like that can be significant.
I believe these days there are GL extensions for non ^2 texture sizes but I expect usage of that has downsides, otherwise the limitation would just be removed in the driver itself (the API doesn't require it, it just fails if you ignore the rule).
|
Hello Toonie
Registered User
Join date: 25 Jul 2005
Posts: 212
|
03-16-2006 09:14
From: Mack Echegaray I believe these days there are GL extensions for non ^2 texture sizes but I expect usage of that has downsides, otherwise the limitation would just be removed in the driver itself (the API doesn't require it, it just fails if you ignore the rule).
That actually seems to be how it works on recent nVidia drivers - you can just create/populate a non-^2 texture the same way as any other, without having to 'activate' this ability with some extension API-poking. It's so transparent, my program was doing it accidentally for some weeks, much to my annoyance when I came to test it elsewhere... grr.
|
Dianne Mechanique
Back from the Dead
Join date: 28 Mar 2005
Posts: 2,648
|
03-16-2006 09:21
Just a minor note on Chosens suggestion about putting white space around the image and using offsets.
Offsets sometimes "break" in SL for long periods of time. I use them a lot, but you have to be aware that if you want it *perfect* and for it to *remain* perfect, you have to tailor the image to the face of the specific prim.
Offsets basically shift around due to the rounding math at times.
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
03-16-2006 12:28
i have never seen this problem , course there probally alot of thing i havent seen  but i have understood this to be a syndrome of a rotten prim (ya know those ones that bump you up a meter when you walk on them, or fall tru them ect)
|
Cottonteil Muromachi
Abominable
Join date: 2 Mar 2005
Posts: 1,071
|
03-16-2006 14:46
From: Forseti Svarog (course I don't know why SL engine requires this to be done... obviously for performance reasons) Its not just the SL engine. Almost all 3d game engines do this. Its to do with loading textures into memory in regular chunks for OpenGL to display it onscreen. Easier and faster that the textures are already all power of 2 to begin with instead of having to resize all the odd sizes on the fly, then load it.
|
Maximillion Grant
Registered User
Join date: 29 Jul 2005
Posts: 172
|
03-16-2006 15:11
Hmmm, maybe I'm not getting what some of you are saying but I upload rectangular textures all the time and it seems to work well, but I always size my prims to keep the same aspect ratio. (This is obviously for things that repeat once like signs)
For example, if I have a sign that is 512 x 348 (always keeping it multiples of 2) I will place it on a prim with the dimensions 0.512 x 0.348 and then resize using the white handles to keep the aspect ratio, adjusting the depth later.
Compressing the image using image size and then having SL stretch it back out seems like you would lose a bit of resolution both in the squashing and in the stretching, especially if you need to keep small text legible.
Am I missing something?
|
Hello Toonie
Registered User
Join date: 25 Jul 2005
Posts: 212
|
03-16-2006 15:21
Yeah, you're missing that SL will quietly resize this to e.g. 512x256 at upload time. You can tell the real, SL-resized dimensions of a texture in the texture-chooser window IIRC.
|
Maximillion Grant
Registered User
Join date: 29 Jul 2005
Posts: 172
|
03-16-2006 15:31
I've noticed those dimensions listing but I assumed it was a bug since the images seem to look ok in game. 
|