I just realized that in my deferred renderer that position.z always turns out 0.0. When position is simply Position = (gl_ModelViewMatrix * gl_Vertex).xyz; Why does this happen?
can’t say for sure. you matrices (model or view) are probably wrong. check that your gl_ModelViewMatrix does not have a column with just zeroes.
How exactly do i check this? Also how do these become corrupt? Didnt know it was possible.
EDIT: Just did a more extensive test, and it appers the value is always <0.0 and not == 0.0…
it appers the value is always <0.0 and not == 0.0…
äh of course. The default in OpenGL is, that you look along the negative Z-Axis. So normly z-Valus are between 0 and -1.
Hah, you know, as soon as you hear it - it makes so much since… XD
PS. for those wondering Im doing
abs( Position.z * farRecipical )
so it is scaled to 0.0~1.0