Water material positioning / darkness


#1

Hello guys, I have discovered a somewhat bug in BABYLON.WaterMaterial.

You can see playground example here https://www.babylonjs-playground.com/#1SLLOJ#573

The problem is that farther that water is from 0,0,0 position, the darker it becomes - even if everything else moves in the same manner.

In that playground there is var offset = 0; Just change that to lets say 200 - whole scene moves for 200 units in x/z direction (meshes, camera, light) and suddenly watter is much darker.

This seemingly doesnt make any sense - when everything is “offseted” by the same number, it should look the same. I thought that coordinates are only “relative”.

I am making game where I am moving my character and camera while scene remains stationary - thus I can go far from 0,0,0 origin, everything else works just fine, except water.

I am quite new into this, so maybe I have missed something, but it seems really clear, that it doesnt work as intended.

Sorry for interruption and thanx in advance for answers.

EDIT: I have noticed that ground mesh is enlighted correctly, but water is just less transparent the farther from 0,0,0 it is.


#2

Pinging @julien-moreau


#3

Hey @stealman
Having a look ASAP to fix, I guess that my mirror position is wrong so I need to fix
Thanks for the feedback!! :slight_smile:


#4

I have tried to figure out more specifically what´s wrong, but I am quite new to all of this and wasn´t able to.
Its nice to see that someone can take care of it, it is otherwise awesome material :wink:

Thanx very much in advance !!


#5

Fixed! Pull request created: Fixed fresnel term in water material by julien-moreau · Pull Request #5743 · BabylonJS/Babylon.js · GitHub


#6

It was fairly quick :slight_smile: Thanx very much once again !


#7

We are quick!!! that’s why you can trust bjs :smiley: