forum

Osu Storyboard Alpha Blending

posted
Total Posts
8
Topic Starter
funnytrees
I'm working on a Java implementation of the osu storyboard using JOGL, and I've run into an issue with transparent images.

Example:

I have the background:

And the image to be overlaid:

And it is rendered as:

I am using glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA).
Depth test is disabled.

Fully transparent portions of images seem to work fine, just the partially transparent ones have issues.
Partial transparency with glColor works fine.

Anyone know why this is or what I may be doing wrong?
Muffin_Button
...
are the images the same size...
Muffin_Button
ooohhh heh sorry I missed the logo there...
are you sure that the image you load has an alpha channel?
since you are using java, try rendering that same scene with bufferedimage

if that does work, then it might be an issue similar to how sdl cannot mix per image alpha and per pixel alpha
jemhuntr
this... map... that white box breaks the starting text of songs. Now I know why. (Apparently that white box goes on top of the text)
peppy
have you enabled blend in the first place?
glEnable(GL_BLEND)
Topic Starter
funnytrees
Yes, blending is enabled, and works for most other transparent images.

After a bit of more searching and testing, it seems like the problem lies with "premultiplied alpha" textures, where the colors are automatically scaled from 0 to the alpha value.
peppy
You can support these by changing the blend method you are using, but at the end of the day you will need extra processing or a manual toggle for it. As the performance gain is relatively low (and I'm 99% sure osu! won't support it), you should just avoid using premultiplied alpha images :P.
Topic Starter
funnytrees
Thanks for the advice!

The Texture class included with JOGL seems to automatically multiply alpha, so I'll probably write an equivalent one to avoid it.
Please sign in to reply.

New reply