PDA

View Full Version : Don't know how to achieve Interlaced Rendering



Infame87
07-20-2016, 11:42 AM
Is there any way to render Interlaced (for tv purpose: 1080i)?

Actual Solution: I'm rendering my scene every 20msecs and copying odds and even rows to create 1 frame every 40msecs. This "interlaced" frame goes to the Graphic Engine.
The problem with this is that tooks a lot of copyes and scanlines to do this.

We are making a little scene editor but the final result must go to a TV OUT in an Interlaced Mode.



Thanks in advance.

GClements
07-20-2016, 02:22 PM
Is there any way to render Interlaced (for tv purpose: 1080i)?
Actual Solution: I'm rendering my scene every 20msecs and copying odds and even rows to create 1 frame every 40msecs. This "interlaced" frame goes to the Graphic Engine.
The problem with this is that tooks a lot of copyes and scanlines to do this.

There's no reason to render 576 lines then discard half of them; you can just render 288 lines for each field.

One slightly tricky point is to get the projection matrix correct. The pixel centres for line i (0<=i<288) should be at (2*i+0.5)/576 for an even field or (2*i+1.5)/576 for an odd field. To achieve this, a projection which is correct for a 576-line frame should be pre-multiplied by a Y-translation of +/- 1/1152 for a 288-line field.


I may have these terms backward; here, "even" means lines 0,2,4,.... Bear in mind that OpenGL puts the origin in the lower-left corner with Y increasing upward.

You may be able to avoid (or at least optimise) a copy by rendering to one half (left or right) of a 1536x288 framebuffer. When treated as a 1-D array of pixels, the result will have the same layout as a 768x576 interlaced frame.

If you need the result as a 768x576 framebuffer, you can use texture views (in OpenGL 4.3+) to treat the same memory as both a 1536x288 texture and 768x576 texture. Render into the former then blit the latter to the screen. For a memory to memory copy, this approach reduces to a single block copy rather than needing to copy line-by-line.