--- Curtis Olson wrote: > In this case the trees aren't so much loaded ... there's only one small > texture that defines the trees (or group of randomized tree images.) What > does need to be done is that a set of random locations needs to be generated > across the surface of each tile ... and this needs to happen sometime after > the terrain is loaded. > > Right now this appears to be done in the main render thread once the > polygons get within some visible distance (although the behavior of this is > slightly weird and you can be ontop of an area before the trees are actually > generated.)
The tree locations are generated when the tile is loaded, not when they come into view. The tree visibility is a problem I'm still trying to solve. Currently I create a 32x32 quadtree across the extent of the trees within the tile. If there are trees at each corner of the tile, that effectively means that the tile is split into a straightforward 32x32 grid. Each rectangle in the grid is a LoD node with a range of 8000m, under which are all the trees within that space, within a Group node. So, all the trees in the rectangle become visible when you get within 8000m of the center of the rectangle. I _think_ that sometimes the center of the rectangle is more than 8000m from the edge, which is why you can be ontop of the area before they appear. However, in some cases I've see the area I am on top of _not_ have trees, even though the areas to either side do, or the visibility of the trees depends on the direction I'm looking. I'm not sure the reason for this - it could be that the LoD loader is catching up, or something. BTW - could someone tell me the maximum size of a tile, in km? If people want to experiment with different settings: - TreeBin.hxx line 57 (#define SG_TREE_QUAD_TREE_SIZE 32) defines the size of the grid. - materials.xml line 96 (<tree-range-m>8000</tree-range-m>) defines the LoD range for the trees. I'm thinking of changing the approach so that instead of working out the extent of the grid from the set of trees, we simply create a NxN grid across the tile, put the trees in appropriately, and then remove the empty nodes. This would have the advantage of improving performance when the tile is loaded: Currently we iterate through the list of trees twice - once to work out the extent of the grid, and then again to place the trees in the correct rectangle. Alternative approaches and any comments would be gratefully received. -Stuart ___________________________________________________________ Support the World Aids Awareness campaign this month with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel