PDA

View Full Version : Need to implement light beams under water



sansan
03-27-2012, 06:37 AM
Dear all!

I am really lost looking for an idea how I can implement the effect similar to one shown on this snapshot:
http://images.crestock.com/4120000-4129999/4124945-xs.jpg - here light spots on the sea surface are not needed, the scene should look light the result of sunlight penetrating through water.
You can also google for "light beams under water" to see other sample images that explains the task.

The result scene should have the following features:
1. Several light beams (the number of beams probably to be defined externally)
2. Some areas on the seabed lit as shown on the image above
3. Light beams should not penetrate through other 3D objects that can appear in the scene. A "3D objects" is a regular shaded or textured 3D mesh.

So far I have understood that there is some technique called "god rays" - but not really sure it is applicable in my case. It seems I need also some approach to simulate the lit areas on the seabed, not sure if it is the same algo that renders the beams.

So thanks a lot in advance for any hints or advices, recommended readings, etc.!

Cheers,
Sergey

V-man
03-29-2012, 06:06 AM
Yes, it is the same thing as "god rays" except that "god rays" are seen in the sky, coming down from between clouds.

The simplest way to simulate them is to render a quad that always faces you (look up billboarding) and apply an appropriate texture and apply blending.

sansan
04-02-2012, 08:41 AM
Thanks a lot, it sounds as a reasonable rough approximation!

But this approach is not really 3D and it does not deal with opaque 3D objects under water that the rays should normally penetrate through...seems like something similar to shadows, but how can I calculate and render the proper volume using GL?

Meanwhile, I have found some example: Hydrax plug-in for OGRE3D (http://www.ogre3d.org/tikiwiki/Hydrax)
But it also does not handle opaque objects intersecting the rays properly...

Alfonse Reinheart
04-02-2012, 01:19 PM
Handling that is really nothing more than a projective textured light.

sansan
04-02-2012, 11:26 PM
Handling that is really nothing more than a projective textured light.

Thanks for the hint, I'll try to find out more about this topic.

sansan
04-02-2012, 11:28 PM
But this approach is not really 3D and it does not deal with opaque 3D objects under water that the rays should normally penetrate through...

Sorry, of course I meant "should NOT normally penetrate through"!