how to split a big texture into several smaller ones?

Problems building or running the engine, queries about how to use features etc.
Post Reply
fla666
Greenskin
Posts: 129
Joined: Fri Oct 31, 2014 4:22 am

how to split a big texture into several smaller ones?

Post by fla666 »

I upload a atlas as a big texture , and want to split the atlas into several smaller texture , how to do this would get best performance ?

i have tried to use texture->getBuffer->getCurrentLock to get a dest pixelbox, and texture->getBuffer()->blitToMemory(pb) to get the src pixel box, then copy per bytes from src to dest.

in fact ,this way copy data from gpu to cpu first , then resent data to gpu, could somebody give a more efficent approach ? for instance, how to tuse FBO in this case , thanks !

by the way , as all smaller textures will be set into a texture unit of a material , is it possible to share the big atlas texture between different materials simply ,and just use appropriate uv coord ?
User avatar
WilliamKappler
Kobold
Posts: 33
Joined: Mon Feb 16, 2015 8:37 pm
Location: Raleigh, NC
x 2
Contact:

Re: how to split a big texture into several smaller ones?

Post by WilliamKappler »

I don't know about using an FBO with Ogre, but looking it up gave me this: http://www.ogre3d.org/docs/api/1.9/clas ... bject.html If you have any success using that, I would be interested in it, as I will need to do some intense texture rewrites in my own program.

As for the last part, yes, you can just have one material with a bigger texture and use UVs to map different parts of the texture to them. If you want just half of an image, make the start/end vertex 0.5 and the other 0 or 1 respectively. Same principle works for more divisions. Be aware, though, texture filtering and mipmaps could possibly cause some minor issues. If you see render quality problems, you might need to play with those settings or turn off filtering. It really depends on how you're using the textures if that will be an issue.
Software Designer • World Builder • Game Designer • Engineer
Post Reply