Lighting a big flat terrain

Started by
8 comments, last by xxenon 22 years, 5 months ago
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
Advertisement
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
You mean I have to decompose it in multiple quads or triangles ?
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
- thomas
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
I would say the best way for this job are
lightmaps!
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
- thomas
Hi there,

projected textures may be usefull here,
they are exactly like a projector!

hope it helps

Mark
One Word--> LIGHTMAP''s
J.A.N.K.E.Y.: Journeying Artificial Nocturnal Killing and Exploration Youth
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

This topic is closed to new replies.

Advertisement