Archived

This topic is now archived and is closed to further replies.

xxenon

Lighting a big flat terrain

Recommended Posts

xxenon    122
I have a basic question about lighting. Imagine you have a flat big terrain like a football terrain only made of 1 GL_QUADS. As lighting is evaluatated at each vertex (per-vertex lighting), how could I render a realistic lighting on this terrain (like a projector moving on it). Thanks for your suggestions. xxenon

Share this post


Link to post
Share on other sites
Havok    122
I''m pretty sure you have to tesselate your flat terrain to get decent OpenGL lighting on it. As you said, OpenGL''s lighting is calculated at each vertex.

quote:

OpenGL''s lighting calculations are done per-vertex. This means that the shading calculations due to light sources interacting with the surface material of a 3D object are only calculated at the object''s vertices. Typically, OpenGL just interpolates or smooth shades between vertex colors. (...)


Quote taken from "Avoiding 19 Common OpenGL Pitfalls", by M.J. Kilgard

Share this post


Link to post
Share on other sites
Renus    122
YOu could also keep your current solution, bring the static lighting into the footbal field texture and do all dynamic lighting (player''s and ball''s shadow) later by other techniques (stencil buffer or simply a flat object with object''s shape).


- thomas

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
quote:
Original post by xxenon
You mean I have to decompose it in multiple quads or triangles ?



Exactly, the more vertices the more accurate your lighting will be.

If your lighting is static it''s probably more efficient to follow Renus'' solution. Not sure about that though.

Havok

Share this post


Link to post
Share on other sites
Renus    122
quote:
Original post by Crash_Kid
I would say the best way for this job are
lightmaps!



I dont think so. Lightmaps make only sense for different lighting on same textures. The given example of a football terrain has opposite preconditions. Lightmaps would be overkill.



- thomas

Share this post


Link to post
Share on other sites
MButchers    123
The problem with light maps is that they are
generally quite small resolution and so would
appear very blocky when applied to a single
large quad.

Look here for a good article on shadows and
lighting using projected textures

http://www.r3.nu/~cass/shadowsandstuff/

as your only using a quad in a single plane
it should be quite simple and effective.

The only problem is it relies on a stencil buffer.

Hope it helps

Mark

Share this post


Link to post
Share on other sites