Resizing Textures
Blitz3D Forums/Blitz3D Programming/Resizing Textures
| ||
How can i resize a texture that is not a power of 2, to be a valid size - without ruining the texture. I have tried resizing and stuff but if I keep proportion in the axis I can`t get a valid ^2 size, if I turn it off the texture gets all stretched and ugly. The size it is at the moment (600x450) it looks like it is getting sized up by the video card so is stretching when in engine. Cheers. |
| ||
You're at a bit of a logical impass - if the proportions don't realistically allow for convenient resizing then you are going to get a measure of stretching. You could scaletexture it back once it's loaded though. |
| ||
I thought there might be some magic formula out there that one of the arty types knows - ah well. How would you know how much to scale back by? |
| ||
Maybe create a new texture that is bigger than the old texture, and copyrect the old texture to the new texture. And then recalculate the UV coordinates? |
| ||
bigger? The texture is already 600x450, I don`t really want it bigger - I want it smaller! :) |
| ||
Mm, maybe scale it down, so it's 200x150, then create a new texture (256,256) and copy it into the new texture? |
| ||
Why not resize it to 512x512 in a paint program, then UV it so it displays to its original proportions on the mesh\sprite\whatever? |
| ||
Simple. Resize it to 512x384, expand the canvas to 512x512, which creates a new 128 pixel border top or bottom and adjust the UV coordinates like Genexi said so that they fit the portion of the texture that now contains your texture, leaving the 128 pixel border along the bottom with no triangles UV mapped to it. |
| ||
@Sybixus: This is a wall texture, so could be used a lot. Am I going to have to do this for every object/face that I use the texture on - cos that is loads! Also, I am going to export my level meshes plain (ie. no textures or anything) and then apply textures and normal maps in-code, so how could I UV map using this technique? PS. I am having to do it this way because I am using CShop to build my levels then exporting as b3d. Of course I need to be able to control the texture layers for using base textures, normal maps and decal textures (multitextured) so the first thing I have thought of is to export bar, then apply all the stuff in-code before the main loop. Not a good idea? |
| ||
Usually you upscale the texture - like if you 256*118 sized texture you scale that to 256*128 with GOOD paint prog - it will look streched, but will display correcly if you UV-mapped that using the original image dimensions. 600*450 is problematic because making it power-of-2 would mean that it would become 1024*512 texture... if that's too big, you just have to accept small loss of horizontal accuracy and scale it to 512*512. |
| ||
hmmm..why someone made these tileable textures in 600x450 is beyond me, unless they were meant for actual 3d rendering, maybe size is irrelevant here...(which is what I always tell me gf ;) ) |
| ||
Lol @ rIKmAN. dude, you shouldnt tell us that, youl get ridiculed! |
| ||
haha, if you can`t poke fun at yourself mate, you cant poke fun at others... I simply can`t poke full stop ;) |
| ||
LMAO Sorry m8 :) |
| ||
Thats twice you dirty B*****d. Lol!!!! |