I'm still quite a beginner in the industry. I'm working on a game with some friends and I would like to add a cinematic between 2 levels like in the attached picture.

My question is how can I render the black bars in DirectX 9 or 11? Moreover, do I need to change the aspect ratio when I'm playing the cinematic?

enter image description here

  • \$\begingroup\$ Any particular reason why you can't just draw black rectangles at the top and bottom of the screen? (Or is this question "how do I draw black rectangles"?) \$\endgroup\$ – Trevor Powell Mar 27 '14 at 2:10

The black bars are nothing more than the cleared back buffer. The video is simply being centered and played between these two bars. This effect is known as Letterboxing. The only thing you need to do in DirectX is simply render the video accordingly (vertically aligned). That being said, a lot of the time these bars are shown because aspect ratio of the video is different than the game.

You do not change the resolution of the game while it's playing (at least, this is not a common approach). Rather, you calculate if the video aspect ratio matches the current aspect ratio, and if so, simply play it. If not, you can vertically center it.

** Some games are known to use letter boxing regardless to indiciate a "scene". You may choose to do this, too.

This post by Nick Gravelyn has more info.

| improve this answer | |

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.