Sign in to follow this  
riuthamus

Alpha Rendering

Recommended Posts

JTippetts    12950
Filtering from the background color of the texture as it is down-sampled, most likely. With these things, it is best if you use a background color that is very near to the color of the solid region, rather than some color like white or black.

Share this post


Link to post
Share on other sites
Ashaman73    13715
Try to use [url="http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx"]pre-multiplied alpha [/url]or expand the color on the RGB channels, don't use white as filler for green grass.

Share this post


Link to post
Share on other sites
riuthamus    8365
you know, telanor linked me that, and i asked him, what does that mean for me.... as the art guy?

and I have tried to use the Alpha 1 channel in photoshop with a green background for the base thing and it doesnt seem to work. Edited by riuthamus

Share this post


Link to post
Share on other sites
Ashaman73    13715
I don't own photoshop, so either there's a plugin or an option when exporting your texture to a given file format or you need to do it by hand which isn't hard.

In the latter case just add an new layer which contains the alpha channel of your texture as greyscale image without alpha. Then set the layer to multiply. Now the image, when alpha is turned off, should be black where the alpha is 0, that's all.

PS: you need to change the blending in your game engine. Edited by Ashaman73

Share this post


Link to post
Share on other sites
Ashaman73    13715
Does your engine already support pre-multiplied alpha ? This would explain the bright borders, in this case you really need to multiply your RGB image with an additional RGB layer where each channel equals the alpha channel of your source image.

In photoshop do the following
1. You start with source image =(Rs,Gs,Bs,As)
2. Add new layer on top of it with (As,As,As,white)
3. Set layer to multiply. Edited by Ashaman73

Share this post


Link to post
Share on other sites
NxLeaf    138
which platform and API are you using. D3D.OPENGL etc.
have you opened the alpha test mode. and closed the alpha blend mode.
the when the bttmap tried to sample the value of a pixel. it will regard the value of you pic 's background.
especially your pic's background is whrite. and ou set it as alpha 0.
but when you tried to access it when your alpha blend mode is closed. you will get this result.

Share this post


Link to post
Share on other sites
NxLeaf    138
and my email: [email="boyue@rocketmail.com"]boyue@rocketmail.com[/email]
if you have any problem to discuss with.
i wanna to be the vonenteer.

Share this post


Link to post
Share on other sites
Kaptein    2224
i have to amend, if i may, that photoshop is bad for spriting
it makes simple things complicated because its built for non-pixel artwork
try graphics gale for example :)
and yes, the alpha channel of your textures should be _green_ because the outline of your sprite is green!
when spriting you need fast access to alpha channel to be effective, and this can of course be done in photoshop
its just very very inconvinient..

Share this post


Link to post
Share on other sites
riuthamus    8365
interesting, I more or less knew option A, tried it and it didnt work in game. ( suggesting that our code end is doing something wrong ) I did not know how photoshop was saving out png's though and that is some seriously good information to know.

Share this post


Link to post
Share on other sites
take a look to this tutorial:

http://www.youtube.com/watch?v=oh2WGL8hvPo&feature=g-u-u&context=G2c3deb0FUAAAAAAAcAA

just ignore the part related to UDK and focus in the creation of the alpha channel in photoshop, not in a million years I would figure out this very explicit and efective way to make an alpha channel.

The initial problem in the video looks close to your problem.

Cheers.

Share this post


Link to post
Share on other sites
riuthamus    8365
So, i have tried the setup that Hodgeman suggested and it ends up that it works! although it has a small issue.

[img]http://www.bhslaughter.com/forum/uploads/gallery/category_8/gallery_1_8_43950.jpg[/img]

Anyway, thanks for the help so far, here is what it looks like from afar, keep in mind that this is by no means the final version of what this will look like:

[img]http://www.bhslaughter.com/forum/uploads/gallery/category_8/gallery_1_8_14643.jpg[/img]

Lastly, i plan to try the method that you linked Wilson and see if that removes the issues associated the the slightly rough edges.

Share this post


Link to post
Share on other sites
Wyrframe    2426
That "small issue" is happening because you haven't sorted your transparent objects to be drawn from back to front. You're drawing the one in the foreground first, and even though it's transparent there, it's still nonzero alpha, and so it makes writes to the z-buffer. When the one behind it is drawn, it is not drawn "overtop" of the nearer geometry.

While I'm mentioning it, opaque objects (those with no alpha whatsoever) should be sorted to draw from front to back, to take advantage of Z-occlusion, instead of being repeatedly overdrawn and wasting shader cycles.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this