drawTriangles, z-sorting and culling in flash player 10

My first real post woop!

Ok here’s the scoop, if you have every played with 3d in flash and want your meshes to render correctly you will need to ensure its polygons are drawn in the right order (from back to front).

Simple, just sort them on the average z-value of their transformed vertices (or centroid).

Well you can stop right there, with the new flash player 10 extracting the z values can be a bit tricky, I have seen the uvt data generated used with some success to solve this issue but I don’t know if there is a better way lurking out there. Any ideas?

Following on from that is another issue… back-face-culling, this used be easy and only took a couple of ms to run through about 10,000 polygons to check their winding.

But what’s that you say?  “drawTriangles can do the culling for you if you only but tell it to!”

Well, although it can (using TriangleCulling.POSITIVE/NEGATIVE) that’s no use to me!!!!

I wan’t my triangles culled BEFORE I draw them, meaning I don’t waste time sorting polygons (the painful bit) that will never end up being rendered!

Now as yet, I’ve not come up with a method that can simply project all my vertices, cull all my triangles, then sort the badgers, then draw them. I am sure it’s got to be doable.. I just don’t have the brains.

I expect dozens of solutions and corrections…so hit me.


behold.. a mighty blog was born

Well I don’t know about mighty but here she is.

My name is Ben and I like to flash.

I’ve been in the game for a while now and figured it was about time to set up a little place to share my woes, expose my experiments and hopefully gain some knowledge from perhaps the best on-line community there is.

But don’t expect great things just yet… for I am a man with far more questions than answers.

Hopefully this won’t be a waste of space and with any luck it will be a source of enlightenment for you and me.