Let's fix D3D Scaling

Started by Alan v.Drake, Sun 18/09/2011 21:36:01

Previous topic - Next topic

Alan v.Drake


If you want to give it a go download it from here: http://www.mediafire.com/?8vu6h77clvskfz8

I learned a little of D3D today while trying to fix this annoying quirk

Doesn't work well with the "smooth sprites" option, though.

No code yet, because I need to clean up and reorganize. Would be cool if I managed to make feasible to add more gfx filters...


Oh btw,
Code: ags

void D3DGraphicsDriver::RenderToBackBuffer()
{
  throw Ali3DException("D3D driver does not have a back buffer");
}

that line of code made my day.  ::)


- Alan

subspark

Okay, I've called the celebrant and pre-arranged our Marriage to be held on Thursday, on the Shores of Mozambique for 11:30AM EST.
OMGGG  DDRRAAKKEE!!!!!!  :o I must become your manbitch and fart a few babies out for you!

FTW, kind sir.  :P

Alan v.Drake

Quote from: subspark on Mon 19/09/2011 09:21:27
Okay, I've called the celebrant and pre-arranged our Marriage to be held on Thursday, on the Shores of Mozambique for 11:30AM EST.
OMGGG  DDRRAAKKEE!!!!!!  :o I must become your manbitch and fart a few babies out for you!

FTW, kind sir.  :P

Woah now, let's not go overboard!
Test it if it works properly.


- Alan

Calin Leafshade

Cool, this was something i was meaning to fix but i completely forgot.

We should get a bugtracker or something.

Snarky

Wow, excellent! This has been a longtime annoyance for me.

We discussed this problem last year here. At the time, CJ was pretty adamant that it couldn't be done without losing the benefits of hardware acceleration. Were you able to get around that?

Also in that thread we commented on the color differences between the two rendering options, and how D3D seems to introduce banding. Nefasto recently commented that there's some code in the D3D9 rendering loop that is changing the colors. This might have something to do with buggy gamma correction code.

Is that something that can be fixed in the same go?

Alan v.Drake

#5
I just rendered everything to a backbuffer surface and then stretched it to the screen, I don't know about performances, with my game I see no difference. But who knows, maybe not having to scale indipentently every single sprite makes thing a little faster, or maybe not, I learned d3d yesterday, I can only offer wild guesses  :P

About the color banding thing, if I guess correctly Aeronuts has 16bit gfxs, so the problem lies somewhere in the color translation between 16->32 bit.

edit: yeah, there's definitely something fishy going on, I took two screens on aeronuts and the d3d one has noticeably less colors, and the game window makes everything lag like hell if I move it between my two screens, it never happened to me before, I have no idea what causes it.

- Alan

Calin Leafshade

Quote from: Snarrrky on Mon 19/09/2011 15:40:49
We discussed this problem last year here. At the time, CJ was pretty adamant that it couldn't be done without losing the benefits of hardware acceleration. Were you able to get around that?

The problem there was that AGS renders straight to the backbuffer with scaling so to make the sprites render properly you would have to somehow set the scaling resolution as you draw it, which is not possible.

Really everything should be rendered to a temporary render target at normal size which is *then* rendered to the back buffer and scaled. I assume thats how Alan fixed it.

subspark

QuoteWoah now, let's not go overboard!
Too late! I slipped of the plank o' lust when I read the subject.  :=

Alan v.Drake

#8
On a almost unrelated note, I made a couple of directdraw filters, just for the sake of it.
A 2x scanline + noise and a half-assed 4x crt tv mode.

If you're bored and want to test them and give some feedback I won't complain: http://www.mediafire.com/?51h048gt8wsjwuy

They replace the hq2/3x ones at the moment.

EDIT: Optimizations and new x4 PC CRT mode, link updated. the x2 noise, has no noise now, I'm fiddling around with things

- Alan

Snarky

Quote from: Alan v.Drake on Mon 19/09/2011 17:23:49
edit: yeah, there's definitely something fishy going on, I took two screens on aeronuts and the d3d one has noticeably less colors, and the game window makes everything lag like hell if I move it between my two screens, it never happened to me before, I have no idea what causes it.

Is that running with your build of the engine, or with the original? In other words, are you saying that you are experiencing performance issues with your changes?

Alan v.Drake

Quote from: Snarky on Wed 21/09/2011 10:18:48
Is that running with your build of the engine, or with the original? In other words, are you saying that you are experiencing performance issues with your changes?

Both mine and original.


- Alan

SMF spam blocked by CleanTalk