Hi Adrien,

I'm having a slight problem understanding your questions, so I'll do my best 
and ask some back...

>Would it be possible to add a ocean geometry and attach the ocean effect, 
>shader. if yes how should it be look like, just a >plane? more complex 
>geometry? My idea would be to add a lake surface, and two rivers with 
>different waves, and so on.

Do you mean you would like to add you own method of generating the water 
geometry for lakes and rivers? 

If so, I've tried to accommodate for additional type of geometry by providing 
the OceanTechnique base class. 

Basically osgOcean is comprised of two main parts.

OceanTechnique: Which generates and animates the ocean geometry and manages any 
level of detail algorithms that are required. It  uses osg::Geode as a base 
class and therefore drawables for the geometry. A class derived from this 
should provide a water shader. Animation is provided by adding a cull/update 
callback.

OceanScene: Which manages the various pre and post render passes required for 
the effects. This also includes controlling the different types of fogging and 
lighting that are applied based on whether the main camera view is above or 
below the water surface.

If you want to create your own water geometry class you'll have to inherit from 
OceanTechnique and then add this class to OceanScene as done with 
FFTOceanSurface in the example application. OceanScene will only work with one 
OceanTechnique so you'll have to create a new instance of OceanScene if you 
wish to use multiple OceanTechniques. The geometry can be as complicated or as 
simple as you like. If you apply the current water shader to a quad it still 
looks alright and maybe be suitable for some applications.  

These two papers provide very good explanations of generating water geometry 
(the first is used in FFTOceanSurface):

http://graphics.ucsd.edu/courses/rendering/2005/jdewall/tessendorf.pdf
http://citeseer.ist.psu.edu/cache/papers/cs/26265/http:zSzzSzwww.cs.sunysb.eduzSz~ash
zSzwaterCGF.pdf/

The tricky part is the shaders. osgOcean provides a very long list of uniforms 
which you can make use of if you wish in custom shaders. Some must be applied 
locally to the OceanTechnique (see: FFTOceanSurface::initStateSet() ), and 
those related to the multipass rendering are inherited from the statesets 
within OceanScene (see: void OceanScene::init()).

The shader implementation used in FFTOceanSurface can be found in the resources 
directory (water.frag/water.vert). 

If you want to use this shader for your own technique you'll have to apply it 
within your OceanTechnique and add the uniforms found in: 
FFTOceanSurface::initStateSet().

Your best bet is to look at the FFTOceanSurface class and see how it's 
implemented. It's not as complicated as it looks, 80% of it is to do with 
generating the vertex array and primitives for the geomipmapping routine which 
you may not need. 

>we don't need only an unfinite ocean

You can disable infinite ocean effect using: 
FFTOceanSurface::enableEndlessOcean(false,true);

>Next problem i got is that the default motion models are not working

Do you mean the ocean waves aren't moving?


I hope that answers your questions, otherwise I've just gone off on a very 
lengthy tangent :)


Kim.



From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Adrian Egli 
OpenSceneGraph (3D)
Sent: 19 June 2009 06:22
To: OpenSceneGraph Users
Subject: [osg-users] osgOcean : Integration into existing Database /Application

Hi all 

i am wondering how i can integrate the osgOcean effect into existing 
application, database. Would it be possible to add a ocean geometry and attach 
the ocean effect, shader. if yes how should it be look like, just a plane? more 
complex geometry? My idea would be to add a lake surface, and two rivers with 
different waves, and so on. finally we don't need only an unfinite ocean. Next 
problem i got is that the default motion models are not working, i played 
arround with osgviewer example, and osgOcean example. Well how should we use 
both ideas together in a terrain database (currently existing, but without the 
nice water effect) 

/regards adrian 

-- 
********************************************
Adrian Egli
*****************************************************************************************
To view the terms under which this email is distributed, please go to 
http://www.hull.ac.uk/legal/email_disclaimer.html
*****************************************************************************************
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to