Hello there, I have been following the OpenGL tutorial on skyboxes and used the method of converting from equirectangular to cube map instead of taking in 6 textures. It seems to work fine mostly
However when I look directly down or directly up or directly straight at a specific angle I can see from outside the cubemap (at least what i think is going on and verified this by making the cubemap smaller).
When I point the camera straight down all I see is whats above the cube and when i point the camera straight up all i see is what the camera sees under.
I have tried fixing this by enabling culling back faces however that doesn’t really work as now a lot of the faces don’t show:
The shaders I am using are from learnopengl with a minor change:
o_TextureCoordinate = a_Position * 2.0;
in order to transfer my cube coordinates from -0.5f 0.5f to -1.0f 1.0f. I looked in nsight and the cube map is loading in correctly. This is what my skybox rendering code looks like:
if (m_Settings.CurrentEnviormentMap)
{
glDepthMask(GL_FALSE);
glDepthFunc(GL_LEQUAL);
glDisable(GL_CULL_FACE);
m_Data.SkyBoxShaderProgram.Use();
m_Settings.CurrentEnviormentMap->GetTexture().Bind(0);
glm::mat4 viewProjection = m_Data.CurrentCamera->GetProjection() *
glm::mat4(glm::mat3(m_Data.CurrentCamera->GetView())); //(removes translation as translation is in the last column)
m_Data.SkyBoxShaderProgram.SetUniform("u_ViewProjection", viewProjection);
m_Data.SkyBoxShaderProgram.SetUniform("u_EnviormentMap", 0);
//draw our cube
Draw(m_Data.CubeGeometryIndex, glm::identity<glm::mat4>());
m_Data.GeometryList[m_Data.CubeGeometryIndex].BeginBatch(0);
OpenGL::Command::DrawElementsInstanced(
&m_Data.SkyBoxShaderProgram,
m_Data.GeometryList[m_Data.CubeGeometryIndex].GetVertexArrayPointer(),
OpenGL::DrawMode::Triangle, m_Data.GeometryList[m_Data.CubeGeometryIndex].GetIndexCount(),
m_Data.GeometryList[m_Data.CubeGeometryIndex].GetInstanceCount());
m_Data.GeometryList[m_Data.CubeGeometryIndex].EndBatch();
glDepthMask(GL_TRUE);
_ApplySettings();
}
I am not sure if i am doing anything wrong, if the actual raw opengl calls are needed i can give those as well. thank you.