Davidobot wrote:
Oh hell yeah we're interested. Does it have better performance than the 3D viewer released on the Projects and Demos subforum?
How does the z-sorting work, in terms of accounting for different heights and such?
Quick disclaimer, the whole process it pretty slow, I can render about 1200 models before things start to hit about 60 fps on my decent laptop.
The 3D viewer seems to use a system very similair to mine: The model's texture is a spritebatch, you generate the quads, and render it accordingly. The only difference is that my system only re-renders when it has so. (When either the camera or model rotation change.)
The z-sorting is done according to a 'Depth-score', which is calculated with the following line of code:
Code: Select all
return x * ximportance + y * yimportance + z
(Where z is height)
ximportance and yimportance are numbers between -1 and 1, these values are determined by the camera rotation.
Originally z-sorting was done with table.sort, but I've written a algorithm that works like lists (
http://lovefiddle.com/zRbrTvMapCshjCxym) that sorts it a lot faster.
All in all, the system is quite limited, you can't really overlap models, creating art for it is really hard, particles will be very hard to implement, but the end result is very unique.