Help Forum or Fudge Forum 2?

Is This a help forum or a fudge forum!

If it is a help forum then

I have written a small app that imports height data and constructs a quadstrip height field, I colour all quads green(grass).
I wish to shade the terrain according to elevation(ie highest light green, lowest dark green).

I managed this once before using lighting, I entered the vertices coords as the normals then did something daft with the lighting and it worked although it was flat shaded. I can not seem to recreate this.

I have tried another approach using colours for each vertex instead of lighting, but there is a horrible banding which matches horizontally but not vertically(this is probaly because I am drawing a quadstrip across, then dropping directly down and drawing another until the height field is drawn.)

does anyone know where I can get some examples, or can help


Paul Sharp

I think this is a help forum. But maybe not all questions can be answered. I know I have been helped a lot. And I try to answer as many as I can - this is possibly self-serving on my part but oh well. I have found that being friendly and respectful of others has improved the quality of my life. But sorry I do not know the answer to your specific question at this time. If and when I learn it I’d be happy to share it with you.

First off, you’re rude. Don’t always expect an answer in 20 minutes after you post, because people may not have the answer to your question. So don’t get PO’d about it…

Second, I do happen to have an answer, or at the very least be able to tell you that I’ve done what you’re asking about a few months back. However I cannot remember exactly how. I’ve since moved the approach to a color lookup table and thus experience the “horrible banding” you so proclaim, but thats what I want as I didn’t feel like implementing contour lines.

Anyways, to sum up the original thought, I don’t know if I still have the smooth shading code that I did, so lets see…

If I find it, I’ll post it shortly. But as mentioned above, please be patient and don’t flame. (I have to dig through several versions of code, may take a while).


Thanx swicko

Hi ironduke !

That’s good to see you again.
I almost missed you…

Meanwhile, I have no answer to your question (which should makes me a F***ING BASARD !).



Eric where’s Gorg!

Only he can answer my stupid questions!

Do you think this thread can become as legendary as Fudge 1!

I hope not (in response to the above).

I found the code… hope it shuts yo… I mean hope it helps.

// Old smooth coloring code
float zColorRange[6] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
float zColorRangeBase = 0.0f;

	case TRUE :
		if(zColor > zColorRange[5])
			zColorVal = (zColor - zColorRange[5]) / zColorRangeBase;
			glColor4f(zColorVal, 0.0f, 1.0f, 1.0f);
		else if(zColor > zColorRange[4] && zColor < zColorRange[5])
			zColorVal = 1.0f - ((zColor - zColorRange[4]) / zColorRangeBase);
			glColor4f(0.0f, zColorVal, 1.0f, 1.0f);
		else if(zColor > zColorRange[3] && zColor < zColorRange[4])
			zColorVal = (zColor - zColorRange[3]) / zColorRangeBase;
			glColor4f(0.0f, 1.0f, zColorVal, 1.0f);
		else if(zColor > zColorRange[2] && zColor < zColorRange[3])
			zColorVal = 1.0f - ((zColor - zColorRange[2]) / zColorRangeBase);
			glColor4f(zColorVal, 1.0f, 0.0f, 1.0f);
		else if(zColor > zColorRange[1] && zColor < zColorRange[2])
			zColorVal = (zColor - zColorRange[1]) / zColorRangeBase;
			glColor4f(1.0f, zColorVal, 0.0f, 1.0f);
		else if(zColor < zColorRange[1])
			zColorVal = zColor / zColorRangeBase;
			glColor4f(zColorVal, 0.0f, 0.0f, 1.0f);

	default :


As you can see I just ripped it from the old guts of a defunct project. I hope you can decipher it.

It does work though… or at least it did last time I used it. Not the fastest, but it provided a nice smooth gradient between vertices or varying levels.

Good luck.


cant work this **** out swicko

thanx anyway.

Those who where rude can go and F! themseleves.

Better to keep your mouth closed and have people think you’re an idiot…

Then to open it and prove it too them

Scum boy