Ocean in ogre, anyone ?

Someone request the Ogre Ocean demo program that can run standalone instead of running in demomaster:

Did anyone have a port that can be shared ?

someone = me

i’m interested in using the ocean shader (found in demomaster/share/shaders/ocean2.sha), but it has many inputs and i’m a bit overcharged with separating it from the demomaster framework.

Hi Nemesis#13

Sorry that I am busy on something else and not able to make a standalone version for you. Here are some hints for you to make one:

You shall run the demo called “Nature - Ocean 2 cubemap only”. ocean2simpledemo.py is the source code for this demo. It looks complicated but actually it is quite straight forward.

The waternode object is created in share/ocean2.py => WaterNode class. The flag self.useCubemapOnly is set to true, so you can ignore all the code that assume self.useCubemapOnly to be false.

The WaterNode object will create a grid so that the vertexes of the grid will be transformed in the shader. The code is:
self.waterNP = geomutil.createPlane(‘water’, width, height, segmentX, segmentY)
If you run demomaster, you can click on “Basics=>Set Wired Mode”, you will see the wired water plane.

The shader is in the file share/shaders/ocean2_cubemap.sha
It is based partly on “Effective Water Simulation From Physical Models”, GPU Gems, ported from ogre.

In the vshader, it takes the water plane, transform the vertex of the water plane by using two sine waves.

In the fshader, it takes the skybox, distortion texture, eye position, a lot of other parameter and the input from vshader to calculate the result color.

Let me know if you need more explanations.

Whew! I’ve been out of the Panda3D community for some time, but I decided to check out 1.7.0. So to those who remember me, hi! To those who don’t, hi!

Anyway, I decided to try out Cg shaders, so for practice I chose to port this very ocean from OGRE3D, and stumbled upon this thread while I was researching OGRE3D’s ocean, which actually comes from nVidia’s GPU Gems.

I’ll post two screenshots for comparison, but I’m not going to post any actual work until I review the licensing on the OGRE3D assets.

Now, I’m sure the OGRE3D version looks a lot nicer due to more finely-tuned wave values, antialiasing, a higher resolution, and a skybox.

I tried some simple skyboxing but TexGenAttrib.MWorldCubeMap doesn’t map the UVW’s in the same way as texCUBE. This is either an inconsistency in Panda3D, or MWorldCubeMap is designed for cubemap reflections, so the skybox turns out wrong.

I am following this, and waiting for news… Simple, concise, efficient, with sources :slight_smile: