but strangely normals seems to fade in and out as i move the camera... messing everything else
I also tried the g_NormalMatrix, but it gives a pitch black screen...
my questions :
- is g_WorldViewMatrix the equivalent of opengl gl_ModelViewMatrix? (javadoc seems to say so)
- why JME3 material system "overrides" opengl matrix and attributes (ie gl_vertex -> inPosition, gl_Normal -> inNormal)?
- Anyone has got an idea to fix the pb? :P
is g_WorldViewMatrix the equivalent of opengl gl_ModelViewMatrix? (javadoc seems to say so)
Yes.
why JME3 material system "overrides" opengl matrix and attributes (ie gl_vertex -> inPosition, gl_Normal -> inNormal)?
This ensures forward compatibility with OpenGL3/4, which do not have the build in attributes and uniforms.
Anyone has got an idea to fix the pb?
Yeah, I think so. The reason it happens is because you're multiplying by (normal,1.0) and not (normal,0.0) like in the Render Monkey example. You have to use zero for the W component because the matrix's translation will be applied, which you don't want (normals being a direction, should not be effected by translation).
To avoid another pass, i use what i suppose to be the "hardware" depth (i just set a texture for depth and format to Depth32F in the FrameBuffer rendering the scene, and it ends up with a depth buffer :p)
Do you know how does this depth buffer is computed? is it linear, non linear or (z/w)?
Another thing, i don't see the A32R32G32B32F format for texture (only RGB32F), is it intended or maybe it's specific to later opengl implementations?
This should be convenient to store normals and depth in one pass. (i need a 32bit Float channel for depth)
To avoid another pass, i use what i suppose to be the "hardware" depth (i just set a texture for depth and format to Depth32F in the FrameBuffer rendering the scene, and it ends up with a depth buffer :p)
Do you know how does this depth buffer is computed? is it linear, non linear or (z/w)?
You should actually just use "Depth" as format, this is faster/better as it uses the same precision as the main framebuffer. Also Depth32F might not be supported on all OpenGL2 cards.
The depth is the usual one as specified by the OpenGL spec, so z/w.
I think you can just set gl_Position.z to the depth you want and gl_Position.w to 1.0 and that would result in your desired depth stored in the buffer, I am not sure about it though.
Another thing, i don't see the A32R32G32B32F format for texture (only RGB32F), is it intended or maybe it's specific to later opengl implementations?
This should be convenient to store normals and depth in one pass. (i need a 32bit Float channel for depth)
If I understood correctly though, you're using a separate texture for (hardware) depth, right? Or you changed your mind?
The format you mentioned would be, by jME3 convention, named as RGBA32F. I think it's there, if not, its quite easy to add it.