Sign in to follow this  
c_olin

OpenGL Implementing lighting in my OpenGL engine

Recommended Posts

I'm currently writing an ongoing OpenGL graphics engine for educational purposes. I've had some experience with OpenGL in the past. But I have some questions. Eventually for my engine I want to have per-pixel lighting and dynamic soft-shadows (only for point lights, with max 2-3 rendered at a time). But first I need to implement per-vertex lighting. My question is, to do this do I use OpenGL's default lighting functions? Or do I write all of the lighting from scratch? In prior experience with OpenGL lighting I found that the system was entirely messed up. IE the limiting distance of the point lights never worked. Can anyone point me in the right direction to start getting lighting implemented into my engine? Thanks

Share this post


Link to post
Share on other sites
Visit http://ati.amd.com/developer/index.html

download rendermonkey. It has some GLSL demoes for PPL and per vertex lighting.

Share this post


Link to post
Share on other sites
Quote:
Original post by c_olin
My question is, to do this do I use OpenGL's default lighting functions?
Generally, this isn't a good idea. Standard GL light functions nowadays simply wrap to updating some special uniforms... you may have heard that fixed function pipe is dead: don't use it.

You're going to use shaders anyway sooner or later.

Quote:
Original post by c_olin
Can anyone point me in the right direction to start getting lighting implemented into my engine?
The shader lib from NV is possibly the most extensive free reference here. Programming vertex and pixel shaders by Engel features a few different lighting models. It's a nice way to keep this info organized.
Once the math behind is clear, it just takes to design the uniform layout and stuff like that... something that it's really proprietary to your system.

Share this post


Link to post
Share on other sites
Yes, OpenGL lighting is more or less obsolete, but if you want some quick results without touching any shader stuff - why not. If you want to combine it with more effects and shadowmaps - reimplement properly with shaders.

Share this post


Link to post
Share on other sites
Yes, it's subjective. I never liked standard GL functions in the first place so I started from a biased position. :)
There are places in which quick prototyping helps... I don't think this is one.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this