Jump to content
fn_Quiksilver

Testing terrain gradient of an area

Recommended Posts

Hi guys, 

 

Any idea how to test terrain gradient of an area?

 

Currently using a sloppy method of getting the Z-axis of 4 corners of the area and using basic math to get the avg slope of the difference, wondering if there is a better solution. isFlatEmpty checks gradient but not sure how.

Share this post


Link to post
Share on other sites

yes BIS_fnc_terrainGradAngle is good but only tests one vector. To get a true picture of an area we need to test multiple sites in an area.

 

Basically have to put that function into a loop and iterate through different directions. If any of the directions exceed a certain limit, or add up the total and divide ...

 

Surface normal isn't the right tool, tests only the surface at the exact position.

 

I can't think of an elegant solution except to 'spiderweb' an area with bis_fnc_terraingradangle tests.

Share this post


Link to post
Share on other sites

Basically have to put that function into a loop and iterate through different directions. If any of the directions exceed a certain limit, or add up the total and divide ...

 

Surface normal isn't the right tool, tests only the surface at the exact position.

Get surface normal at some point, project it on XY plane (i.e. drop its z coordinate, and (optionally) normalize vector), convert projection into compass direction: you end up with direction of maximum slope gradient at that point.

Beware of normal vectors very close to Z axis, they're the source of roundoff and other calculation errors.

No direction loop required.

Share this post


Link to post
Share on other sites

Create a function to return terrain vertices, then you only need to collect the heights of each vertex in the area, then check the variation/deviation or min/max or however you want to decide it's too steep/flat.

 

I have created functions to achieve similar results somewhere....

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×