Resizing Textures

Blitz3D Forums/Blitz3D Programming/Resizing Textures

.rIKmAN.(Posted 2004) [#1]
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.


Sledge(Posted 2004) [#2]
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.


.rIKmAN.(Posted 2004) [#3]
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?


GitTech(Posted 2004) [#4]
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?


.rIKmAN.(Posted 2004) [#5]
bigger?
The texture is already 600x450, I don`t really want it bigger - I want it smaller! :)


GitTech(Posted 2004) [#6]
Mm, maybe scale it down, so it's 200x150, then create a new texture (256,256) and copy it into the new texture?


Genexi2(Posted 2004) [#7]
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?


Gabriel(Posted 2004) [#8]
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.


.rIKmAN.(Posted 2004) [#9]
@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?


Mustang(Posted 2004) [#10]
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.


.rIKmAN.(Posted 2004) [#11]
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 ;) )


Damien Sturdy(Posted 2004) [#12]
Lol @ rIKmAN. dude, you shouldnt tell us that, youl get ridiculed!


.rIKmAN.(Posted 2004) [#13]
haha, if you can`t poke fun at yourself mate, you cant poke fun at others...
I simply can`t poke full stop ;)


VIP3R(Posted 2004) [#14]
LMAO

Sorry m8 :)


Damien Sturdy(Posted 2004) [#15]
Thats twice you dirty B*****d.

Lol!!!!