1
\$\begingroup\$

So I am somewhat new to working with DirectX rendering, and I have done some 2d and 3d work. I am planning on working on a new application where I will be rendering a bunch of 3d scenery, and then overlaying some 2d 'sprites'

My plan is to draw the 3d stuff, then change to an orthographic projection for the 2d stuff and so on. I was wondering if this was a normal thing to do, or if I am somehow going to be shooting myself in the foot later because of performance problems, etc.

Sorry if the question is vague, I don't quite know enough to be more technical / elaborate.

\$\endgroup\$
5
\$\begingroup\$

Totally normal thing to do.

You can also render your 3D to one render target and your 2D to a different render target and then draw those over each other in a later pass. That lets you do all sorts of fun tricks, like rendering the 3D in a lower and faster resolution while keeping your 2D in a higher and crisper resolution. This sort of thing is also important to parallelizing your rendering pipeline (more important with D3D12/Vulkan).

There can be performance problems with rendering as you suggest, but that's all rather dependent on a bunch of implementation details.

\$\endgroup\$
  • \$\begingroup\$ Dumb question: Can I render to the same render target. Like do all of the 3d stuff first, then just splat the 2d right on top? \$\endgroup\$ – A.R. Jul 16 '15 at 13:26
  • \$\begingroup\$ @A.R.: yup. Again, how well that'll work depends on implementation details, but that's a very common approach. \$\endgroup\$ – Sean Middleditch Jul 16 '15 at 15:32
  • \$\begingroup\$ OK cool. I had a feeling it would be OK, but you never know. For my purposes, it's just some 3d asteroids and some crappy spaceship sprites on top. :) \$\endgroup\$ – A.R. Jul 17 '15 at 2:09

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.