About Store Forum Documentation Contact



Post Reply 
water reflection
Author Message
yvanvds Offline
Member

Post: #1
water reflection
Hey.

I tried to have a reflective water surface on a lake. I can see reflections on ocean water and shadows are reflected on all water. But on lakes and rivers, i cannot get any reflection of the environment. I though it would be enough to call WaterParams reflect. I tried several paramaters and reflect_fake does seem to make a difference (So I'm sure I'm changing the correct water definition), but reflect does not. Reflect is for real reflections, right? This is my code:

PHP Code:
    Water.load("Water/myriver.water");
    
Water.draw true;
    
Water.reflection_shadows true;
    
Water.reflectionRenderer(RT_DEFERRED);
    
    
WaterParams myWater WaterParamsCache.get("water/plainlake.water");
    if (
myWater != NULL) {
        
myWater->reflect 1.0;
        
myWater->reflect_fake 0.0;
        
myWater->validate();
    } 
12-21-2011 04:49 PM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #2
RE: water reflection
Thanks! At least now I know it *should* work.

I've tried compiling a tutorial example and it they're OK. And I've also found that SOME of the rivers in my world do have a reflection from trees and such. But the ones i was looking for still don't show it. I'm trying to change all kinds of settings not. No result for now, but I'll get there :-)
12-22-2011 09:01 PM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #3
RE: water reflection
Ok, at least I can reproduce it now :-)

I've made an altered sample.world. Just added a lake and some mountains around it. I've loaded it with the Camera Modes.cpp tutorial, so that I can walk around a bit. Also changed the update function like this:
PHP Code:
Bool Update()
{
   if(
Kb.bp(KB_ESC))return false;
     if (
Kb.bp(KB_1)) Water.draw true;
     if (
Kb.bp(KB_2)) Water.draw false;
   
Game::World.update(Cam.at);

   
UpdateCamera();

   return 
true;


It seems that if I draw the ocean, reflections do not appear on the lake plane. If no ocean is drawn, the lake plane has the reflections.

A few further experiments have made it clear to me that in both cases, the reflections *are* drawn. Only, when an ocean is drawn, reflections are drawn in relation to the ocean plane. You can see this if you draw a lake just above ocean level. The reflections will be there, but they appear a bit too far down. But of course if you have your lake a bit more up on the y axis, that won't be visible any more.

So now the question is, are we supposed to use ocean OR lake/river and have reflection? Or should we be able to do both? (Or is this perhaps happening only on my ATI video card?)

I've included my version of sample.world.
.7z  sample.world.7z (Size: 55.53 KB / Downloads: 8) (I've only levelled it a bit more, made some hills that would be reflected, and added a lake surface.)
12-22-2011 10:32 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #4
RE: water reflection
I just tried it out and I see what you mean. I could be wrong, but this might just be an engine optimization where it only draws one reflection for the most dominent water surface, which is the ocean when it is on??? Alternatively it could be a y-axis offset bug as you've sort of hinted at???
12-23-2011 03:38 AM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #5
RE: water reflection
Glad it's not only on my computer. Having no further information from the docs, I guess we'll just have to wait now until Esenthel himself gives the decisive answer :-)
12-23-2011 12:25 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: water reflection
Hi!
The reflections are supported only for flat surfaces (lake, ocean) and only one reflection at a time. If there is another lake/river at similar level (height) as the ocean/lake that trigerred the reflection rendering, then it will be included as well, if secondary lake/rivers are too far away (height) from the trigerred one, then they will not include reflection.
12-23-2011 10:50 PM
Find all posts by this user Quote this message in a reply
Post Reply