What would be the best way to provide realtime lighting in an OpenGL terrain scene? The level of detail between of each quad will be generated dynamically as it is subdivided as it zooms in, so a pre-calculated light source will not work. I would like to simulate a sun on such a terrain. It doesn't have to be the best. It just has to look good enough. I am not familiar with shaders.
Asked
Active
Viewed 1,055 times
2
-
1Your question is incredibly broad. There is no "best way" to light terrain, just as there is no "best way" to implement terrain. Whatever way you're going to use will, more likely than not involve shaders. So I would suggest you [get familiar with them.](http://www.arcsynthesis.org/gltut/) (FYI: I wrote that tutorial.) – Nicol Bolas Aug 06 '11 at 05:16
-
I already have the terrain engine in place. I have the option of doing a plain vertex shading or using opengl's dynamic lights, or to learn how to make shaders (or maybe there are shaders already made for this?). I need to focus on speed for lesser systems in real time. – oldSkool Aug 06 '11 at 05:19
-
That doesn't make your question any less broad. There's no actual answer, because "best" is subjective. Try to boil your question down into something answerable. – Nicol Bolas Aug 06 '11 at 05:23
-
Well, it's rather hard to explain since this is my first venture into dynamic lights. I can do static lighting (multitexture) which is precomputed, and vertex lighting which is just an interpolation of shading from one vertex to the next over the surface of each quad. My terrain engine is too dynamic for this due to the dynamic face subdivisions, and the light source is going to be moving (the sun). The polygon count on the screen at any time is fairly constant, but the view can be changed over a wide area.... (more). – oldSkool Aug 06 '11 at 05:35
-
I assume that using OpenGL's dynamic lights are fairly easy to implement, but will it provide decent performance on older computers with minimal graphics hardware? I am not sure about shaders, either. I need a method to implement lights fast (over a large quad patch). What do you think I should look into? – oldSkool Aug 06 '11 at 05:37
-
1: This is not a forum. Questions are asked, answers are provided; we don't go back and forth talking about various stuff. 2: Your question doesn't fit the [established guidelines for questions](http://stackoverflow.com/faq#questions); it is too broad. Indeed, any question with "best" in it cannot be answers, as "best" is subjective. – Nicol Bolas Aug 06 '11 at 06:12
1 Answers
2
There's always Ye "Olde" Shadow Maps...e.
Though to cut down on artifacts you'll probably want Perspective Shadow Maps (PSM), Light Space Perspective Shadow Maps (LiSPSM), or Trapezoidal Shadow Maps (TSM).

genpfault
- 51,148
- 11
- 85
- 139