Page 1 of 1

Sprites?

Posted: Mon Feb 07, 2011 5:34 pm
by Yrogirg
Is there a way to add sprites in a map? Just thought they are faster rendered than textured meshes.

Re: Sprites?

Posted: Mon Feb 07, 2011 8:38 pm
by JeffM
The term you are looking for is "billboards", as in a 2d image that is drawn at a 3d location always facing the camera.

There is not a billboard object in V2. There may be something you can do in V3 using the lua scripting interface.

You can define a mesh that is a rectangle that is "standing up" that has your image on it but it will look like a line when viewed from it's edge.

Re: Sprites?

Posted: Mon Feb 07, 2011 11:00 pm
by Cobra_Fast
In case you are indeed referring to sprites, they are possible with the "texsize" option and using texturematrices.

Re: Sprites?

Posted: Mon Feb 07, 2011 11:11 pm
by JeffM
sprites are a 2d screen aligned image. The texture size matrix will simply allow you to scale a texture on a object. It will not make it always face the screen, and the object will still exist in 3d space.

Re: Sprites?

Posted: Mon Feb 07, 2011 11:31 pm
by Cobra_Fast
In my understanding a sprite is a texture thats got multiple textures on it. Like four 500x500 textures on one 1000x1000 image or similar. Like the missile.png or explode1.png or explode2.png from BZFlag's data folder.

Re: Sprites?

Posted: Mon Feb 07, 2011 11:52 pm
by JeffM
That is not a traditional definition of a sprite. Technically the shots are animated billboards, they always face the screen. The fact that we shove more then one frame of animation into the same image is simply an optimization.

In order to benefit in the way the poster suggested, using images instead of geometry, you would need a screen aligned image. For example as it would be simple to use a billboard (2d image) of a ball instead of a round ball shaped mesh. The billboard would draw using 2 triangles and the geometric ball would draw using many many more. For simple shapes this can be a huge savings in drawing speed.

Traditionally a sprite is defined as a bitmaped graphic used as part of a scene. It is a valid request to ask if the bzflag engine supports them.
http://en.wikipedia.org/wiki/Sprite_%28 ... raphics%29

Re: Sprites?

Posted: Wed Feb 09, 2011 3:32 am
by optic delusion
Maybe use the drawinfo animation technique I have used? Apply the multiple images to a plane, and use a set of dyncols to modulate the transparency.
It's pretty easy to do, once you know how. Contact me via PM.