alpha face sorting inside single mesh? 2004-03-29 - By Mads Rydahl
Back Hi all,
I am creating an old school grid-based 2d digging game for a client, and for a downloadable full screen version, I am making an optimized sw3d version of the game, which displays all the 2d sprites as a single lingo mesh with a 300-500 faces, using 4 verts/2 faces for each sprite, changing the vertex positions and shaders of moving/animated faces and rebuilding the mesh every frame. The decision to use sw3d is simply a means of achieving reasonable performance in full screen on slower systems, and I render the scene using an orthographic camera. All of the shaders use alpha. http://www.planet.dk/temp/shrooms.dcr (~300Kb - in development, has known bugs)
I would like the higher items in my grid to overlap the ones below, and I assumed that I would be able to force a certain draw order by offsetting the individual faces in z. However this does not seem to be the case. http://www.planet.dk/temp/views.jpg (~60Kb)
I have tried multiple geometrical approaches, including offsetting all 4 verts 1 unit in z and keeping the camera close by, offsetting 1000+ units, slanting the faces, so that the lower two verts are significantly in front (like this: /////), rotating the entire model slightly, you name it... I feel I've tried everything, but I don't understand the logic at work.
It seems like all faces using the same shader are rendered at the same time, but in random or indeterminable order, and all the posts and tests I've read suggest that they'd be sorted and drawn according to their distance from the camera. Would it make sense to use the same monster size texture for all graphics (and just jumble the texturecoordinates) to ensure that difference in shaders do not interfere with the drawing order?
Another weird thing is that this seemingly random render order displays consistently strange on both ortho and perspective cameras in the scene. And their order changes every once in a while, but I cannot establish when or why.
Any help would be greatly appreciated.
/mads
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|