Sign in to follow this  

Grayscale "Cliff" Detection

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

I'm working on a 2D game that uses Grayscale images for height. The actual height is no problem, but there is a major problem: Whenever a character comes into a major sheer face, (or technically, when it refers to a bit from the greyscale sharply higher than the previous), it 'teleports' him or her straight to the top. I know I should be able to fix this by interpolating between each pixel on the grayscale, (or at least I think I know), but knowing what to do, and how to do it are very exclusive ideas... If it means anything, the game uses vector coordinates to determine a character's speed and direction, and the traditional (x, y) coordinates for the location. Also, though you probably already figured it out, movement is free in all directions. Because of how there are no restrictions of movement, it's very important that the game be able to assume a curved cliff where there would be an irregular diagonal array of pixels. I figure this must be a problem everyone runs into eventually, so there must be a solution out there somewhere; no matter how many times you reinvent the wheel, it can be no better than the original.

Share this post


Link to post
Share on other sites
You really need an interpolation function. The interpolation function should model the reality you are creating visualy.

Ie, if you are using bilinear interpolation in the terrain shading then you should probably use bilinear filtering for the heightmap interpolator. This will make it fit closely with what the user expects based on what he sees.

Make things easy on yourself.. write a function which gets the interpolated height at a given floating point X,Y pair and try to keep it simple and efficient. Just about everything else you need to do with heighmaps should be querrying this fuction when they need a height, rather than the actual heightmap data.

Share this post


Link to post
Share on other sites

This topic is 4108 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this