OgreWater

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

OgreWater

Post by lingfors »

Pulled an all-nighter, and here is the result:



It's for a course in Computer Graphics at uni, so I'm going to hold on to the source until after the presentation. After that I will hopefully release it.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreWater

Post by jacmoe »

Awesome! :)
Looking forward to seeing more of it.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: OgreWater

Post by so0os »

Awesome! I hope it's lightweightier than Hydrax, and if so, I'm looking forward to hijacking your source :P

Best of luck!
Sos Sosowski :)
http://www.sos.gd
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: OgreWater

Post by Beauty »

Is this your own water simulation or did you use an add-on like Hydrax, Editable Terrain Manager, etc.?
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

Beauty wrote:Is this your own water simulation or did you use an add-on like Hydrax, Editable Terrain Manager, etc.?
I wouldn't post it here if it was just a compilation of other people's work. So to answer your question, yes, I've written all the water code. The terrain is the standard Ogre 1.7 terrain.
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: OgreWater

Post by Beauty »

The video is nice, but more we don't know.
Unfortunately you didn't tell any detail of your application.
So there was the possible case that your application has an unknown aim and the water is just for scene beautification.
I don't know anything, so I just asked.
I'm always interested to read more about Ogre applications. :wink:
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: OgreWater

Post by spacegaier »

lingfors wrote:
Beauty wrote:Is this your own water simulation or did you use an add-on like Hydrax, Editable Terrain Manager, etc.?
I wouldn't post it here if it was just a compilation of other people's work. So to answer your question, yes, I've written all the water code. The terrain is the standard Ogre 1.7 terrain.
That sounds interesting. Looking forward to hear more, once you held your presentation :) .
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

Beauty wrote:The video is nice, but more we don't know.
Unfortunately you didn't tell any detail of your application.
So there was the possible case that your application has an unknown aim and the water is just for scene beautification.
I don't know anything, so I just asked.
I'm always interested to read more about Ogre applications. :wink:
I understand, but I find it hard to figure out what to write... Ask, and I will answer. :)

I can say as much as currently it's just above surface reflection/refraction with Fresnel and some specular on top... But I plan to implement caustics and below surface rendering as well. Oh, and hopefully to make it a package that is fairly easy to integrate into existing projects... Right now, it's fairly poorly organized, everything is in my standard "Application" class, but it shouldn't be that hard to restructure.
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: OgreWater

Post by Zonder »

Looks great took a few days to see it youtube blocked at work:(

What type of water are you going to simulate? for instance hydrax is aimed at large open bodies of water. Will you be filling the gap a bit with doing lakes and ponds?

Keep up the good work :)
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
rafa.gdev
Halfling
Posts: 56
Joined: Mon Apr 14, 2008 10:10 pm
Location: Belo Horizonte, Brazil

Re: OgreWater

Post by rafa.gdev »

That's really cool, looking forward for a release! =D
User avatar
Slappy
Bronze Sponsor
Bronze Sponsor
Posts: 139
Joined: Fri Sep 28, 2007 8:30 pm
Location: Slovakia

Re: OgreWater

Post by Slappy »

This look really promising, but I hope it will be more easy to use.....
GL with it!
Cool looking Graphical Installers in NSIS and Inno Setup: http://www.graphical-installer.com - FREE for Ogre projects
I offer NSIS/Inno Setup scripting, C/C++/C#/Delphi programming: http://www.unsigned.sk
Develop NSIS/Inno Setup projects directly in Visual Studio 2005-2015: http://www.visual-installer.com/
or RAD Studio 2009-XE8: http://www.rad-installer.com/
User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8
Contact:

Re: OgreWater

Post by Pyritie »

looks damn pretty

how intensive is it?
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

Wow, just noticed this project made the front news. That's as good as any motivation to keep me working on this. :)
Pyritie wrote:looks damn pretty

how intensive is it?
FPS is around 300-350 on my computer (Core 2 Quad, 4GB memory, GTX 460).
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: OgreWater

Post by cyrfer »

It looks very nice.

Is the wave simulation done on CPU, GPU, or both?

How do you get reflection with the full scene? I assume you bake to some kind of texture. Will you explain this?
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

cyrfer wrote:It looks very nice.

Is the wave simulation done on CPU, GPU, or both?

How do you get reflection with the full scene? I assume you bake to some kind of texture. Will you explain this?
Sure, I'll explain it. It's pretty simple.

At the moment, the water is just a simple plane. No real geometry yet, in other words, although I plan to try to implement that too.

For each frame, I render 4 textures: A refraction texture (everything underneath the water plane), a refraction depth texture (distance from camera for everything underneath the water plane), a reflection texture (everything above the water plane rendered from a camera that is placed at the "reflected" camera position) and a reflection depth texture.

Then it's simply a matter of doing texture lookups using the screen coordinates as texture coordinates. Combine this with some normal map magic, and you get specular highlights and "distorted" reflections/refractions.

Well, that's what I have so far. On the Todo-list is real geometry, "proper" refraction i.e. terrain (and other geometry) underneath the water looks more shallow than it really is, caustics and underwater rendering.
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

Bleh.

Tried to implement nice below surface rendering... Rendering the surface wasn't too hard, just some quick modifications to the shaders and some c++ code to check if the camera is above or below the water surface and then modify some stuff based on that.

Rendering everything that is below the surface (such as terrain) when the camera is below the surface, however... What a mess. Basically, what I tried was writing a custom material that just adds some fog in the correct color, then add this material as a new pass (so that it works with little or no modification to existing materials and shaders) to every object that is being rendered if we are below the surface. After ironing out some bugs (such as make sure that we only add this pass once, or making sure this pass is only used when we render to the screen), it worked pretty good.

Except for one thing - geometry far away from the camera had some serious z-fighting issues. And some geometry (I'm looking at you, new Ogre terrain) didn't seem to render this new pass at all in some cases.

I tried fiddling with the depth_bias variable, but to no avail.

It looks like I'm going to have to use some kind of post-processing effect if I want to be able to render nice below surface scenes. Which I really don't want to do... I already have 4 render passes before the scene is rendered to the screen. If I do this as a post-processing effect, I will probably need 2 new render passes. It feels like overkill, tbh... Although doing it as a post-processing effect will probably enable some other nice effects as well, like DOF and god rays.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: OgreWater

Post by so0os »

I suppose you need to set up Render Queue Groups so that water renders last.
Sos Sosowski :)
http://www.sos.gd
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

so0os wrote:I suppose you need to set up Render Queue Groups so that water renders last.
Uhm... What?
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: OgreWater

Post by so0os »

Code: Select all

mTerrainEntity->setRenderQueueGroup(RNEDER_QUEUE_5);
mWaterEntity->setRenderQueueGroup(RNEDER_QUEUE_9);
This way water will be rendered after terrain, and will not 'accidentally' cover it, not displaying stuff beneath.
Sos Sosowski :)
http://www.sos.gd
SamJ
Halfling
Posts: 40
Joined: Tue Jan 25, 2011 9:12 pm

Re: OgreWater

Post by SamJ »

Sorry to pester, but any update on the plans to release the source code of this? It looks amazing btw.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreWater

Post by jacmoe »

Read the first post, Sam. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

I plan to release it, yes. But not yet.

I'm working on below surface rendering now. Expect a video some time next week...
litterbug23
Gnoblar
Posts: 24
Joined: Mon Sep 21, 2009 9:27 am

Re: OgreWater

Post by litterbug23 »

very nice,good work!
wait for release detial method
litterbug23
Gnoblar
Posts: 24
Joined: Mon Sep 21, 2009 9:27 am

Re: OgreWater

Post by litterbug23 »

wait source code,or doc
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: OgreWater

Post by lingfors »

New video:



(You might have to wait a little bit, YouTube is processing it...

As you can see, I know have real, animated geometry done. The lighting is a little wonky though... Also, reflection/refraction amount as well as the water clarity and color is fully configurable during run-time. At last, below-surface rendering.

Also, as you can see there are quite a number of artifacts in the water when rendered from above the surface. These are caused by the skirts of the terrain. (For those of you that don't know, these skirts are used to cover up the cracks in the terrain, and are usually not noticeable when the terrain is watched from above.) Since the reflection is rendered from a camera below the surface and the custom near clipping plane must be quite a bit offset from the base water level due to the water geometry, these skirts are now quite noticeable. They could be seen before also, but to a much smaller extent since the custom near clipping plane was only offset by a unit or two.

I believe the problem could be fixed by using a "near Z-buffer", i.e. by rendering only the water mesh to a depth texture, and then use this texture to discard pixels that are too close. However, this would have to be done in a shader, and for every material that is rendered. Since I want this water to be as easy to plug into existing projects, this is something I really want to avoid. I wish it was possible to the rendering in two passes, the first pass simply does the "near-Z-buffer" check, and the second pass only renders if the first pass passed... But afaik, this is not possible... But if I'm wrong, I would be very grateful if someone could correct me!

Otherwise, I guess I have to leave in an option to let the user choose if they want real geometry, or a flat mesh with distorted normals only...
Post Reply