0
\$\begingroup\$

I have a game that has a score, I found out how to render text in a ortho projection but I can find a way to mix the two, or have text stay in the same position on the screen at the same time as camera movement. Would I need to constantly change the position and depth of the text to keep it on top of everything and on the screen at the same time?

\$\endgroup\$
3
\$\begingroup\$

No, you can first render your perspective scene normally, and then switch to an orthographic mode and render your text on top of that, supplying the text vertices in screen space and using a shader that doesn't do much notable transformation to the vertices.

(Strictly speaking you don't even need to do this second pass with an orthographic projection, but you can if you want.)

You may need to disable the depth test for the second pass that renders the text depending on how you render it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.