Hydrax v0.4 - New version released + Editor!

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Locked
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Hydrax v0.4 - New version released + Editor!

Post by Xavyiy »

October 12, 2008 update: Hydrax 0.4 + Editor released.

What is Hydrax?

Hydrax is an add-on for the OGRE Graphics Engine that wants to provide a easy-use library in order to render pretty water scenes.
It's all configurable, all effect, such as water depth effects, smooth transitions, foam effects, caustics, underwater god rays, ... can be modified in real-time as well as all options that do not depend of shaders such as Rtt's texture quality, hydrax geometry and noise modules options, you can change between different modules(geometry and noise) on-fly, etc... Hydrax has a modulable interface wich allows any kind of water geometry, actually there're two modules availables: The infinite ocean module, based on the projected grid concept and a plane-defined module; of course, hydrax geometry modules and noise modules can be coded by users.

Main features:
  • Ralistic fresnel refraction and reflection effects.
  • Intelligent depth effects based on depth maps.
  • Smooth transitions effects: Smooth transitions with all objects in the scene using the depth map.
  • Caustics effects.
  • Sunlight effects.
  • Foam effects.
  • Full underwater effects, underwater reflections, god rays...
  • Vertex and GPU Normals generation
  • Decals support(To place any kind of texture on the water, like ship trails, water vegetables, etc)
  • Modulable interface. (Geometry and noise modules).
  • HLSL and CG support.(And GLSL in future versions)
  • Water editor
Screenshots & Videos:
Image

Image
Image
Image
Image
Image

Image Projected grid module video:
http://www.youtube.com/watch?v=Tll6Bi2XblU (First part)
http://www.youtube.com/watch?v=SvddAMjURKg (Second part)

Wiki link: http://www.ogre3d.org/wiki/index.php/Hydrax

Download: (*)Code::Blocks and VC++ 2005 project files included.
Last edited by Xavyiy on Tue Oct 14, 2008 11:37 pm, edited 30 times in total.
User avatar
steven
Gnoll
Posts: 657
Joined: Mon Feb 28, 2005 1:53 pm
Location: Australia - Canberra (ex - Switzerland - Geneva)
Contact:

Post by steven »

Impressive - very nice job

I have one question.
My graphics card is pretty old (ati x300) and not so powerful: Can this explain why I see squares in the sun reflection?

Image
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

steven wrote:Impressive - very nice job

I have one question.
My graphics card is pretty old (ati x300) and not so powerful: Can this explain why I see squares in the sun reflection?
I think that yes... I don't find any other possiblity, I haven't seen this issue before.
Thanks for opnion!
Last edited by Xavyiy on Sat Dec 29, 2007 1:20 am, edited 1 time in total.
User avatar
MiranT
Kobold
Posts: 28
Joined: Sat Mar 03, 2007 7:37 pm

Post by MiranT »

Looking good, to bad the game i'm making takes place in a desolate dried out wasteland.

Hmm... is it possible to create poluted or toxic looking water with Hydrax?
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

MiranT wrote:Looking good, to bad the game i'm making takes place in a desolate dried out wasteland.

Hmm... is it possible to create poluted or toxic looking water with Hydrax?
Of course! It's all configurable, only with change depth's colour and play a little with params I think that you can get a pretty toxic ambient, You can try modiffing the demo and if you like it thinking in the possibility of use Hydrax in your game.
User avatar
MiranT
Kobold
Posts: 28
Joined: Sat Mar 03, 2007 7:37 pm

Post by MiranT »

Great, i go and play with the demo abit then, i need to create some pretty disturbing spot for fishing mutated fish. Aswell as areas containing acid rivers and toxic goo.
User avatar
pekar
Halfling
Posts: 92
Joined: Sun Mar 04, 2007 2:56 pm
Location: Belgium

Post by pekar »

Nice work, this looks more like showcase material!

I have this strange silouette on the hills though, I don't know if you already know about it:

Image

running on a 8600 GTS / directx.

Have you thought about adding HDR to your demo?
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

pekar wrote:Nice work, this looks more like showcase material!
I had thought posting in showcase forum but as othre Ogre's addons(Particle universe, caelum, etc) are here I've decided to post in this forum.
pekar wrote:I have this strange silouette on the hills though, I don't know if you already know about it:
Yes.. there're some probles with refraction distortions in borders, I haven't studied it yet, but it seems a simple normal distort decal, no very difficult to solve.
I haven't much time for rewritte all shaders(20!) because I'm codding a little Hydrax editor, at the moment I only can shader this:
Image
But I hope that in not much time I will can share it!
pekar wrote:Have you thought about adding HDR to your demo?
I haven't added HDR to the demo because it just a little demo and too I think that people with poor 3D cards won't be bery "happy" if I add HDR compositor to the demo.

Thanks for your interest!
(Sorry for my English)

Edit I have thought about the strange silouette on the hills and it's only the ClipPlanesError... This issue could be minimized but never totally resloved. The hydrax param for change this value is: Hydrax::Hydrax::setPlanesError(Ogre::Real PlanesError), representes de y axis distance of clip planes from the water mesh.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Looks very good, something I want to tackle it myself in near future.

One question: why are you using Mesh to create water because I think you can save the performance by only rendering on a plane - water mesh is only appropriate if you want a deformable water eg you run through it and you want water to react to it.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

syedhs wrote:Looks very good, something I want to tackle it myself in near future.

One question: why are you using Mesh to create water because I think you can save the performance by only rendering on a plane - water mesh is only appropriate if you want a deformable water eg you run through it and you want water to react to it.
The goal is that doing nice water, and it's necesary little waves...(you can emulate it with parallax mapping, but it only works well with big camera-angles) if you're interested you can download Aquatica engine [ http://www.magicindie.com/aquatica.htm ] and render the same water with a grid mesh and without it, the difference is huge, in Hydrax it's the same... Plane is good for scenes where water isn't very important, but for nice water... it's necesary(It's possible doing it with vertex displacement but requires SM3)

Sorry for my English
User avatar
pekar
Halfling
Posts: 92
Joined: Sun Mar 04, 2007 2:56 pm
Location: Belgium

Post by pekar »

You can try to substitute the plane with a sort of "onion mesh", concentric circles that are denser at the middle . The middle gets translated to stay exactly under the camere. Check http://www.google.be/url?sa=t&ct=res&cd ... 2XIFJ6hCUQ, part 18.3.

I've seen another paper that optimizes that by only using the slice that the camera can see, but I've can't seem to find it :?
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

pekar wrote:You can try to substitute the plane with a sort of "onion mesh", concentric circles that are denser at the middle . The middle gets translated to stay exactly under the camere. Check http://www.google.be/url?sa=t&ct=res&cd ... 2XIFJ6hCUQ, part 18.3.
I've seen another paper that optimizes that by only using the slice that the camera can see, but I've can't seem to find it :?
Concerned with this, I've looked into some other approaches and I've found these 2 possibilities:
Geomipmap geometry:
Image
Radial grid:
Image

For 0.2 version, I'm going to solve some bugs and release it with a little editor, and add the option of load water from config file. For 0.3 released I want to change water mesh geometry and look into other ways of generate noise textures(I think that it's the first priority).
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Xavyiy,

The replacement for 'wash mesh geometry' sounds cool. I am using water mesh myself (use it for water deformation which yes, a bit slow but fits my requirement) and the performance is quite tied to CPU power as the complexity increases - so I do think you will get a better performance with other technique. :)

Good luck, and the code looks nicely written!
Yacoby
Halfling
Posts: 85
Joined: Sun Sep 23, 2007 7:58 pm

Post by Yacoby »

I have had a quick look over the code, but can't see any method of rotating the water mesh.
Is it possible that in the next version it could be rotated, or at least have an option that z is up?
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

Yacoby wrote:I have had a quick look over the code, but can't see any method of rotating the water mesh.
Is it possible that in the next version it could be rotated, or at least have an option that z is up?
At the moment mesh only can be translate, Sorry, in the next release I'm going to implement rotate, etc.

If you want, you can add this code to Hydrax.h:

Code: Select all

inline void rotate(Ogre::Quaternion& q)
{
     mSceneNode->rotate(q);
     mPlanesSceneNode->rotate(q);
}
Recompile it and put this hydrax.h in Demo1/src/hydrax/hydrax.h

Sorry for my English.
dudeabot
Gnome
Posts: 334
Joined: Thu Jun 28, 2007 2:12 pm
Location: Brazil
x 5
Contact:

Post by dudeabot »

very nice!

but i get low fps here ~20

but probably its bc my computer sucks :(

spec: pentium IV 2.4 GHZ geforce FX 5900
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8
Contact:

Post by eugen »

steven wrote:Impressive - very nice job

I have one question.
My graphics card is pretty old (ati x300) and not so powerful: Can this explain why I see squares in the sun reflection?

Image
Im seeing the same sqares into the sun reflection but i have a gforce 7900
otherwise very nice implementation
Yacoby
Halfling
Posts: 85
Joined: Sun Sep 23, 2007 7:58 pm

Post by Yacoby »

Xavyiy wrote: At the moment mesh only can be translate, Sorry, in the next release I'm going to implement rotate, etc.

If you want, you can add this code to Hydrax.h:

Code: Select all

inline void rotate(Ogre::Quaternion& q)
{
     mSceneNode->rotate(q);
     mPlanesSceneNode->rotate(q);
}
Recompile it and put this hydrax.h in Demo1/src/hydrax/hydrax.h
Thanks :)


The VS config file for Hydrax has the debug settings using OgreMain.lib, and OIS.lib, rather than their debug counterparts, so if anyone else compiles it from source, they would need to change it.

I also get the squares in my sun reflection. I have a nvidia 6150LE ( :cry: )
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

Yacoby wrote:The VS config file for Hydrax has the debug settings using OgreMain.lib, and OIS.lib, rather than their debug counterparts, so if anyone else compiles it from source, they would need to change it.
Yes.. I haven't tried to compile it in VS and debug mode, you can delete OIS.lib, it isn't used...! only with OgreMain_d will be sufficient.

About squares issue.. I haven't any ideas, but I'm sure that it's a pixel shader problem, not C++ or Ogre.(Drivers?) I've tested it in some cards and works pretty well(Only in old cards it's slow..).
After release the 0.2 version I'm going to try to loking into this issue.

At this moment, there're the current changes for 0.2 version:

Code: Select all

- Ogre3D 1.5 "Shoggoth" compatibility [15% DONE]
- Add getCausticsScale() [DONE]
- setPerlinOptions after Hydrax->create() sometimes causes program crash
- Mesh restoring after lost device [DONE]
- Restore all options after change components(shaders) like sun pos,etc [DONE]
- Bugs in setPerlinOptions():         [DONE]
    Texture in shaders aren't updated [DONE]
- Set complexity maximun to 724 [DONE]
- Set water strength after setMeshOptions [DONE]
- Update SMOOTH and CAUSTICS remover metod with the Editor's approach [DONE]
Sorry for my English.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

Some news about hydrax editor:

Image
I hope you like it!

About Hydrax plugin, I'm writting a long roadmap for hydrax(support for opengl, documentation, modulable noise generation interface for add easily noise gen modules, add FFT noise generation, choppy waves, etc...). It won't be easy, but I think that in the future It can became a good and realistic water plugin!

Sorry for my English.
Yacoby
Halfling
Posts: 85
Joined: Sun Sep 23, 2007 7:58 pm

Post by Yacoby »

Xavyiy wrote: Yes.. I haven't tried to compile it in VS and debug mode, you can delete OIS.lib, it isn't used...! only with OgreMain_d will be sufficient.
Ok, thanks :)

The problems I have are that I get a gap in meshes:
Image

I was also wondering how depth was calculated, as I don't seem to be able to get a depth effect:
Image

I am using a cusom scene manager, and moving the water mesh underneath the camera. The scene manager doesn't have much implemented.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Post by Klaim »

Side note : Yacoby, your screenshots models looks like Morrowind...
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

Yacoby wrote:
Xavyiy wrote: Yes.. I haven't tried to compile it in VS and debug mode, you can delete OIS.lib, it isn't used...! only with OgreMain_d will be sufficient.
Ok, thanks :)

The problems I have are that I get a gap in meshes:

I was also wondering how depth was calculated, as I don't seem to be able to get a depth effect:

I am using a cusom scene manager, and moving the water mesh underneath the camera. The scene manager doesn't have much implemented.
About the gap, you've to play with setPlanesError(Ogre::Real PlanesError); this value, is the y axis difference beetwen water mesh and Refraction/Reflection/Depth clipplanes.

About depth, it's calculated as a refraction map but changing all entity's material by our depth shader, as well as caustics. There're three possibilities about your depth issue:

1- DEPTH component it isn't active.
2- You haven't set a coerent Depth limit(play with setDepthLimit(Ogre::Real DepthLimit). Try with valors in [0, 300] range.
3- Your own scene manager don't allow getMovableObjectIterator("Entity"); (I don't think that... because in PLSM2 scene manager all works pretty well).

Personally, I think that the problems is related with the second option..., and don't forgot call setPosition() !

Sorry for my little English!
User avatar
IFASS
Gnome
Posts: 387
Joined: Tue Jan 04, 2005 12:07 pm
Location: Netherlands

Post by IFASS »

The editor looks good Xavyiy :)
Will it be released with 0.2?
Image
Yacoby
Halfling
Posts: 85
Joined: Sun Sep 23, 2007 7:58 pm

Post by Yacoby »

Klaim wrote:Side note : Yacoby, your screenshots models looks like Morrowind...
I want to lean how to program, not create resources, so I just used Morrowinds ;)
About the gap, you've to play with setPlanesError(Ogre::Real PlanesError); this value, is the y axis difference beetwen water mesh and Refraction/Reflection/Depth clipplanes.
I found why this didn't work. It moves one the y axis, and I need it moved on the z axis. No problem, as I can just modify it :)

I found the problem with the depth not working:
I use static geometry for everything, and forgot about it. This isn't a problem, as I just don't add anything that is below 0 to the static geometry

My Terrain is not an entity, which is why that didn't work. I am not sure why PLSM2 works and mine doesn't, but I am sure I can write a hacky fix, or just ask tuan kuranes :wink:


Thanks for all your help
Locked