You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
Post-processing effects
Posted on: 2016/2/22 16:35
Administrator
Joined 2000/1/8
Germany
2522 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (15 Years) App Coder90+ Game Ratings
I have been thinking about design tricks and came up with a question to those who have worked with direct screen draw: is it possible (and feasible) to do "post processing" on the Virtual Boy? i.e. can we manipulate the frame buffers after the VIP has done its job and written the next frame to it?

I am thinking about a full screen HBias effect as en example, where we shift some rows by some pixels to create a wavy screen. Another example would be to only render to a fourth of the screen through the VIP and then scale that portion up to full screen by replacing each pixel of the original image with four pixels. Yet another example would be to add "glitches" of various kinds, like offsetting some rows, inverting portions of the screen, etc.
Top

#2
Re: Post-processing effects
Posted on: 2016/2/22 18:47
Nintendoid!
Joined 2007/12/14
169 Posts
CoderLong Time User (12 Years) App Coder
Quote:

KR155E wrote:
I have been thinking about design tricks and came up with a question to those who have worked with direct screen draw: is it possible (and feasible) to do "post processing" on the Virtual Boy? i.e. can we manipulate the frame buffers after the VIP has done its job and written the next frame to it?


Yep. In fact you pretty much have to wait until the VIP is done drawing to ensure that what you write will not be overwritten by the VIP's blitting ops. Granted, if the VIP is pretty busy during a frame, you won't have much time to do your own direct drawing, but if you had to you probably could play with the FRMCYC register to allow yourself more time, at the expense of framerate. I suppose if you were *really* careful with your timing you could "race the beam" and do your direct drawing in parallel with the VIP, but the exact timings of where and when the VIP blits pixels during its busy stage is a mystery to me.

Quote:

I am thinking about a full screen HBias effect as en example, where we shift some rows by some pixels to create a wavy screen. Another example would be to only render to a fourth of the screen through the VIP and then scale that portion up to full screen by replacing each pixel of the original image with four pixels.


These things are all technically possible, however they are very slow, as they all have to be done in software. You probably could pull it off at full framerate with clever coding, a sparse scene for the VIP to render, and not much else going on in your game loop, but as an example, my dither demo runs at almost fullscreen and doesn't run at 50Hz. I'd have to rewrite it in asm to squeeze more speed out of it, and that's with nothing else happening in my loop.

Quote:

Yet another example would be to add "glitches" of various kinds, like offsetting some rows, inverting portions of the screen, etc.


Small effects that are localized to portions of the screen are better candidates as general case effects IMO.
Top

#3
Re: Post-processing effects
Posted on: 2016/2/22 20:02
VUE(xpert)
Joined 2012/12/4
418 Posts
CoderLong Time User (7 Years)
Quote:

KR155E wrote:
I have been thinking about design tricks and came up with a question to those who have worked with direct screen draw: is it possible (and feasible) to do "post processing" on the Virtual Boy? i.e. can we manipulate the frame buffers after the VIP has done its job and written the next frame to it?


Yes, framebuffer memory can be accessed by the CPU after VIP drawing operations but before scanning to the displays. It's certainly possible. Feasible, like blitter shows, is another matter. (-:

The VIP bus is slower than the CPU bus, so you need to make every access count. Reading from VIP memory then writing back to the same address is two accesses, whereas direct rendering generally only requires writes. The big bottleneck here is going to be transfer speed.

Quote:

KR155E wrote:
I am thinking about a full screen HBias effect as en example, where we shift some rows by some pixels to create a wavy screen.

Know that framebuffer memory is stored with column-major ordering (top-to-bottom, then left-to-right), so to shift rows of pixels horizontally is going to be a beast to process. I'd have to try it, but I'm not sure there's enough time even after a blank VIP drawing operation with zero windows to pull this off.

Quote:

KR155E wrote:
Another example would be [...] Yet another example [...]


Since the time available after VIP processing but before display scanning is so small, I really think it would be more worthwhile to do CPU rendering before the VIP drawing procedure, uploading it to CHR memory instead of framebuffer memory. While there's not enough CHR memory for two fullscreen blits in this manner, you could still go a long way if you're clever with it. There's way more than enough time to write all 2048 CHR blocks per frame than reading and writing both framebuffers after VIP drawing but before display. Plus, you'd get to use the entire drawing and display time preparing the graphics for the next frame.
Top

#4
Re: Post-processing effects
Posted on: 2016/2/23 4:15
Nintendoid!
Joined 2007/12/14
169 Posts
CoderLong Time User (12 Years) App Coder
Quote:

Guy Perfect wrote:
Quote:

KR155E wrote:
I have been thinking about design tricks and came up with a question to those who have worked with direct screen draw: is it possible (and feasible) to do "post processing" on the Virtual Boy? i.e. can we manipulate the frame buffers after the VIP has done its job and written the next frame to it?


Yes, framebuffer memory can be accessed by the CPU after VIP drawing operations but before scanning to the displays. It's certainly possible. Feasible, like blitter shows, is another matter. (-:


Any plans to RE the VIP timings so that I *can* race the beam? While its utility might be limited, it'd be pretty cool regardless. :D
Top

#5
Re: Post-processing effects
Posted on: 2016/2/23 7:33
VUE(xpert)
Joined 2012/12/4
418 Posts
CoderLong Time User (7 Years)
Quote:

blitter wrote:
Any plans to RE the VIP timings so that I *can* race the beam?


I'd like to eventually. It's an after-project of the emulator thing, but not immediately something I expect to spend a lot of time on. The initial implementation of the VIP emulator will probably just render the whole darn thing on the first CPU cycle each frame until we can get the various timing mechanics figured out.

On the other hand, if we're going to set up a PVB task force to work on this, I'll gladly pitch in.
Top

#6
Re: Post-processing effects
Posted on: 2016/2/23 23:00
VB Gamer
Joined 2016/1/18
USA
38 Posts
Long Time User (4 Years)
Quote:

Guy Perfect wrote:
Quote:

blitter wrote:
Any plans to RE the VIP timings so that I *can* race the beam?


I'd like to eventually. It's an after-project of the emulator thing, but not immediately something I expect to spend a lot of time on. The initial implementation of the VIP emulator will probably just render the whole darn thing on the first CPU cycle each frame until we can get the various timing mechanics figured out.

On the other hand, if we're going to set up a PVB task force to work on this, I'll gladly pitch in.
Agreed. I would if I could.
Top

#7
Re: Post-processing effects
Posted on: 2016/2/24 21:33
Administrator
Joined 2000/1/8
Germany
2522 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (15 Years) App Coder90+ Game Ratings
Thanks for the expertise guys! I already suspected it to be possible, but very limited due to performance reasons. I still hope that this technique can be used for some simple effects.

I also talked to jorgeche about that topic in Skype and he liked the idea very much. The next day, he had added generic support for it to the VBJaEngine that lets you register any number of post-processing effects. Complete with a dynamic lighting sample effect that lightens up a box around the hero in our Platformer Demo. And the best part: there seems to be next to no performance penalty involved at all since the effect only affects a small portion of the screen. (In the emulator at least, have not yet tested on hardware.) :-)
Top

#8
Re: Post-processing effects
Posted on: 2016/2/26 22:12
Administrator
Joined 2000/1/8
Germany
2522 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (15 Years) App Coder90+ Game Ratings
Here's a proof of concept, a full-screen vertical wave effect applied to the VBJaEngine Platformer Demo! Amazingly, the performance is hardly affected by it, at least on Mednafen. I assume that it's not that great on hardware, but I am too afraid to test. ;-)

Attach file:


vb output.vb Size: 1,024.00 KB; Hits: 155

png  output-0000.png (9.37 KB)
1_56d0bf6a6b703.png 384X224 px
Top

#9
Re: Post-processing effects
Posted on: 2016/2/27 5:27
Nintendoid!
Joined 2007/12/14
169 Posts
CoderLong Time User (12 Years) App Coder
Quote:

KR155E wrote:
Here's a proof of concept, a full-screen vertical wave effect applied to the VBJaEngine Platformer Demo! Amazingly, the performance is hardly affected by it, at least on Mednafen. I assume that it's not that great on hardware, but I am too afraid to test. ;-)


In my experience Mednafen always runs faster than real hardware, but I can't always tell how much until I actually measure it.
Top

 Top   Previous Topic   Next Topic


Register To Post