How can the gl_position be modified
wddl opened this issue · 3 comments
Is your feature request related to a problem? Please describe.
I need to set gl_Position in the vertex shader, but in device domain cannot change z value through clipSpaceTransform matrix and only in device domain clipSpaceTransform can be set, how can the gl_position be modified?
refer to #7662 (comment)
Describe the solution you'd like
engine support modify gl_Position in vertex shader
Describe alternatives you've considered
OS and backend
Sorry for the miscommunication earlier, clipSpaceTransform is the right parameter to use in device domain. You can see for yourself that it's a mat4 applied to the position written out to gl_Position.
Note however that we do the following:
#if defined(VERTEX_DOMAIN_DEVICE)
// GL convention to inverted DX convention (must happen after clipSpaceTransform)
position.z = position.z * -0.5 + 0.5;
#endif
So when you expect a Z position in clip space at 0.0 it will actually be at 0.5 (in the domain 0..1).
@romainguy thank you very much!
I understand!