Jump to content
  • Advertisement

Archived

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

xxenon

Lighting a big flat terrain

This topic is 6087 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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

Share this post


Link to post
Share on other sites
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
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
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
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!