Hi, When i try to use standard assets Water pro, i have a copile error with : Camera.CalculateObliqueMatrix. Doesnt exits in the API.
I had this error too. Disabling theses lines seems to work fine, but this could cause issues (none found so far for me).
Hm, I think we may accidentally have included the more recent Unity 4.5 Standard Assets with the Unity for PSM installation. In Unity 4.3.x (on which Unity for PSM is currently based) the Camera class did not have the CalculateObliqueMatrix function. Instead you need to calculate it manually using Code (csharp): // Setup oblique projection matrix so that near plane is our reflection // plane. This way we clip everything below/above it for free. Vector4 clipPlane = CameraSpacePlane( reflectionCamera, pos, normal, 1.0f ); // Camera.CalculateObliqueMatrix is not available in Unity 4.3 // 4.5 : reflectionCamera.projectionMatrix = cam.CalculateObliqueMatrix(clipPlane); // Instead we calculate it manually : Matrix4x4 projection = cam.projectionMatrix; CalculateObliqueMatrix (ref projection, clipPlane); reflectionCamera.projectionMatrix = projection; reflectionCamera.cullingMask = ~(1<<4) & m_ReflectLayers.value; // never render water layer reflectionCamera.targetTexture = m_ReflectionTexture; Code (csharp): // Adjusts the given projection matrix so that near plane is the given clipPlane // clipPlane is given in camera space. See article in Game Programming Gems 5 and // http://aras-p.info/texts/obliqueortho.html private static void CalculateObliqueMatrix (ref Matrix4x4 projection, Vector4 clipPlane) { Vector4 q = projection.inverse * new Vector4( sgn(clipPlane.x), sgn(clipPlane.y), 1.0f, 1.0f ); Vector4 c = clipPlane * (2.0F / (Vector4.Dot (clipPlane, q))); // third row = clip plane - fourth row projection[2] = c.x - projection[3]; projection[6] = c.y - projection[7]; projection[10] = c.z - projection[11]; projection[14] = c.w - projection[15]; } // Calculates reflection matrix around the given plane private static void CalculateReflectionMatrix (ref Matrix4x4 reflectionMat, Vector4 plane) { reflectionMat.m00 = (1F - 2F*plane[0]*plane[0]); reflectionMat.m01 = ( - 2F*plane[0]*plane[1]); reflectionMat.m02 = ( - 2F*plane[0]*plane[2]); reflectionMat.m03 = ( - 2F*plane[3]*plane[0]); reflectionMat.m10 = ( - 2F*plane[1]*plane[0]); reflectionMat.m11 = (1F - 2F*plane[1]*plane[1]); reflectionMat.m12 = ( - 2F*plane[1]*plane[2]); reflectionMat.m13 = ( - 2F*plane[3]*plane[1]); reflectionMat.m20 = ( - 2F*plane[2]*plane[0]); reflectionMat.m21 = ( - 2F*plane[2]*plane[1]); reflectionMat.m22 = (1F - 2F*plane[2]*plane[2]); reflectionMat.m23 = ( - 2F*plane[3]*plane[2]); reflectionMat.m30 = 0F; reflectionMat.m31 = 0F; reflectionMat.m32 = 0F; reflectionMat.m33 = 1F; }
Actually, my project was made using Unity 4.5, thus using the water pro from 4.5. The solution was to create a new scene, delete the water pro folder, then import water pro from the 4.3 PSM Unity. No more errors.