Lines in my terrain

Started by
3 comments, last by oggialli 18 years, 1 month ago
Well I created a little light function to create omni lights and directional lights. The problem is the lighting creates a grid outline and I'm wondering if anyone knows a way to help with that. I was thinking about reading in all the neighboring vertices and averaging that value to get a soft lighting value that should be smooth, but I think that would be rather costly. Here's a link to a pic of what I'm talking abuot. The first pic is just directional lighting and the second is directional as well as a few omni colored lights. http://filebox.vt.edu/users/rengle/stuff/terrainlight.jpg http://filebox.vt.edu/users/rengle/stuff/terrainlight2.jpg Thanks.
"Real men don''t use parachutes" -Guy in Firearms
Advertisement
Are you specifying different normals for the same vertices shared between neighbouring quads? Each logical vertex should only have a single normal which/the light values based on it should be interpolated across the primitives it belongs to. Using vertex indexes (glDraw(Range)Elements) this would come implicitly along with the performance/memory benefit.
Olli Salli
I've seen that before, IIRC it's a combination of the interpolation across the triangular surface being less than ideal and mach banding making it look worse than it actually is.

Fortunately although it looks less that ideal now, the effect will dissappear as soon as you put a texture across your terrain.
You might also want to increase the exponent of the light whilst decreasing the cutoff somewhat. That will give you a less blocky light.

Here are some values I took from my light class when it was running on a semi-detailed mesh, but gave nice rounded lights :

[FLightManager] System supports 8 lights
[FLightManager] Adding new light number 0
[FLight] Changing light 0 type to spot light
[FLight] Switching light 0 on
[FLight] Changing cut off value for light 0 to 12.38
[FLight] Changing exponent value for light 0 to 309.56
[FLightManager] Adding new light number 1
[FLight] Changing light 1 type to spot light
[FLight] Switching light 1 on
[FLight] Changing cut off value for light 1 to 15.53
[FLight] Changing exponent value for light 1 to 388.37
[FLightManager] Adding new light number 2
[FLight] Changing light 2 type to spot light
[FLight] Switching light 2 on
[FLight] Changing cut off value for light 2 to 14.13
[FLight] Changing exponent value for light 2 to 353.16
[FLightManager] Adding new light number 3
[FLight] Changing light 3 type to spot light
[FLight] Switching light 3 on
[FLight] Changing cut off value for light 3 to 11.96
[FLight] Changing exponent value for light 3 to 299.05
[FLightManager] Adding new light number 4
[FLight] Changing light 4 type to spot light
[FLight] Switching light 4 on
[FLight] Changing cut off value for light 4 to 14.19
[FLight] Changing exponent value for light 4 to 354.81
[FLightManager] Adding new light number 5
[FLight] Changing light 5 type to spot light
[FLight] Switching light 5 on
[FLight] Changing cut off value for light 5 to 18.91
[FLight] Changing exponent value for light 5 to 472.79
[FLightManager] Adding new light number 6
[FLight] Changing light 6 type to spot light
[FLight] Switching light 6 on
[FLight] Changing cut off value for light 6 to 11.91
[FLight] Changing exponent value for light 6 to 297.64
[FLightManager] Adding new light number 7
[FLight] Changing light 7 type to spot light
[FLight] Switching light 7 on
[FLight] Changing cut off value for light 7 to 11.63
[FLight] Changing exponent value for light 7 to 290.71

[Edited by - Fahrenheit451 on March 4, 2006 6:29:26 PM]
If you can use fragment shaders, try implementing per-pixel lighting. Still to me it seems your normals are off in some way.
Olli Salli

This topic is closed to new replies.

Advertisement