Skip to main content

Height map rendering

4 replies [Last post]
erniejunior
Offline
Joined: 2009-08-21
Points: 0

Hi,

i'm new in java3d. Until now i just built moving cubes etc... But now i want to do more. I would like to render a height map (e.g. for creating a landscape). I tried to use many QuadArrays. But the QuadArrays don't seem to be sensitive for the lighting in the scene. I can built my ,,landscapes'' but they are just plain white; now shadows on it. So my question is: is there a better method to put a height map (grayscale image or generated array of doubles) to a 3D geometry object? Or how do i get shadows on my QuadArrays (e.g. gouraud)? I would be very pleased if someone could give me a hint. Just a search phrase for google would be fine. Because i searched the whole internet but found nothing except this article: http://nice3d.de/index.php?option=com_content&view=article&id=50:heightm... but it is not based on j3d. Thank you in advance for your answers.

Greetings,

Maximilian

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chambs100
Offline
Joined: 2010-05-07
Points: 0

Hi Maximilian,

Did you ever get this to work? I am dealing with a similar issue right now. I am trying to create a scene from terrain (digital elevation model, or greyscale image w/heights). I am not understanding how to load the data or put it into QuadArray.

I don't have problems with lighting, but simple getting the data in. If you are still using this forum, could you send a reply? I can contact you off forum if need be.

adrianoaristarco
Offline
Joined: 2007-11-02
Points: 0

Hi, i'm writing a terrain rendering system for java3d, in my opinion you should avoid quadarray and simply use triangle strip array (a single triangle strip array for all the heightmap, better if interleaved). If your heigthmap is small (up to 129x129) you can avoid to use a lod algorithm.

For light, for me, is better to have a lightmap and disable the real time light but if you want real time effects you just need to compute the normals of the vertex and assign a material to your terrain:
http://www.flickr.com/photos/26280288@N05/3199222336/
you can even set the color of the vertex, using the vertex height:
http://www.flickr.com/photos/26280288@N05/3005533543/
or (better) use a texture:
http://www.flickr.com/photos/26280288@N05/3198375655/

it heavly depends of what you need to do with your terrain

Hope it helps.
Cheers

ngnguye
Offline
Joined: 2008-03-21
Points: 0

Would you please email me sample get-start codes rongcon1 @ yahoo. I would like to learn more on this. Thank you.

odinsbane
Offline
Joined: 2009-08-24
Points: 0

If you use quad arrays, and you create their normals, you will get effective of shading. Some possibly issues you migh be dealing with is your light source. An ambient light source won't cause shading. And when you set a quad arrays normals the backside might not reflect light. Plus you need some sort of material.