Hi everyone…
I was hoping you guys could help me with a little problem i’m having.

I’m trying to make a contourplot and my inputdata is:

measured points (red dots in pics)
and to complete the grid i’ve created 150X150 points that get their value based on the measured points(invers distance interpolation)
The whole mesh is drawn polygon by polygon. I’m going to use vertexbuffer later on but to get the selectionmode to work I’m had to do it this way… (theres probably a better way)

I want to have contourlines drawn on the mesh… I tried 1d texturing with gltexgen to get the lines but the result is not what i wanted, as you can see on the first picture
i get these large black fields when top/bottom of the mesh hits one of the lines. I was hoping to get thin nice lines…

Picture of mesh with 1d contourtexture

Picture of the mesh

Picture of mesh + wireframe

Picture of wireframe

here is what I’m trying to achieve:
3rd picture

If you’re applying the texture color at each vertex, you’ll run the risk of fat contour lines. If two connected vertices are on the contour, the color interpolated between them will be the same as the contour color, which could be appropriate.

An alternative approach you could take is to apply the Marching Squares algorithm and generate GL_LINES from the resulting vertices.

  • Chris

Thanks for your feedback

Each square has a weightcolor witch is generated in the initial interpolation process and when I draw them I set the color for each polygon.

I tried the marching squares algorithm but it was hell getting the lines to ‘fit’ on top of the mesh without looking edgy and having lines sticking out on the edges of a top…

I also had another idea once… make XY planes one for each interval on the z axis… and using constructive solid geometry, only draw the part where the plane and the mesh intersected… But i havent figured out quite how to do that…

can you use shaders for this project?

if so, you could map a 1d texture without interpolation and with distinctive color changes along the height. That would colorize everything in different “height” regions with a strong contrast at the areas you want lines at.

using render-to-texture you grab that “region” image and perform a image-space edge detection to get the iso-lines between regions, ideally taking depth buffer into account a bit to prevent some “wrong lines”. It’s not gonna be as perfect as actual geometrical lines, but probably the fastest way to get close to what you want.
at the end you overlay the “line image” with your regular rendering

Thanks for all the replies…
I’ve never used shaders before, so maybe its time to learn it…
The color part of the mesh is ok as it is if I increase the grid I have smooth coloring in the height. I only want black lines at a given interval.

Is there a simple way to draw the intersection between a plane and my mesh?

I realize now that I should have posted this on the newbie area since I’ve only worked with JOGL for 1-2 years…

Original content removed due to my having totally missed the point. Apologies to all for the noise.

charliejay, this is exactly the first screenshot on the original post.
the ‘W’ section would seem to be dilated, each time terrain is almost flat.
The crazybutcher idea is the only one that can maintain constant contour width.
(short of doing the geometry intersection on CPU, of course)