syedhs wrote:
1) Reflection is not following the water wave ie terrain is reflected on the water as if the water is super-cool or not moving at all..
Because there are no waves, it's all just one big plane.
I have a projected grid test working, that has real geometry. However, it's just flatshaded still and need some work before it can be released. But sadly, my time is quite limited at the moment.
syedhs wrote:
2) Quite minor I must say.. if anti aliasing factor is set to 8 for an example, reflection image is not AA-ed.
Render textures can't be anti-aliased, afaik (unless you do it yourself in a shader?)
syedhs wrote:
2) Quite minor I must say.. if anti aliasing factor is set to 8 for an example, reflection image is not AA-ed.
Render textures can't be anti-aliased, afaik (unless you do it yourself in a shader?)
It *can* be done, but it isn't a pretty pipeline to work with. Essentially you'd need to render to back buffer then copy that to your texture. All Anti-Aliasing will be applied to the texture, though I haven't found a good way to organize this outside of a small tech demo.
During the code inspection, a couple of minor points were noticed: -
Function inlining was critical to performance.
For MSVC, at least, a "delete 0" caused execution of 11 assembly instructions, including a function call. So in cases where performance is at an absolute premium it can be worth inserting the extra manual test.
That is beautiful work. If only the ground looked wet after the water passed over it, it'd be hard to tell it was cg.
OpenMW is an ambitious project and with your help we can help make it a reality. To join us head over to http://openmw.org/forum/ and register, announce yourself to the team and grab a coding assignment.
OpenMW wrote:That is beautiful work. If only the ground looked wet after the water passed over it, it'd be hard to tell it was cg.
Yes, I thought the same in regards to the rock on the right side that from time to time is above the water line. Some sort of water residue / wet look and perhaps (not sure if that would happen in reality) but some wrinkles or such on the last inches where water touches the rock, because I imagine that the water gets a bit "compressed" there due to the near rock, resulting in some sort of small waves. Hard to articulate with words right now .
But overall: Looking great!
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...
Look very nice.. how is the FPS? I imagined using CUDA would not cause much burden on CPU..
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
As far as I know CUDA is only supported on newer NVidia cards.
What happens when a user has an AMD card or an older nVidia card without CUDA support?
lingfors wrote:I assume you've found how to change reflection/refraction etc? Otherwise:
Your visualisation looks great and would be fine for my underwater simulation application.
Do you still have the configuration settings on your PC?
It would be nice if your demo offers the possebility to adjust reflection, refraction and other options.
(Perhaps you still added this options. I don't remember, because my demo test is many months ago.)
Also an other possebility would be fine:
Store all options in a config file, which can be loaded. (e.g. the Caelum add-on offers this option)
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.
Beauty wrote:
As far as I know CUDA is only supported on newer NVidia cards.
What happens when a user has an AMD card or an older nVidia card without CUDA support?
I guess there would have to be some kind of fallback. Perhaps the algorithm could also be implemented in OpenCL or DirectX compute shaders, if there are FFT implementations for them.
Otherwise the same algorithm is also implemented on the CPU (through fftw), but the quality would obviously have to be much lower.
The projected grid could probably be ported to hlsl/glsl instead of Cuda.
Beauty wrote:
Your visualisation looks great and would be fine for my underwater simulation application.
Do you still have the configuration settings on your PC?
No, but it's fairly easy to find a setting that looks good.
Beauty wrote:
It would be nice if your demo offers the possebility to adjust reflection, refraction and other options.
(Perhaps you still added this options. I don't remember, because my demo test is many months ago.)
Yes, this will be in the demo, and the library supports changing these settings in real time also.
Beauty wrote:
Also an other possebility would be fine:
Store all options in a config file, which can be loaded. (e.g. the Caelum add-on offers this option)
Good suggestion, I will look into exporting/importing settings from disk.
After being disappointed in how bad "faked" reflection looks when not using a planar water surface, I went ahead and implemented screenspace raytracing:
It was inspired by this video showcasing the new CryEngine, but the implementation is my own.
The implementation is quite simple:
The scene is first rendered without the water to two textures - one containing the actual colors, the other containing the depth info (in a FLOAT_R32 texture).
The scene is then rendered again to the screen, this time with the water.
The water is rendered with a shader, where the magic happens:
In the fragment shader, the geometry position together with the water normal at that position is used to calculate a reflected ray, i.e. the reflection direction.
Steps are then taken along this reflection direction.
For each step, the new position is projected back onto the screen.
This new screen position is used to look up the scene depth at that location.
If the distance between the camera and the position along the reflected ray is greater than the value in the depth buffer, the ray has hit terrain. We then use the screen position to look up the color from the color texture.
Of course, there are some issues, as can be seen in the video, as well as a significant cost (my framerates dropped from 50 FPS to 30 FPS). Mind you, the shader is not optimized yet, but it's unlikely it will be possible to get it back to 50 FPS by shader optimization alone, at least not without losing too much quality in the reflections...
Looking really good! The only two things I can think of right now that are still missing to make it even better:
Some sort of turbulence around the water borders (where it hits the rocks) and possibly some residue after the water has moved back after each wave giving them impression of the rock being wet (perhaps some specular elements on the rocks that fade out afterwards?).
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...
lingfors wrote:It was inspired by this video showcasing the new CryEngine, but the implementation is my own.
It's a 30 minute video. So I avoid watching until today. Now I watched it and it's very impressive. Especially how easy it is to create and modify a scene.
Thanks for pointing to this video.
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.
Your newest video is very impressive. Congratulations!
A question about your screenspace raycasting technique: It uses the screen colors for reflection, so it's not possible to reflect objects that are not on the screen?
scrawl wrote:A question about your screenspace raycasting technique: It uses the screen colors for reflection, so it's not possible to reflect objects that are not on the screen?
lingfors wrote:After being disappointed in how bad "faked" reflection looks when not using a planar water surface, I went ahead and implemented screenspace raytracing:
That looks phenomenal! I have always thought of doing something similar to this but have never really known where to start! Keep up the good work, looking forward to checking out you code
OgreWater::Water* w = new OgreWater::Water(SIM->getRenderWindow(), mSceneManager
, SIM->getCameraControlSytem()->getOgreCamera());
w->setWaterDustEnabled(true);
//w->setAirBubblesEnabled(true);
w->init();
w->setWaterHeight(0.0);
I have disabled all of the components that could interfere with OgreWater (SkyX, PagedGeometries…) but the problem still persists. There is no errors in the log.
Does anyone know what the problem could be?
Sorry for not answering earlier, been really busy...
Without seeing all your code, it's very hard to say exactly what is going wrong... But part of the problem seems to be that the OgreWater camera(s) aren't updated correctly, i.e. copying the position/orientation of the camera you send in.
I just had a look at the code, and it seems that I'm using getPosition/getOrientation instead of getDerivedPosition/getDerivedOrientation... When you control your camera, do you set the camera's position/orientation, or do you set the position/orientation of a node (or a node hierarchy) to which you have attached the camera?
lingfors wrote:Sorry for not answering earlier, been really busy...
Thanks Lingfors. Don’t worry. I neither haven’t had time to work on this.
lingfors wrote:I just had a look at the code, and it seems that I'm using getPosition/getOrientation instead of getDerivedPosition/getDerivedOrientation... When you control your camera, do you set the camera's position/orientation, or do you set the position/orientation of a node (or a node hierarchy) to which you have attached the camera?
I’m using CCS to deal with cameras (a subproject I released some time ago). The camera is always attached to a node although the actual node hierarchy depends on the selected camera mode. I’ve tried some of them but the problem is still there. The position/orientation of the camera is set by adjusting the position/orientation of a node.
I’m going to disable CCS to confirm the problem is realated to it. I’ll maintain you informed .