Interlaced rendering?

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Post Reply
KillaMaaki
Very interested
Posts: 84
Joined: Sat Feb 28, 2015 9:22 pm

Interlaced rendering?

Post by KillaMaaki » Fri Feb 01, 2019 7:03 pm

Well I just managed to complete the entire set hardware-wise the other day (I now have the Sega CD *and* the 32X attachments!) and I'm a little bit back-on-my-bullshit / itching to test out some homebrew with my 32X (I know I've already got a project but bah I'm easily distracted)

I'm currently trying to build my toolchain in Mingw32 (which has been a lot of compile errors and tweaking things and applying patches, sigh), but in the meantime I wanted to ask something.

I loaded up a copy of Virtua Racing Deluxe on my Everdrive and played it for a bit to test out my 32X, and I was surprised at how smooth they managed to make it, but I couldn't help but wonder something: I don't suppose interlaced rendering could have been used to half the required render area and improve fillrate and performance even more, at the expense of combing artifacts?
I know the Genesis itself has interlaced rendering, but I don't know about the 32X. I'm tempted, once I get this toolchain finally built, to experiment with some sort of linetable tomfoolery (maybe by splitting one framebuffer into two halves, and pointing every other line at each alternating half?

User avatar
Sik
Very interested
Posts: 792
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Interlaced rendering?

Post by Sik » Fri Feb 01, 2019 11:46 pm

The interlaced mode on the Mega Drive is mainly intended for doubling the resolution, not halving it. It'd end up doing exactly the opposite of what you intend.

Also I don't think the 32X even supports it, but I could be wrong.
Sik is pronounced as "seek", not as "sick".

KillaMaaki
Very interested
Posts: 84
Joined: Sat Feb 28, 2015 9:22 pm

Re: Interlaced rendering?

Post by KillaMaaki » Sat Feb 02, 2019 12:03 am

Well, there's different modes AFAIK, one doubles the resolution but one doesn't and that one's what I'm talking about.
It doesn't look like there's anything in the 32X hardware like that though. However, the more I think about it the more I'm sure I could implement this with some line table trickery and a properly structured software rasterizer. Just wondering what kind of performance I can get out of it.

Chilly Willy
Very interested
Posts: 2709
Joined: Fri Aug 17, 2007 9:33 pm

Re: Interlaced rendering?

Post by Chilly Willy » Sat Feb 02, 2019 1:42 am

On my Yeti3D demo, I draw two pixels at once for half the horizontal resolution, but even more tricky, I use the line table for double lines for half the vertical resolution. That really improved the speed. Just store the same line start value for two lines before incrementing to the next line in memory. That sounds like what you want. My example code supports setting the display like that.
If you look in the yeti code, I do

Code: Select all

  Hw32xInit(MARS_VDP_MODE_32K, 1);
That makes it set up a 32k color display with an effective resolution of 320x100 (NTSC). When I draw two pixels with the same value during rendering, that makes the display resolution 160x100.

To make the screen full resolution (320x200 for 32k color mode), you'd do

Code: Select all

  Hw32xInit(MARS_VDP_MODE_32K, 0);

KillaMaaki
Very interested
Posts: 84
Joined: Sat Feb 28, 2015 9:22 pm

Re: Interlaced rendering?

Post by KillaMaaki » Sat Feb 02, 2019 2:30 am

Not quite, but similar. Just doubling the lines vertically results in an apparent 100 pixel high resolution, but what I'm after is essentially an apparent 200 pixel high resolution but each frame only updates every other line (first frame updates all even lines, second frame updates all odd lines, etc) similar to interlacing.

The upshot is that it's the same performance gain as your case, using 100px high res, with the benefit of having a higher apparent resolution (but then the downside is combing artifacts if/when two successive frames don't match up, which might be an okay tradeoff in exchange for the performance boost)

EDIT:

Okay so I implemented it and here's what I'm talking about.

With a single triangle motionless, the apparent vertical resolution is 200px with this technique
Image

However once the triangle moves, the combing artifacts become visible, because I implemented a sort of interlaced rendering technique in software and each frame is only rendering half of the lines.
So moving imagery exhibits noticeable artifacts, but I get a higher vertical resolution without paying the fillrate cost.
Image

KillaMaaki
Very interested
Posts: 84
Joined: Sat Feb 28, 2015 9:22 pm

Re: Interlaced rendering?

Post by KillaMaaki » Sat Feb 02, 2019 9:28 am

Eh, think I'm gonna drop the technique though. I'm starting to encounter some buggy & thorny edge cases in trying to make my triangle rasterizer support it with minimal extra work, and I'm not sure it's worth the hassle. Oh well, neat experiment anyway.

User avatar
Miquel
Very interested
Posts: 409
Joined: Sat Jul 30, 2016 12:33 am

Re: Interlaced rendering?

Post by Miquel » Sat Feb 02, 2019 1:46 pm

Chilly Willy wrote:
Sat Feb 02, 2019 1:42 am
I use the line table for double lines for half the vertical resolution. That really improved the speed. Just store the same line start value for two lines before incrementing to the next line in memory.
That "line table", I assume is a thing in the 32X hardware, correct?
Perhaps someone is trying to say they are also on the Moon. Just perhaps.

Chilly Willy
Very interested
Posts: 2709
Joined: Fri Aug 17, 2007 9:33 pm

Re: Interlaced rendering?

Post by Chilly Willy » Sat Feb 02, 2019 4:55 pm

The first 512 words of the framebuffer are word offsets into the framebuffer for each line (only 224 entries used for NTSC, and 240 entries for PAL if you enable the 240 tall mode). Using this table, you can easily do effects like scrolling and a certain level of scaling (vertical scaling only).

And I see what you mean about 'interlaced' now. The screen is still 320x200 (or 224 for 8 bit pixel mode), but you only draw every other line on each frame. The Mac 68K port of Doom had a mode like that - instead of drawing 640x480, it could draw 640x240 and skip every other line for better speed. It didn't try to interlace every other frame, so you wound up with a raster like effect. It also allowed for drawing 320x240 centered in the 640x480 display since Mac had no low-res video modes.

User avatar
Sik
Very interested
Posts: 792
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Interlaced rendering?

Post by Sik » Sat Feb 02, 2019 5:37 pm

Also it just hit me that 32X's forced double buffering is probably going to get in the way pretty hard (as what will be in the framebuffer are the contents two frames ago, not one).
Sik is pronounced as "seek", not as "sick".

Chilly Willy
Very interested
Posts: 2709
Joined: Fri Aug 17, 2007 9:33 pm

Re: Interlaced rendering?

Post by Chilly Willy » Sun Feb 03, 2019 1:03 am

Yep. When you draw the next frame, you'd be interlacing with the frame before last, not the last frame. Some old codecs are designed around double buffers - they have the differences between the next frame and the frame before last for just that very reason.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests