OgreWater
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
OgreWater
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.
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.
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
Re: OgreWater
Awesome!
Looking forward to seeing more of it.
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.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Bugbear
- Posts: 833
- Joined: Thu Apr 15, 2010 7:42 am
- Location: Poznan, Poland
- x 33
Re: OgreWater
Awesome! I hope it's lightweightier than Hydrax, and if so, I'm looking forward to hijacking your source
Best of luck!
Best of luck!
Sos Sosowski
http://www.sos.gd
http://www.sos.gd
-
- OGRE Community Helper
- Posts: 767
- Joined: Wed Oct 10, 2007 2:36 pm
- Location: Germany
- x 39
Re: OgreWater
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 ...
Add your country to your profile ... it's interesting to know from where of the world you are.
Add your country to your profile ... it's interesting to know from where of the world you are.
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
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.Beauty wrote:Is this your own water simulation or did you use an add-on like Hydrax, Editable Terrain Manager, etc.?
-
- OGRE Community Helper
- Posts: 767
- Joined: Wed Oct 10, 2007 2:36 pm
- Location: Germany
- x 39
Re: OgreWater
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.
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.
Help to add information to the wiki. Also tiny edits will let it grow ...
Add your country to your profile ... it's interesting to know from where of the world you are.
Add your country to your profile ... it's interesting to know from where of the world you are.
-
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 136
Re: OgreWater
That sounds interesting. Looking forward to hear more, once you held your presentation .lingfors wrote: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.Beauty wrote:Is this your own water simulation or did you use an add-on like Hydrax, Editable Terrain Manager, etc.?
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...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
I understand, but I find it hard to figure out what to write... Ask, and I will answer.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.
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.
-
- Ogre Magi
- Posts: 1172
- Joined: Mon Aug 04, 2008 7:51 pm
- Location: Manchester - England
- x 76
Re: OgreWater
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
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...
-
- Halfling
- Posts: 56
- Joined: Mon Apr 14, 2008 10:10 pm
- Location: Belo Horizonte, Brazil
Re: OgreWater
That's really cool, looking forward for a release! =D
-
- Bronze Sponsor
- Posts: 139
- Joined: Fri Sep 28, 2007 8:30 pm
- Location: Slovakia
Re: OgreWater
This look really promising, but I hope it will be more easy to use.....
GL with it!
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/
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/
-
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
Re: OgreWater
looks damn pretty
how intensive is it?
how intensive is it?
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
Wow, just noticed this project made the front news. That's as good as any motivation to keep me working on this.
FPS is around 300-350 on my computer (Core 2 Quad, 4GB memory, GTX 460).Pyritie wrote:looks damn pretty
how intensive is it?
-
- Orc
- Posts: 424
- Joined: Wed Aug 01, 2007 8:13 pm
- Location: Venice, CA, USA
- x 7
Re: OgreWater
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?
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?
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
Sure, I'll explain it. It's pretty simple.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?
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.
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
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.
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.
-
- Bugbear
- Posts: 833
- Joined: Thu Apr 15, 2010 7:42 am
- Location: Poznan, Poland
- x 33
Re: OgreWater
I suppose you need to set up Render Queue Groups so that water renders last.
Sos Sosowski
http://www.sos.gd
http://www.sos.gd
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
Uhm... What?so0os wrote:I suppose you need to set up Render Queue Groups so that water renders last.
-
- Bugbear
- Posts: 833
- Joined: Thu Apr 15, 2010 7:42 am
- Location: Poznan, Poland
- x 33
Re: OgreWater
Code: Select all
mTerrainEntity->setRenderQueueGroup(RNEDER_QUEUE_5);
mWaterEntity->setRenderQueueGroup(RNEDER_QUEUE_9);
Sos Sosowski
http://www.sos.gd
http://www.sos.gd
-
- Halfling
- Posts: 40
- Joined: Tue Jan 25, 2011 9:12 pm
Re: OgreWater
Sorry to pester, but any update on the plans to release the source code of this? It looks amazing btw.
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
Re: OgreWater
Read the first post, Sam.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
I plan to release it, yes. But not yet.
I'm working on below surface rendering now. Expect a video some time next week...
I'm working on below surface rendering now. Expect a video some time next week...
-
- Gnoblar
- Posts: 24
- Joined: Mon Sep 21, 2009 9:27 am
Re: OgreWater
very nice,good work!
wait for release detial method
wait for release detial method
-
- Gnoblar
- Posts: 24
- Joined: Mon Sep 21, 2009 9:27 am
Re: OgreWater
wait source code,or doc
-
- Hobgoblin
- Posts: 525
- Joined: Mon Apr 02, 2007 12:18 am
- Location: Sweden
- x 79
Re: OgreWater
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...
(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...