# The Industry's Foundation for High Performance Graphics

1. ## Relief mapping

Hi there,

This is probably a really stupid question but here goes. I need to create a relief map created from a matrix of evenly spaced height values, with cravasses (possibly represented by splines?) to be kept very sharp in the transitions from high to low.

I then need to read the interpolated values back in, to give a more detailed view. Is any of this possible using openGL? How do I create such a surface, how do I attach splines to said surface?

Do something nice, help the stupid

Cheers,

Phil

2. ## Re: Relief mapping

hey bumpy.

i didn't exactly understand what your post was about, so bear with me...

Originallyl posted by bumpy:
I need to create a relief map created from a matrix of evenly spaced height values, with cravasses (possibly represented by splines?) to be kept very sharp in the transitions from high to low.
first off, i'm not sure what using splines to represent the height map would get you. do you mean that you would have a height map and then a separate list of crevices represented by splines? pehaps you could elaborate on your thoughts there.

if what you need to do is create a 2d relief map based on a height field, then i don't think opengl will be of much help. you can simply calculate the lighting yourself using a diffuse lighting model (the intensity of light at a vertex is proportional to the cosine of the angle between the normal of the surface at the vertex and the direction from the light to the surface). i think the standard is to have the "sun" placed to the northwest of the map at an infinite distance away, so that the incoming rays of light will all be parallel.

using that method, you'll naturally be able to pick out crevices pretty ok (depending on what direction you choose to have your rays of light coming from), because slopes perpendicular to the incoming rays of light will either receive full intensity (if they're facing the light) or no intensity (if they're facing away from the light), whereas flat land wouldn't receive as much light.

another thing you could do is test to see if the ray of light intersects the geometry of the terrain mesh before it reaches the current vertex, in which case you wouldn't light the current vertex as much. that way you'd be able to see shadows, which would make it easier to pick out valleys and such.

Originally posted by bumpy:
I then need to read the interpolated values back in, to give a more detailed view.
i have no idea what you meant by that.

Originally posted by bumpy:
Is any of this possible using openGL?
where opengl would come in handy is if you want a nice 3d model of the height map. but if you just want to create 2d relief maps, i'm not sure how you'd use opengl for that.

3. ## Re: Relief mapping

Thanks for the reply, I'll try to clarify my situation.

I don't really need to display anything, I'm just trying to find a way of representing a surface so that I can retrieve the interpolated values. I know where these crevices are in the map, and would like them to be represented as extremely sharp transitions, even in the interpolated values.

It's been a while since I did anything with 3d and OpenGL, so excuse the extreme rustiness. I'm caertainly open to suggestions for any better way to do it.

Bumpy

4. ## Re: Relief mapping

so you just need to interpolate values between posts? so, for example, maybe you want the height at location 0.5, 0.0 (halfway between the first post in the x-direction)?

in that case, i don't think opengl will be of any use. you could just interpolate bilinearly if you don't need really high quality results. if you want really good results, then sure, you could use something more sophisticated, such as hermite interpolation or cubic splines. maybe test with bilinear interpolation first and see if that works for what you want to do. if you're confused about how to actually do the interpolation, i could explain it in more detail. a height map representation of the data is fine for interpolating values.

i'm not sure though how the interpolation of the height map will affect the perceived sharpness of the crevices. i don't think the interpolation scheme will have much of an impact at all.

--steve.

5. ## Re: Relief mapping

Hi Steve,

Thanks once again for the reply. You are quite right, it is really a height map that I am after, and the interpolated values of the map in particular.

The main reasoning behind the splines idea was if, for examply a cliff has a sharp drop of 200m -> 0m, I don't really want to interpolate values of 150m, 100m, 50, etc, I need to keep such transitions sharp.

My basic idea was to detect such cliffs, represent them as a spline both on the high level, and on the lower level thus preserving the sharpest of transitions possible.

Quality is may main concern, any help is much appreciated. Any pointers would be great!

Bumpy.

6. ## Re: Relief mapping

what you want to look up are 3d spline surfaces. check out the curves and surfaces section of the real time rendering home page for some good links to tutorials on spline surfaces. the first link they give (the only one i looked at) has lots of stuff.

good luck bumpy.

--steve

7. ## Re: Relief mapping

Cheers Steve, just what I was after, much obliged.

Bumpy

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•