Advertisement Jump to content
Sign in to follow this  

Concavity for LOD calculation

This topic is 4912 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

It's been years since I've had any calculus, so any input from you gurus would be very helpful. Here is the background to my question. I am using bicubic surfaces to render a terrain, and the first derivative to find the surface normal. Now I want to create my LOD system and figured that the concavity of the surface gives me a great indication of how "curvy" the surface is at any point. The higher the value returned by the second derivative, the more extreme the concavity is, and the more subdivisions I should use to render it. Basically the concavity being positive or negative does not concern me, but rather the absolute value. Now I need to know, how does this concavity value that is returned scale between functions? What I mean is, if I want to set up a pre-defined threshold that says for instance, any |concavity| <= 2 means lod 0 and |concavity| > 2 means lod 1, how do I know I can trust the "2"? Will 2.0 for one curve be the same 2.0 for another curve, or is the value relative to the function in a way that I should normalize this value before using it directly. Sorry if this was not explained clearly. I will continue searching but there is little hope of finding this answer elsewhere since most discussions of concavity are only concerned with the sign +/-.

Share this post

Link to post
Share on other sites
I would google for "Curvature"... there's some texts on this stuff.

I assume you are rendering heightfields, and have function f(x,y) giving height. Now, second derivatives really depends to how curved surface are.

What you need is to use some operator, like Laplacian, i.e. divergence of gradient. d^2/dx^2+d^2/dy^2 if i'm not mistaken.
It really defines sorta bumpness on some point, and could work correctly if properly implemented. As about sample values, for example functions like x^2+y^2 have laplacian equal to four.

Though, it does not work well on surfaces like x*y where you'll get zero everywhere but surface is definately curved. For these things, you can try using something like that:
d(d/dy)/dx+d(d/dx)/dy (so for f(x,y)=x*y you get df/dx=y and df/dy=x and this thingy is equal to 2)
and use sum of absolute values of both for "curveness".

Also, beware of scaling, if everything is A times bigger, first derivatives stay same and second derivatives will be A times smaller.

Implementation wise, I would do that: if normals of triangle (or quad) are too non-parallel, subdivide it. Or that: if point on grid is too far away from middle computed from ajacent points, sibdivide more. That'll be simpler to implement and could work better.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!