View Full Version : Projected grid

11-17-2014, 05:32 AM
I try to implement a projected grid solution to display ocean. I'm following this article :
"Real-time water rendering - Introducing the projected grid"

As it will be game for andoid I choose libgdx engine. The problem I met is how to calculate range (min/max) matrix mentioned in the paper. Currently I'm doing it like :

float[] frange= { x_max-x_min, 0, 0, x_min , 0, y_max-y_min, 0, y_min, 0, 0, 1f, 0f ,
0, 0, 0, 1f };

Matrix4 range=new Matrix4().set(frange); range.tra(); // transpose

This matrix is multiplied with InverseViewprojection matrix of projector. The goal is the projector to spread the projected grid in min max range calculated based on camera / plane intersection points.

The problem is that this matrix I take from the example implementation is using DirectX and do not work properly in my case. I try to switch Y/Z and receive better looking grid but still not 100% ok.

Can somebody help me with advice how to use the same matrix but for Open GL.