Advertisement

Deciding when to split quadtree node

Started by April 07, 2018 07:47 AM
1 comment, last by JoeJ 6 years, 10 months ago

Hi everyone,

I have a quadtree terrain system which uses camera distance to decide when a node should split into 4 children (or merge the children). It's basically 'split if distance between camera and the centre of the node is less than a constant * the node's edge length'.

This has worked OK so far, but now I've changed my algorithm to have many more vertices per node. This means that I want to get a lot closer to a node before deciding to split - maybe something like 0.1*edgeLength. I can no longer just check my distance from the centre as it won't work when I approach the edges of the node. I thought I could check the distance from each vertex in each node and find the smallest, but that seems like overkill (I'd be looping over every vertex in my terrain).

So my question is - what's a more elegant way to decide whether to split/merge my quadtree nodes?

Thanks for the help!

26 minutes ago, george7378 said:

I thought I could check the distance from each vertex in each node and find the smallest, but that seems like overkill

You could use only the 4 vertices of the node (or the edges), not the contained geometry. Even better, just use the edge length as a radius of a bounding sphere (or circle in 2D) and subtract this from the distance to the center.

But this causes many nodes with a high level (near the root) to become 'very close' - you decide what's best for you.

You can do something in between, use a power or root of distance etc., many options...

 

This topic is closed to new replies.

Advertisement