#1 Crossbones+ - Reputation: 2472
Posted 01 October 2012 - 10:17 PM
My game project blog.
#3 Moderators - Reputation: 5021
Posted 01 October 2012 - 10:23 PM
#4 Crossbones+ - Reputation: 2472
Posted 01 October 2012 - 10:39 PM
btw... i looked up some stuff on google and they say i need some SuperPNG plugin to export stuff out of photoshop. Sounds so odd to me....
My game project blog.
#5 Members - Reputation: 4604
Posted 01 October 2012 - 11:09 PM
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
#6 Crossbones+ - Reputation: 2472
Posted 01 October 2012 - 11:10 PM
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, 01 October 2012 - 11:11 PM.
My game project blog.
#7 Members - Reputation: 4604
Posted 01 October 2012 - 11:17 PM
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, 01 October 2012 - 11:17 PM.
#8 Crossbones+ - Reputation: 2472
Posted 01 October 2012 - 11:49 PM
Edited by riuthamus, 01 October 2012 - 11:54 PM.
My game project blog.
#9 Members - Reputation: 4604
Posted 02 October 2012 - 12:50 AM
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, 02 October 2012 - 12:52 AM.
#10 Members - Reputation: 127
Posted 02 October 2012 - 02:53 AM
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.
#11 Members - Reputation: 127
Posted 02 October 2012 - 02:55 AM
if you have any problem to discuss with.
i wanna to be the vonenteer.
#12 Members - Reputation: 636
Posted 02 October 2012 - 03:32 AM
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..
#13 Moderators - Reputation: 13534
Posted 02 October 2012 - 05:36 AM
By default Photoshop has pretty screwy support for PNG files.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.
There's two ways of working with transparency in Photoshop.
1) This is the way you're currently working. You've only got 3 channels (RGB), but photoshop allows pixels to also be semi-transparent (magically) -- it does this without exposing a separate transparency channel. This is normally fine when working on web-pages, etc, but is very bad for games.
The reason is that in games, your image will be loaded into an RGBA texture, and the RGB values of invisible pixels are still very important! e.g. they are used during mip-mapping.
In this mode, Photoshop doesn't care about the colour values of invisible pixels, because it assumes that they'll never be used, but in games they are used. It seems that Photoshop is writing out "white" for transparent pixels with your texture, which is very bad...
2) The alternative is to ensure your background layer is opaque, and to use a new "Alpha 1" to encode transparency. I can convert your file to this mode by ctrl+clicking "layer 0" (select visible pixels), go to channels tab, click 'Save selection as channel'. Then I can add a background layer and fill it with a sensible background color.
However, as you've noticed, Photoshop's default PNG plugin is too stupid to respect this mode, and ignores your alpha channel when saving. You can fix this by deleting png.8bi (may want to keep a backup!) and replacing it with a better one (I forget which one I used to use, but yes I've had to delete png.8bi in the past and replace it with a better version. I assume this is why someone suggested you use SuperPNG -- it allows you to properly save your alpha channel).
Also, because Photoshop+PNG is a bit unreliable in this way, you should never use PNG as a working format (i.e. never open one for editing) but should only use it as an export/final format.
[edit]An alternative is to simply not use PNG files
Once you've fixed your processes so that you can save PNG files that have 'coloured' transparent pixels, you've got two more choices:
A) Design your image to be drawn with "traditional alpha blending", by ensuring that transparent pixels have the same colour as their closest opaque pixel. In your case, you can do this by adding a green background layer, though in the general case you have to use a process called 'dilation'.
B) Design your image to be drawn with "premultiplied alpha blending", by ensuring that transparent pixels are black. You can do this by adding a black background layer.
These two options look like:

On the code side, if you choose (A), your graphics programmer needs to use the blend mode of src=SrcAlpha, dst=InvSrcAlpha or if you choose (B) they need to use the blend mode of src=One, dst=InvSrcAlpha.
Both are valid choices. Traditionally (A) is more popular, but I personally prefer (B) because it's simpler and is also compatible with DXT1 compression.
Edited by Hodgman, 02 October 2012 - 05:45 AM.
#14 Crossbones+ - Reputation: 2472
Posted 02 October 2012 - 07:56 AM
My game project blog.
#15 Members - Reputation: 205
Posted 02 October 2012 - 12:52 PM
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.
#16 Crossbones+ - Reputation: 2472
Posted 02 October 2012 - 05:14 PM

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:

Lastly, i plan to try the method that you linked Wilson and see if that removes the issues associated the the slightly rough edges.
My game project blog.
#17 Members - Reputation: 707
Posted 03 October 2012 - 09:22 AM
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.
(( This email has been quad-ROT13 encrypted. Reading it violates the DMCA. ))
(( 我说很少的汉语,还我的语法平庸, but at least I'm UNICODE-compliant. ))
#18 Crossbones+ - Reputation: 2472
Posted 03 October 2012 - 11:54 AM
My game project blog.







