Home » Community » Forums » » Resolution Independence in 2D Direct3D Games – An Alternative Approach
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Resolution Independence in 2D Direct3D Games An Alternative Approach
Post Reply 
So, the article is decent enough for what it is, but I think the stated conclusion that this method results in better visual quality is sorely mistaken. Essentially, you've taken a game that was programmed as if it were 1024x768, and whose art assets were designed for 1024x768, and then tried to scale the vertices such that they fit the other resolution and noticed they don't look so good. The upscaled framebuffer looks fine, however, and you claim it to be the way which produces better visual quality -- It does in this case, of course, but only because you've not made any concessions to allow the typical method to work to the best of its ability, which, if done correctly, ought to look better. You're comparing "your way" to a ham-strung version of "the right way".

Now, the method you describe does have its merits, namely that it is basically non-invasive, and allows you to focus on a single resolution for art assets. On the other hand, there are real downsides which you yourself mention. Also, the point may be somewhat moot -- On CRTs, better results can be had by changing to the supported resolution and LCDs will stretch to fit the display, doing essentially the same thing. I concede that your method may produce better, more-consistent results across different LCDs (particularly cheaper ones) at some additional processing costs, but the other side of that coin is that some high-end LCDs with high-quality scaling circuits may produce better results on their own.

In order to make the traditional method work well, the art assets need to be designed for a 1:1 pixel ratio at the highest resolution, if not 2:1, and mip-mapping and multi-sampling should be enabled.

 User Rating: 1549   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Ravyne
Now, the method you describe does have its merits, namely that it is basically non-invasive, and allows you to focus on a single resolution for art assets.

I concede that your method may produce better, more-consistent results across different LCDs (particularly cheaper ones) at some additional processing costs, but the other side of that coin is that some high-end LCDs with high-quality scaling circuits may produce better results on their own.

In order to make the traditional method work well, the art assets need to be designed for a 1:1 pixel ratio at the highest resolution, if not 2:1, and mip-mapping and multi-sampling should be enabled.


Of course. I happily agree with every point you make, but I am only presenting this method for the situation where you wish to focus on a single resolution, and the consistency of results across different hardware and resolutions is one of the chief motivations.

Unless you are pre-rendering your sprites from 3D models, it may not be practical or desirable to do your pixel art at some theoretical maximum size.

I'd also contend that on less powerful, older graphics hardware, the additional texture memory required (considering you are suggesting storing graphics at the maximum resolution and creating a mipmap chain) and the costs of multi-sampling could seriously outweigh the minor costs of the approach I've outlined.

As I said in the article, I don't claim this to be any kind silver bullet and there are pros and cons compared to other approaches. It is just a method I have found to be successful when working with native-sized pixel art that I wanted to share.

 User Rating: 1817   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

Quote:
Original post by EasilyConfused
Of course. I happily agree with every point you make, but I am only presenting this method for the situation where you wish to focus on a single resolution, and the consistency of results across different hardware and resolutions is one of the chief motivations.

Unless you are pre-rendering your sprites from 3D models, it may not be practical or desirable to do your pixel art at some theoretical maximum size.

I'd also contend that on less powerful, older graphics hardware, the additional texture memory required (considering you are suggesting storing graphics at the maximum resolution and creating a mipmap chain) and the costs of multi-sampling could seriously outweigh the minor costs of the approach I've outlined.

As I said in the article, I don't claim this to be any kind silver bullet and there are pros and cons compared to other approaches. It is just a method I have found to be successful when working with native-sized pixel art that I wanted to share.


This is relevant to my interests.

However, it looks as though you have a spelling mistake:
Quote:
At the end of the rendering look

I assume you meant loop instead of look? .


Oh internet... so many idiots... so few bullets.

Linky goodness: [journal] | [Gorgon]


 User Rating: 1436   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Quote:
Original post by EasilyConfused
Quote:
Original post by Ravyne
Now, the method you describe does have its merits, namely that it is basically non-invasive, and allows you to focus on a single resolution for art assets.

I concede that your method may produce better, more-consistent results across different LCDs (particularly cheaper ones) at some additional processing costs, but the other side of that coin is that some high-end LCDs with high-quality scaling circuits may produce better results on their own.

In order to make the traditional method work well, the art assets need to be designed for a 1:1 pixel ratio at the highest resolution, if not 2:1, and mip-mapping and multi-sampling should be enabled.


Of course. I happily agree with every point you make, but I am only presenting this method for the situation where you wish to focus on a single resolution, and the consistency of results across different hardware and resolutions is one of the chief motivations.


Fair enough, and I'll also happily agree that it fits the bill for those wanting to focus on a single resoultion. I may have come off a bit harsh, particularly in the first paragraph, I would have toned it down had I realized it wasn't some no-name from the forums :) I guess I read the article as if it had come from someone fresh who thought they had stumbled on the greatest thing ever, rather than someone more experienced presenting it as an easy solution for a specific set of circumstances.

Quote:
Unless you are pre-rendering your sprites from 3D models, it may not be practical or desirable to do your pixel art at some theoretical maximum size.


Also fair enough, particularly for hobbyists and programmer art. Less of a concern when dealing with a real artist though.

Quote:
I'd also contend that on less powerful, older graphics hardware, the additional texture memory required (considering you are suggesting storing graphics at the maximum resolution and creating a mipmap chain) and the costs of multi-sampling could seriously outweigh the minor costs of the approach I've outlined.


Well, the MIP mapping only requires 34% more memory for all levels vs. just the largest size, which is notable but probably not a deal-breaker, however, I applied the term incorrectly. If you can know the size up front it'd be easier and more efficient to just load the necessary MIP level as the sole texture. Also, now that I think about it, multi-sampling is probably overkill, and bi-linear filtering ought to be sufficient.

Quote:
As I said in the article, I don't claim this to be any kind silver bullet and there are pros and cons compared to other approaches. It is just a method I have found to be successful when working with native-sized pixel art that I wanted to share.


Understood. As I said, I likely misinterpreted who was presenting the article and likely due to my own supposition rather than the content of the article itself.

 User Rating: 1549   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Ravyne
Fair enough, and I'll also happily agree that it fits the bill for those wanting to focus on a single resoultion. I may have come off a bit harsh, particularly in the first paragraph, I would have toned it down had I realized it wasn't some no-name from the forums :) I guess I read the article as if it had come from someone fresh who thought they had stumbled on the greatest thing ever, rather than someone more experienced presenting it as an easy solution for a specific set of circumstances.


Hey, no problem. I'm perfectly happy for people to criticise as harshly as they want .

I should actually have considered that people would read it this way and perhaps explained the limited application of this approach more clearly in the preamble.

 User Rating: 1817   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

Quote:
Original post by Tape_Worm
I assume you meant loop instead of look? .


How the hell did that happen? P isn't even next to K? Oh well.

Glad to hear there is some relevance for you.

 User Rating: 1817   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

There is a actually a better solution than this. What you can do is render your scene into a texture at the native resolution and when you create your screen aligned quad to match the resolution you want your game to be in, D3D will automatically stretch the texture to fit the quad. then turn filtering on, you will get the same effect as StrechRect, but it is a lot faster.

 User Rating: 1084   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by BornToCode
There is a actually a better solution than this. What you can do is render your scene into a texture at the native resolution and when you create your screen aligned quad to match the resolution you want your game to be in, D3D will automatically stretch the texture to fit the quad. then turn filtering on, you will get the same effect as StrechRect, but it is a lot faster.


That is certainly true, although on hardware that only supports power-of-two textures, you might end up wasting a bit of texture memory - at 1024x768, you'd need a 1024x1024 texture. If the native res was 1280x1024, you'd need a 2048x1024 texture, or a 2048x2048 if only square textures were supported.

Your approach would be faster though, and would have other advantages (running the final screen through a shader, being able to combine images with alpha blending etc). It would be fairly trivial to adapt my code to do this instead.

[Edited by - EasilyConfused on December 1, 2008 1:05:26 PM]

 User Rating: 1817   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

How is this different to just using an orthographic projection whose width and height represent the "native resolution"? In this case, I imagine you would not incur the StretchRect overhead?

 User Rating: 1124   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Rompa
How is this different to just using an orthographic projection whose width and height represent the "native resolution"? In this case, I imagine you would not incur the StretchRect overhead?


To be honest, I'm not sure as I haven't tested it. I'd assume that using the ortho perspective would produce similar results to manually scaling the vertices on the CPU, since D3D would be texturing a quad of non-native size.

Of the two images I posted in the article, the second is doing no filtering at all, either when rendering the sprites or when doing the CopyRect() so I'd consider the overhead equivalent to when running a D3D app in windowed mode.

 User Rating: 1817   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

Yes using a OrthoProjection that represents the final resolution will give you the same result as if you scale up your vertices which even with blending looks very bad. Letting D3D do the scaling for u with Linear Filtering turn on actually looks alot better.

 User Rating: 1084   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I don't get it. Why don't you just set your viewport to the desired resolution?
Especially if you are using orthographic projection that is all you need for resolution independence. Set the width and height of your viewport to like 800x600 and it will properly scale to whatever resolution you choose to run your game in. That way you will have a target resolution (800x600 in my example) for which you create your art assets and let the resolution be handeled automatically by D3D.

Sorry, but I kinda don't get what the point of this article is. Either I am missing something, or this "alternative approach" is more complicated than it needs to be. It's just ~2 lines of code to achieve the same effect. I know this because I do this pretty often, I let the program run in windowed mode with 800x600 while the viewport is 640x480, and it gets scaled just the way you described it.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I used it in my program and it works wonders, but...

When my character is near to the middle of the screen it looks quite nice. But when I move it to the sides of the screen it's getting all blurry. It's quite ugly looking then and the anti-aliasing of character changing as it walks is quite bad... Any ideas how I could prevent that?

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: