Jibble

Author Topic: improve sprite/background blending. anti aliasing? [SOLVED]  (Read 3847 times)

Hi all.

How can I improve the anti aliasing around my character sprites?  If I manually anti alias in Photoshop before importing, it will only look good against one colour backgrounds.  and AGS doesn't seem to support levels of transparency.

Any ideas/suggestions?

Here is a screenshot example...
« Last Edit: 04 Oct 2013, 23:48 by rickious »
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

DoorKnobHandle

  • Mittens Serf
    • DoorKnobHandle worked on one or more games that won an AGS Award!
    •  
    • DoorKnobHandle worked on one or more games that was nominated for an AGS Award!
Re: improve sprite/background blending. anti aliasing?
« Reply #1 on: 29 Sep 2013, 17:43 »
AGS does support 'levels' of transparency, look for "Alpha blended sprites" in the manual.

Re: improve sprite/background blending. anti aliasing?
« Reply #2 on: 29 Sep 2013, 17:44 »
Excellent thanks.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Re: improve sprite/background blending. anti aliasing?
« Reply #3 on: 29 Sep 2013, 18:09 »
Quote
It's enabled by default, but you can disable it like this:

game.disable_antialiasing = 1;
Im running in 32bit, Direct3D 9, but getting no anti-alias.  My sprites are png with alpha channel, so ill try with no alpha channel now.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Andail

  • Global Moderator
  • Global Moderator
  • Mittens Viscount
  • Cultured man of mystery
    • I can help with backgrounds
    • Andail worked on one or more games that won an AGS Award!
    •  
    • Andail worked on one or more games that was nominated for an AGS Award!
Re: improve sprite/background blending. anti aliasing?
« Reply #4 on: 29 Sep 2013, 18:17 »
If you have a png image with alpha channel, ags should automatically suggest that it be imported with the alpha channel. Does that happen?

Re: improve sprite/background blending. anti aliasing?
« Reply #5 on: 29 Sep 2013, 18:23 »
Yes it asks.

the images i used have sharp edges. I have tried with and without the alpha channel and no anti-alias.

is there something else im missing.  Its early enough that I can redo my character sprites and manually anti-alias in Photoshop and import with an alpha channel.  But I have read that scaling isnt great in this case.  I really want the most effective way to anti-alias, but dont want to resort to plugins etc.

What is the antialiasing that should happen within AGS? surely actual real-time antialiasing would be better.  Ill keep trying things...
« Last Edit: 29 Sep 2013, 18:47 by rickious »
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on one or more games that won an AGS Award!
    •  
    • selmiak worked on one or more games that was nominated for an AGS Award!
Re: improve sprite/background blending. anti aliasing?
« Reply #6 on: 29 Sep 2013, 19:25 »
How do you export the PNGs from your 3D program? It is probably there already where you have to check one checkbox for antialias to transparency.
Show us 2 frames from the walkcycle maybe? Just the way they are before you import them into AGS.

Re: improve sprite/background blending. anti aliasing?
« Reply #7 on: 29 Sep 2013, 19:31 »
Directly fron the 3d software its antialiased against whatever colour background i have, I ideally want AGS to antialias real time, so its not just a PNG with a faded edge.

Im testing different levels of a feathered edge until It looks ok.  hopefully I can find something this way unless someone can tell me how to AA real-time in AGS (if possible)
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on one or more games that won an AGS Award!
    •  
    • selmiak worked on one or more games that was nominated for an AGS Award!
Re: improve sprite/background blending. anti aliasing?
« Reply #8 on: 29 Sep 2013, 19:52 »
Well, you should use a transparent background color within the 3d software then. AGS accepts transparent PNGs with alphatransparency but when the edges of your character are already antialiased against black or whatever BG color you use AGS will only render completely black pixels as transparent when you chose that as the transparency color and AGS won't magically substract the black from 'dirty' black pixels that are a mix of background black and your character and that should be antialiasing.

Andail

  • Global Moderator
  • Global Moderator
  • Mittens Viscount
  • Cultured man of mystery
    • I can help with backgrounds
    • Andail worked on one or more games that won an AGS Award!
    •  
    • Andail worked on one or more games that was nominated for an AGS Award!
Re: improve sprite/background blending. anti aliasing?
« Reply #9 on: 29 Sep 2013, 20:42 »
Yup. Ideally, you draw your image on a separate layer. You can then make the background layer invisible and your png can be imported properly with the alpha channel.

Re: improve sprite/background blending. anti aliasing?
« Reply #10 on: 29 Sep 2013, 22:10 »
So what im asking is,
is there is no true antialiasing of sprites within AGS? I dont mean alpha layers, I mean actual in-game real-time antialiasing.

If not thats fine, ill just do it pre AGS, its just so I know how to proceed.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Done, figured out a nice effect with photoshop, made a macro and ran all the sprite frames through it, im pretty happy with the new version. much smoother.  May still try and refine it further for the full version of the game.  Just working on the demo at the moment.  I think I could manually neaten up the edges on the standing frames and get away with it while walking otherwise.

Cheers for your help guys.

Here is a screenie with a comparison...

--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Snarky

  • Global Moderator
  • Global Moderator
  • Mittens Lord
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: improve sprite/background blending. anti aliasing?
« Reply #12 on: 29 Sep 2013, 23:04 »
is there is no true antialiasing of sprites within AGS? I dont mean alpha layers, I mean actual in-game real-time antialiasing.

The question doesn't really make sense: alpha transparency along the edges is true sprite antialiasing. How else would you want to do it?

From your description and screenshot, it looks like you're feathering the edges in Photoshop? Like selmiak and Andail told you, the Right Thing would be to render the frames to a transparent background in the first place (either with antialiasing in the render, or at a higher resolution and then scaling it down). The edges would look sharper yet smooth, and you wouldn't get those traces of black.
« Last Edit: 29 Sep 2013, 23:07 by Snarky »

Re: improve sprite/background blending. anti aliasing?
« Reply #13 on: 30 Sep 2013, 00:05 »
Hi Snarky.  Ideally, yes, Id render the character with a transparent background, frustratingly the renderer wouldnt save alpha layer pngs at the lower settings, and at the higher settings I really didnt like the look of the render :undecided:.  Ill have to readdress this later on, ill get stuck into the scripting, story etc for now and go back to the character renders as ill have to redo them properly.  Half-ass has its place, but id rather it not be in this game (nod)

Cheers Snarky and all.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Re: improve sprite/background blending. anti aliasing?
« Reply #14 on: 30 Sep 2013, 20:18 »
Just out of curiosity, what was the nice effect in Photoshop you ran your images through?

Re: improve sprite/background blending. anti aliasing?
« Reply #15 on: 30 Sep 2013, 20:26 »
Honza
Specifically I selected all the background, then used 'refine mask' to add 1px feather, 25% contrast, 50% shift edge.  That gave me a good enough effect.  I will manually tidy up the standing poses, the walking ones shouldnt matter.  Not quite as good as a re-render with proper transparent anti-aliasing, but more than good enough.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on one or more games that won an AGS Award!
    •  
    • selmiak worked on one or more games that was nominated for an AGS Award!
Re: improve sprite/background blending. anti aliasing?
« Reply #16 on: 30 Sep 2013, 20:59 »
Just tell us what 3D Software you use, I don't know much about 3d software, but someone here will probably know how to render your character antialiased on a transparent background. That makes it look better and saves you from running every frame through your Photoshop actions.

I already had the character so it was infinitely faster to fix with photoshop than re-rendering.  If I decide that it isnt good enough, i can always re-render.

But so you know, its DAZ3d I used for the character, the transparent backgrounds thing is a common issue.  It works on a certain renderer (which makes the character look like a waxwork or a very good cartoon) but not on the render settings I use which I think fit my VRay rendered backgrounds.

Im happy enough with this for now.  I need more gameplay at the moment, I can re-import the character later, or after the demo version.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
ok rickious i know you said you're happy, but the solution to your issue is just around the corner, and it stresses me that you don't understand what selmiak says, and believe it's complicated. :D

What you're doing so far :
- in DAZ, you render your sprite on a black background.

What you should do :
- In DAZ, render your sprite on a transparent background.
Alternative solution :
- in DAZ, render your sprite to any multi-layered format (E.g. photoshop, or TGA). Then open the result image with any paitning program (e.g. photoshop), delete the background layer, and save it again as .PNG


If you succeeded and rendered your sprite on a transparent background, then here is how to make sure it happened properly : just open in it any painting program, and change the background color. Then your sprite should still look antialiased and smooth.

I bet you that if you do the same thing with your faulty sprite (the one that has dirty black outlines) and open it in your painting program, then changing the background color will show the black outline.
 

I do understand transparent backgrounds and have used them for years in many ways, but as I have said, the specific render mode I am using in DAZ will not save with the transparent background.  There is another render mode, but it makes the images look far less realistic, plasicky.  So until DAZ fix that common problem, there are not many options.

So I apericiate what you are saying, and im less than happy, but 'satisfied'.  For now at least.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!