Render GUI elements with projection matrix

Started by
11 comments, last by NightCreature83 8 years, 4 months ago

Thanks to all for your answers.

What do you think about using PerspectiveOffCenterLH matrix for this?

Seems it project DirectX units directly to pixels and position correspondingly. Using this matrix 0.0 will be at the top left corner of the window without any additional manipulations.

Step away from the pixel idea for 3D ui pixels dont really matter, the scene is authored in 3D space and its coordinate system. Think in camera composition instead, moving the camera closer to an object will make it appear bigger on screen.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

Advertisement

OK, I understand. I wanted to merge 2D and 3D UI, but seem this is not possible.

I need to separate 2D and 3D UI.

That depends on what you want to do, usually you have an overlay 2D ui to do things like error message boxes or HUD elements but these are 2D ui and are a different scene from the 3D ui one. And they just use normal ortho projection rendering.

Offcourse you can embed rendertargets into the 3D scene to render another UI scene to that, but even for that you dont need to know things about pixels for positioning the elements.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

This topic is closed to new replies.

Advertisement