Jump to content
  • Advertisement
Sign in to follow this  
Clairvoire

Grayscale "Cliff" Detection

This topic is 4413 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
Advertisement
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
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!