PDA

View Full Version : Compressed Texture Loading (Sort of )



Rodrix
05-15-2006, 06:08 PM
Hi everyone!

I am working with X Billboard Trees but I don't want to use simmetricall plants. Therefore the solution is to use 1 Quad that contains half the plant's texture (call it A) repeated simmetricaly around the y axis. And another Quad that contains the other half of the plants texture (call it B) repeated simmetrically around the y axis. You put the two together and you got a really good looking tree that is not simmetrical no matter what side of the X you look at. However this involves loading two textures bitmaps. Since both textures can be made from only one (since they repeat the data as they are through the y -axis), I was wondering if there is a way as to make the two simmetrical textures at run-time, saving memory.
I am going for performace, so any advice is well welcome! Thanks!

The diagram you be like this:
............................B..................... ...
............................|..................... ...
............................|..................... ....
............A ________|_________ A.......
............................|..................... ...
............................|..................... ...
............................|..................... ....
............................B..................... ...
So no matter where the player looks, he will see a non simmetrical plant with half texture A half texture B.

Thanks!
Rod

zeoverlord
05-16-2006, 07:01 AM
Saving memory, i don't know, but you can cut down on the number of batches by placing the two textures in the same texture.

And yes you can create them at runtime, but unless you have a real good reason for that then i advice against it.
It's better to create the textures in a proper 3D renderer like maya or lightwave, or perhaps photograph a real tree.

Rodrix
05-16-2006, 10:25 PM
Originally posted by zeoverlord:
Saving memory, i don't know, but you can cut down on the number of batches by placing the two textures in the same texture. Yes that could be an option.

However what option do you consider best when thinking of performance:
1) -Using a single 512x512 texture with 4 Rectangles Quads and mapping each rectangle with the appropiate half of the texture.
*That is one 512x 512 texture into memory. 4 Texture binds. 4 Quads per Tree.
2) -Using a single 512x1024 texture (two 512x512 textures combined) with 2 Rectangle Quads, that map the first texture to the first texture of the 512x1024 and the second texture to the second texture of the 512x1024.
*That is one 512x 1024 texture into memory. 2 Texture Binds. 2 Quads per Tree.

Which one will provide me the best performance?
The maximum of trees used will be 500. I have a lot of textures loaded into memory...

Thanks in advance!
Rod

Rodrix
05-16-2006, 10:53 PM
Wait... if I am using the same texture object and I am mapping the quads differently (with text coord) I can actually use 1 Texture bind right?
So the question would be
1)*That is one 512x 512 texture into memory. 1 Texture binds. 4 Quads per Tree.
VS
2)*That is one 512x 1024 texture into memory. 1 Texture Binds. 2 Quads per Tree.

zeoverlord
05-17-2006, 07:07 AM
You know. it doesn't really matter as long as you only have one bind, do what looks best. You could try option #3
one 512x512 texture into memory. 1 Texture Bind. 2 Quads per Tree. but your squashing the texture a bit.

or #4
one 512x512 texture into memory. 1 Texture Bind. 2 Quads per Tree. Using the same image on booth quads.

or #5
one 512x512 texture into memory. 1 Texture Bind. 1 axis aligned Quad per Tree.

You could also drop the resolution to 256x256, Just make shure that they are only drawn at a distance and not up close, use the real tree geometry for that