Can someone please explain vertexalpha to me?

Blitz3D Forums/Blitz3D Programming/Can someone please explain vertexalpha to me?

Gabriel(Posted 2003) [#1]
The more observant among you will have noticed that I'm not new here, but I totally don't get vertexalpha.

I understand that you have to use EntityFX blah,32 to force blending. But for some reason, I also have to use EntityFX blah,2 ( use vertex colors ) to get anything to show. That's a problem because it louses up my texture ( obviously )

I also don't get face sorting. I mean I understand that you z-sort the faces ( relative to the camera ) but I don't see how you specify the drawing order.

As I said, not a newbie, but I might as well be on this. I don't get it at all.


Difference(Posted 2003) [#2]
You're right. It's FX=2+32 to get it working.

You can't use only the alpha part of the vertex color.
Set the r=255, g=255, b=255 (or whatever entitycolor/brushcolor you are using now) and it should look the same.

Face sorting is done by clearing the triangles from the surface and adding them again in correct z order. You need to:
Store the triangles (vertex indexes and x,y,z for sorting if you want to avoid lookup, you can store just the triangle center, and you can precalc that in object space)
Clear surface triangles ( ClearSurface mysurf, False, True)
Sort triangles
Add them back to the surface (Addtriangle )


Ziltch(Posted 2003) [#3]
From memory, you need to set all the vertexcolors via a loop to 255,255,255.
If it is a blitz sphere,cube,cone etc you also need to set all the vertexalphas as well. The object will be invisible until you do.

Also ,as mentioned elsewhere on the forums, Until a bug fix and an update this command has varying results per graphics card, most looking bad.


Gabriel(Posted 2003) [#4]
Perfect, thanks for the great explanation guys. Unusually for me, I believe I understand the theory perfectly now. :)