kitman20022002

05-15-2016, 09:25 PM

I trying to do a reflection for my ocean, and how can I inverse the pitch if I only have the viewmatrix in OpenGL becasue my camera is control by Utility::freeMovement( m_cameraMatrix, a_deltaTime, static_cast<float>(m_cameraSpeed));

and this video describe what I'm doing

https://www.youtube.com/watch?v=0NH9k4zTAqk&index=3&list=PLRIWtICgwaX23jiqVByUs0bqhnalNTNZh

from 11:19 to 12:19 thanks.

I have try so many method but does not work, giving me crazy results

First method:

tempCam = m_cameraMatrix;

tempCam[1].y *= -1;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Second method:

tempCam = m_cameraMatrix;

tempCam[2] = glm::reflect(tempView[2] , glm::vec4(1,0,0,1));

tempCam[2].w = 0.0f;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Third method:

tempCam = m_cameraMatrix;

tempCam [0].y *= -1;

tempCam [1].y *= -1;

tempCam [2].y *= -1;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Forth method:

tempCam = m_cameraMatrix;

tempCam[2] = glm::reflect(tempCam[2] , glm::vec4(1,0,0,1));

tempCam[2].w = 0.0f;

tempCam[1].y *= -1;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Fifth method:

tempCam = m_cameraMatrix;

tempCam[2] = glm::reflect(tempCam[2] , glm::vec4(1,0,0,1));

tempCam[2].w = 0.0f;

tempCam[1]= glm::reflect(tempCam[1] , glm::vec4(0,1,0,1));

tempCam[1].w = 0.0f;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

and this video describe what I'm doing

https://www.youtube.com/watch?v=0NH9k4zTAqk&index=3&list=PLRIWtICgwaX23jiqVByUs0bqhnalNTNZh

from 11:19 to 12:19 thanks.

I have try so many method but does not work, giving me crazy results

First method:

tempCam = m_cameraMatrix;

tempCam[1].y *= -1;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Second method:

tempCam = m_cameraMatrix;

tempCam[2] = glm::reflect(tempView[2] , glm::vec4(1,0,0,1));

tempCam[2].w = 0.0f;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Third method:

tempCam = m_cameraMatrix;

tempCam [0].y *= -1;

tempCam [1].y *= -1;

tempCam [2].y *= -1;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Forth method:

tempCam = m_cameraMatrix;

tempCam[2] = glm::reflect(tempCam[2] , glm::vec4(1,0,0,1));

tempCam[2].w = 0.0f;

tempCam[1].y *= -1;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));

Fifth method:

tempCam = m_cameraMatrix;

tempCam[2] = glm::reflect(tempCam[2] , glm::vec4(1,0,0,1));

tempCam[2].w = 0.0f;

tempCam[1]= glm::reflect(tempCam[1] , glm::vec4(0,1,0,1));

tempCam[1].w = 0.0f;

glm::mat4 tempView = inverse(tempCam);

drawScene(m_projection , inverse(tempCam));