Jump to content
  • Advertisement
Sign in to follow this  
Rasmadrak

Formula for calculating different L.O.D levels?

This topic is 4205 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! Hopefully I havn't confused anyone with the topic, since it probably sounds more advanced than it really is. ;) What I need is the following: I have eight levels of detail, sorted as an integer value. The view space should be divided from the camera viewpoint to the farplane at these steps, i.e anything between step 2 and 3 has the same detail level. I've been trying to get this into a simple formula, similar to how int(somefloatvalue) return a whole number. I could probably solve it with a couple of "if larger than and smaller than", but cleary there must be a simplier, algorithmic, way ? :) Thankful for any help! /Robert

Share this post


Link to post
Share on other sites
Advertisement
I use a simple algorithm to determine where the LOD boundaries are. I don't know if it's the "standard" but it seems logical to me:

(python)

# determine LODs
lodStep = 10 # completely arbitrary. Will depend entirely on the scale you're using
lodCoefficient = 0.5
lodBoundary = lodStep
lods = []
for i in range(8):
print lodBoundary
lods.append(lodBoundary)
lodStep *= lodCoefficient
lodBoundary += lodStep



Result:
10
15.0
17.5
18.75
19.375
19.6875
19.84375
19.921875

I would just put these values into an array and be done with it.


def findLod(distance):
for i in range(len(lods)):
if distance < lods:
return i
return len(lods) - 1

Share this post


Link to post
Share on other sites
Try this: If LOD i has ni polygons and it is displayed starting at a distance of di, and LOD i+1 has ni+1 polygons, then it should be displayed starting at a distance of di * sqrt( ni/ni+1 ).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!