I am using the projected grid water that was posted here:
To create some water for my game. However after complementing everything i have come across several issues.
Here is a video that outlines some of my issues since its easier to explain it that way:
You may read the description for more info or read below:
> Firstly you can see that the reflection is much to large, both for the Red Object and the sky.
> Secondly, you can see that the normal maps is returning a strange white look ontop of the water, instead of small wave shadows.
> And lastly, when i rotate the camera, the water shape seems to change.
I have the same exact issues as you. But i’m not an expert on that topic so i couldn’t fix it.
Hmmm. I’ve tried everything. I’ve looked where the cam object is referenced. For the last issue where everything changes when i rotate the camera. It is referenced a lot, so perhaps it changes something when the cam is rotated by accident. Ive also looked at the reflection code, but i cant find anything there
As for the normals, i think this approach uses them as a specular sort of thing. But its not white enough.
The issue is most definitely in the Projected Grid Class:
I’ve narrowed it down to this section of the code:
I think the issue originates from here somewhere:
height = cam.getLocation().getY();
Camera camera = cam;
ProjectedTextureUtil.camera = camera.clone();
viewPortWidth = camera.getWidth();
viewPortHeight = camera.getHeight();
getWorldIntersection(height, source, modelViewProjectionInverse, pointFinal);
pointFinal.multLocal(1.0f / pointFinal.getW());
realPoint.set(pointFinal.getX(), pointFinal.getY(), pointFinal.getZ());
I found the issue where it deforms everything when you rotate. Th eissue is caused by this line:
I think. This: .addLocal(cam.getDirection() causes the mesh to rotate with the camera, but when it roatetes with the camera, it somehow changes its appearance along the grid.
February 21, 2014, 12:55pm