Fix issue that causes atmosphere to show up on the other side of a planet if the shading is disabled (closes #677)

This commit is contained in:
Alexander Bock
2018-11-13 08:27:07 -05:00
parent 6e3dfa6db8
commit 9a368ede25
@@ -248,7 +248,13 @@ Fragment getFragment() {
// because all calculation for light interactions are done in Object
// Space, we avoid a new computation saving the normals in Object Space.
frag.gNormal.xyz = normalModelSpace;
frag.gPosition = vec4(positionCameraSpace, 1.0); // in Camera Rig Space
if (dot(positionCameraSpace, vec3(1.0)) != 0.0) {
frag.gPosition = vec4(positionCameraSpace, 1.0); // in Camera Rig Space
}
else {
frag.gPosition = vec4(1.0); // in Camera Rig Space
}
frag.depth = fs_position.w;