Water Rendering

Everything about development and the OpenMW source code.
Post Reply
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Water Rendering

Post by Zini »

Here is the task on the tracker.

I set the target version to 0.12.0, because it seems it will take a while before the configuration system is ready and also because jhooks is working rather fast.

We already had an attempt to implement this feature (still on github IIRC). It suffered from poor performance and the water surface was too small for our rendering range (you can see the borders).


There is an Ogre-addon that provides water rendering. I think it is unsuitable for our purpose for two reasons:

1. Extremely resources demanding. We shouldn't target high-end boxes only. The rendering quality of MW is enough for OpenMW 1.0. We can still add a high quality mode later.

2. It only allows one global, unlimited water surface. That is good enough for OpenMW 1.0, since MW has the same limitation. But we might want to expand it past 1.0, which would be mean a complete re-write, if we were using this add-on.


Please branch of from the mwrender branch for the water feature. I think how to integrate it into the mwrender subsystem should be clear by now (if it isn't please ask).

Edit:

In Exteriors the Water is always present at height 0. In Interiors it can be switched on/off and has a variable height. MWWorld::World needs new functions for toggling and configuring water in Interiors.

The task actually consists of two sub-tasks:

- render the water surface when above

- render an underwater view when below (best done with a compositor).
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Water Rendering

Post by jhooks1 »

Made a commit with Azathoth's code in the water branch, but haven't tried to actually use MWRender/Water yet. Had to bring in some changes from the animation2 branch (scene) to get it to compile.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Water Rendering

Post by Zini »

Actually you should merge in the mwrender branch instead. Let's keep animation and water rendering separated for now.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Water Rendering

Post by jhooks1 »

I did branch off from my mwrender, it just wasn't completely up to date and wouldn't compile. There were errors in scene.cpp, so rather than fixing them again, I just dropped in the proper scene.cpp from animation2.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Water Rendering

Post by jhooks1 »

Getting a crash inside the water constructor, I think it must have to do with finding water resource files. I am initializing the water after the scene is created inside the RenderingManager constructor. I have the files in resources/water inside the executable directory.

This is the line (from Azathoth's code) that is causing the crash
mWater->setMaterialName("Water/ReflectionRefraction");

Could the crash be because I arranged the files in files\water instead of extern/resources/water?

EDIT: I can delete the material file and openmw will run, with the water as a white plane.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Water Rendering

Post by Zini »

I did branch off from my mwrender, it just wasn't completely up to date and wouldn't compile.
I find that strange. Do you still have the error message.
Could the crash be because I arranged the files in files\water instead of extern/resources/water?
Simply adding the files is not enough. You also need to configure them in the cmake scripts (there are plenty of examples).
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Water Rendering

Post by jhooks1 »

I did add them into the cmake scripts, can you check my commit to see if the cmake scripts are right?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Water Rendering

Post by Zini »

I do not see any new commits from you right now. But it looks like github is lagging a bit currently. Will check again tomorrow.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Water Rendering

Post by jhooks1 »

I got water to work, but it is very performance intensive, I am only getting 60fps in Beshara (normally get 120) :|. Still cannot get the underwater view to work.

I may start looking into project Aedra soon to see what method it uses for water. I have messed with createPlane parameters and I can't seem to get a significant performance increase.

Kind of off topic, but is Ogre holding us back? It seems like with every new rendering feature we introduce more slowdown. With the current engine handling actor animations, physics, terrain, and water at the same time will be extremely slow and unplayable.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Water Rendering

Post by Zini »

Without OGRE the project would probably take two additional years. And OGRE is not slow. There may be a few cases where MW is handling things in such an exotic way that we get into trouble, but in general any slowdown we are experiencing is our own fault.

Rereading your previous posting: You mean the cmake changes in the original commit ("Bringing in some of Azathoth's work") instead of a new commit?

The line
add_subdirectory( files/)
is bogus. You need to configure resources files. As I wrote, there are plenty examples for the existing files in the cmake scripts.
Post Reply