C Board  

Go Back   C Board > General Programming Boards > Game Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-11-2009, 11:23 PM   #1
Registered User
 
Join Date: Sep 2009
Posts: 37
opengl Light rays

anyone knows a technique to make light rays visible?? or information about it?
punkywow is offline   Reply With Quote
Old 10-12-2009, 11:01 AM   #2
Amazingly beautiful user.
 
Join Date: Jul 2005
Location: If you knew I'd have to kill you
Posts: 251
What you're looking for is called volumetric light. I've never attempted it before, but there's lots of info on google. Looks like you might need some complex math with shaders.
__________________
Programming Your Mom. http://www.dandongs.com/
CrazyNorman is offline   Reply With Quote
Old 10-13-2009, 11:33 AM   #3
Registered User
 
Join Date: Apr 2009
Location: Greece
Posts: 29
Of course volumetric light is much more realistic, but you could just add fog and blending and with a few calculations you'll have a basic light ray! Simple and easily-rendered, but not very realistic. It's up to you.
Sipher is offline   Reply With Quote
Old 10-13-2009, 11:37 AM   #4
Registered User
 
Join Date: Apr 2009
Location: Greece
Posts: 29
Those i described are also known as static light rays because it's too much to recalculate them every frame, so you let them fixed at the position you want to appear as heavily lit or/and misty.
Sipher is offline   Reply With Quote
Old 10-13-2009, 08:52 PM   #5
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
Light rays can be done via world-oriented primitives. The rays will need a density and some spacial information to render correctly.

Trying to do light rays in a shader is probably not going to yield the results you want. Post processing will probably not work b/c the image would have to be filtered many times to get a bright area to streak out enough to become a light ray. It is much easier to cast rays from the object in question to the light source creating the rays. If a certain percentage of the rays reach the light source you can then create a primitive along this ray and use colors to color the primitive to look like the color of the light source. Blending can be used to gradually blend out and/or alpha out the light ray primitive. Then post-processing can be applied to the final render which will create the bloom and glow you are looking for.

I highly recommend you read Real Time Rendering as it explains the concept very well. It is a great book if not the single greatest book about rendering ever published. It is now in it's third edition and is worth every penny. You will be hard pressed to find graphics docs on the internet that do not in some way reference material either in the book or by the authors of the book.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Critique my lighting model. psychopath Game Programming 4 08-12-2006 06:23 PM
OpenGL Window Morgul Game Programming 1 05-15-2005 12:34 PM
geometry won't display!? psychopath Game Programming 17 09-21-2004 10:10 AM
OpenGL .dll vs video card dll Silvercord Game Programming 14 02-12-2003 07:57 PM
MISC questions about OpenGL Silvercord Game Programming 12 01-25-2003 04:20 PM


All times are GMT -6. The time now is 07:10 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22