AuthorTopic: Game engine/2D art scaling (not pixelart)  (Read 2322 times)

Offline Seiseki

  • 0011
  • **
  • Posts: 915
  • Karma: +1/-0
  • Starmancer
    • OminuxGames
    • http://pixeljoint.com/p/35207.htm
    • StarmancerGame
    • View Profile
    • Starmancer Patreon

Game engine/2D art scaling (not pixelart)

on: May 22, 2012, 08:24:43 am
I'm a bit confused as how games handle none pixel art 2D sprites in regards to scaling.
Working on a game at the moment and I'm worried how we'll handle the scale for lower resolutions.
None of the two programmers I'm working on has any experience in this area so I've tried to do a bit of research.
The coding of the resolution scaling is on hold at the moment while I try to find out the correct way to deal with this.

I'm wondering how I'm supposed to design the art assets, do I make them twice the actual size and have the engine scale them depending on user resolution?
Of course as an artist I'd want everyone to see the art at a 1:1 pixel ratio, but that's not realistic, is it?
Also, knowing pixel art I do know the importance of designing low res graphics in low res and how scaling down a high res texture makes it look very undefined in comparison.

I'm hoping there's someone here with experience in 2D engines and designing art assets for them.
Any tips will be helpful!

edit: I guess this is relevant, but these seem to be about upscaling and not downscaling.. http://en.wikipedia.org/wiki/Image_scaling
« Last Edit: May 22, 2012, 08:37:14 am by Seiseki »

Offline Kasumi

  • 0010
  • *
  • Posts: 275
  • Karma: +1/-0
    • View Profile

Re: Game engine/2D art scaling (not pixelart)

Reply #1 on: May 22, 2012, 05:17:52 pm
Edit: I realized I gloriously misunderstood your question. Making things twice as big as they'll be displayed in your target resolution is actually a good idea if it's possible they will ever be scaled larger by say... full screen or something. As always I leave my posts intact so as not to hide my poor reading comprehension, but the rest is bad info since... I totally misinterpreted your question as what to do with pixel art scaling for games.

My opinion: Your assets should be 1:1, always.

Situation: You simply double the resolution of all your image assets, and load and display them that way.

Problem: All your game logic has to take into account that two pixels is now one. Otherwise your sprites will move half a scaled pixel to the background. It's easier to render the frame, then scale and display the entire rendered frame if what I described is undesirable. If you're doing something with layers like Shantae: Risky's Revenge or Mutant Mudds, I think it's still better to scale each object from 1:1 to larger or smaller than do anything else.

I don't know what your programmers are using, but if it's something that supports 3D textures, they can probably get scaling done pretty easily. (Also, they should be doing the research!  :lol:) In fact, even most 2D graphics libraries probably provide functions for it. But if you wanna be hardcore and solve the problem again:

For downscaling, it's basically about finding the average of all the old pixels that when downscaled become a single pixel.

Situation: You have a 2x2 image with the following RGB values in the following arrangement:

(32, 32, 32,) (86, 86, 86)
(14, 14, 14) (52, 52, 52)

And want to display it at half res. One simple thing you can do is make an exact average. So the average R value of the 4 pixels becomes the R value for the new pixel, etc.

(46, 46, 46)

But it gets tricky when you want to scale things that don't go in easily.

Say you had a 3x3 image you wanted to scale by half. What happens to the third row and column of pixels? Does it just vanish and not affect the average? No, that'd be bad. This third row can actually end up dimming the average result pixel, so your algorithm must take this into account. How about a 2x2 image you want to scale to 33%? The same problem exists with nearest neighbor scaling up by odd percents. You'll get x and (x+1) pixels in the scaled version for every pixel in the unscaled version which creates a sort of unevenness. All the different algorithms exist because it's not exactly an easy problem in either direction.

Disclaimer: I've only programing an upscaling function, and only one that exactly doubles the resolution.
« Last Edit: May 22, 2012, 05:31:01 pm by Kasumi »
I make actual NES games. Thus, I'm the unofficial forum dealer of too much information about the NES