On Sunday 15 September 2013, Nick Whitelegg wrote:
> However there were other suggestions made at SOTM such as the use of 
> z-buffering. However given I don't actually triangulate, or draw, the DEM 
> surface at the moment, would this actually be more efficient? Presumably I'd 
> have to either draw the DEM surface as a transparent surface and let OpenGL 
> do the calculations (as it normally would when doing depth testing)

Yes, though OpenGL is very fast at this if done right, with Vertex Buffer 
Objects etc. Of course, "done right" isn't necessarily always a straightforward 
thing - you still have to decide _which_ triangles to draw - if you decided to 
just always draw every triangle in the country all the time, you'd run into 
problems. For highly detailed terrain, people tend to use clever techniques 
like octree rendering for rendering triangles at different LOD by distance. 
This is where people tend to start using proper 3d engines rather than 
implementing it themselves.

> or keep a record of the triangles myself and do the z-buffering, or other 
> technique (e.g. ray tracing to find intersecting triangles) myself? Given 
> that, would these alternative techniques actually be more efficient than what 
> I'm currently doing?

Um, I think the jury's out on that one. It depends how efficiently your 
alternative implementation is written. I suspect, what with the large-ish DEM 
dataset you're working with, most of your cpu time will be spent looking things 
up from memory.

The other thing is that while you're approach may work well with the lines 
you're drawing at the moment, you don't necessarily know that it'll work nicely 
with things you want to draw on the terrain in the future. Whereas the z-buffer 
technique works with most anything, with per-pixel occlusion.

But it may be a lot of bother for not a lot of gain, depending on how long you 
wanted to spend on a terrain triangulation system. Your Bresenham technique 
might prove to be "the right way" to do the simple things you want to do here. 

I would hoever recommend that you at least look at the options available to you 
in 3d engines as they may really speed up your development as you go further 
with the project. There seem to be quite a few open source ones available for 
android.


robert.

_______________________________________________
dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/dev

Reply via email to