Adventure Game Studio

Creative Production => Critics' Lounge => Topic started by: rickious on Sun 29/09/2013 17:35:10

Title: improve sprite/background blending. anti aliasing? [SOLVED]
Post by: rickious on Sun 29/09/2013 17:35:10
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...
(http://www.rickious.com/images/body_pharm_screenshots/001.jpg)
Title: Re: improve sprite/background blending. anti aliasing?
Post by: DoorKnobHandle on Sun 29/09/2013 17:43:15
AGS does support 'levels' of transparency, look for "Alpha blended sprites" in the manual.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: rickious on Sun 29/09/2013 17:44:10
Excellent thanks.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: rickious on Sun 29/09/2013 18:09:00
QuoteIt'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.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: Andail on Sun 29/09/2013 18:17:01
If you have a png image with alpha channel, ags should automatically suggest that it be imported with the alpha channel. Does that happen?
Title: Re: improve sprite/background blending. anti aliasing?
Post by: rickious on Sun 29/09/2013 18:23:22
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...
Title: Re: improve sprite/background blending. anti aliasing?
Post by: selmiak on Sun 29/09/2013 19:25:26
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.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: rickious on Sun 29/09/2013 19:31:09
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)
Title: Re: improve sprite/background blending. anti aliasing?
Post by: selmiak on Sun 29/09/2013 19:52:15
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.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: Andail on Sun 29/09/2013 20:42:07
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.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: rickious on Sun 29/09/2013 22:10:04
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.
Title: Re: improve sprite/background blending. anti aliasing? [solved}
Post by: rickious on Sun 29/09/2013 23:02:39
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...

(http://www.rickious.com/images/body_pharm_screenshots/006.jpg)
Title: Re: improve sprite/background blending. anti aliasing?
Post by: Snarky on Sun 29/09/2013 23:04:45
Quote from: rickious on Sun 29/09/2013 22:10:04is 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.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: rickious on Mon 30/09/2013 00:05:59
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.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: Honza on Mon 30/09/2013 20:18:10
Just out of curiosity, what was the nice effect in Photoshop you ran your images through?
Title: Re: improve sprite/background blending. anti aliasing?
Post by: rickious on Mon 30/09/2013 20:26:22
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.
Title: Re: improve sprite/background blending. anti aliasing?
Post by: selmiak on Mon 30/09/2013 20:59:28
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.
Title: Re: improve sprite/background blending. anti aliasing? [SOLVED]
Post by: rickious on Mon 30/09/2013 21:40:10
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.
Title: Re: improve sprite/background blending. anti aliasing? [SOLVED]
Post by: Monsieur OUXX on Wed 16/10/2013 19:01:04
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.
Title: Re: improve sprite/background blending. anti aliasing? [SOLVED]
Post by: rickious on Wed 16/10/2013 21:27:40
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.