Gradual EntityFade

Blitz3D Forums/Blitz3D Programming/Gradual EntityFade

(tu) ENAY(Posted 2003) [#1]
Any one have any idea how to do a shooth gradient fade.
Like They they use for light sprites in games?
To put it into proper words, image a cube, the far left is 100% and the other side 0% in opacity. If that makes sense.

The way I'm thinking it's done is to have a gradient texture and change to add entity blend (I think that's it's name)


sswift(Posted 2003) [#2]
You'd only use add blend if you want add blending.

If you want alpha blending, then you can do two things.

1. Make a texture with an alpha channel that blends smoothly from white to black.

2. Set the vertex alpha of the vetices for one side of the cube to be 0.


Either way, be prepared to discover that when you use alpha blending on an entity, the polygons on it are not sorted, and as such the ones in the back will draw over the ones in the front half the time when they should not, making the object look kind of inside out.

The only way to solve that would be to sort the polygons manually yourself, which means determing the distance of each triangle in each surface of the object from the camera, sorting them from back to front, clearing all the triangles (but not the vertcies), and then re-adding them in the right order.

Which isn't that hard to do, but it isn't very fast either and should only be done for very low polygon meshes.


(tu) ENAY(Posted 2003) [#3]
Well, I only plan to do this with strategically positioned quads. But at least I know there *IS* a way to achieve what I want. Thanks swifty boy.

> sorting them from back to front,

Pfft. Easy ;)


IPete2(Posted 2003) [#4]
Enay,

Yeah, I think there is a new command for this:

sortentity entity,back,front,please

and alternatively

sortentity entity, front,back,ta

...er not! :)


IPete2.


sswift(Posted 2003) [#5]
I think I finally figured out just what the hell you brits are saying when you say "ta". Ta must stand for Thanks Alot. Right?


Anthony Flack(Posted 2003) [#6]
Nah, it just means thanks, it's an extremely shortened version, it don't stand for nowt.