Update

Previous topic - Next topic

Qube

Quote from: MrTAToad on 2011-Dec-03
But over a non 3D object, anti-aliasing is okay (discounting the extra anti-aliasing that Paint introduces)..

Sorry, even with 10.191 and using the files I provided in my original post alpha is still wrong in plain 2D (no overlapping of 3D) :rant:

Using the example I posted with the original files, here's the result.

Here's 10.118 - Perfect



Here's 10.191 - Duff


Wampus

My anti-aliasing is not okay. Example:-



[attachment deleted by admin]

MrTAToad

#152
Do you have anti-aliasing active in your graphic drivers control panel ?  I wouldn't be surprised if its caused by some setting there

Qube

Quote from: MrTAToad on 2011-Dec-03
Do you have anti-aliasing active in your graphic drivers control panel ?

I do not, no. The messed up alpha shows up on the iPad too.

MrTAToad

#154
I have mine on - although I did try with it all off, but got more or less the same thing.

Dont know why yours is different to mine.  But if it does the same on the iPad then obviously its not just a Windows problem.

Qube

Quote from: MrTAToad on 2011-Dec-03
I have mine on - although I did try with it all off, but got more or less the same thing.

Dont know why yours is different to mine.

Dunno, strange. Are you using my original test sprite or the one Gernot jiggled?. I see that setting smooth shading to false still fixes this issue but rotation naturally shows jaggies. So annoying  :P

Wampus

I'm sure its not 3D card settings. The same thing happens on my Android, my iOS device and my other computers too. If I change GLBasic versions to 10.118 it doesn't happen, on any of those devices/computers. Settings like this on my graphics card can create a smoother look but the anti-aliasing to transparency still isn't happening in GLBasic:-

[attachment deleted by admin]

MrTAToad

#157
Ah yes, I was using Gernot's one rather than yours, which would it a bit...

Wonder if the glBlendEquation/glBlendFunc value has been changed

[attachment deleted by admin]

Kitty Hello

I cant find any differences. I even dumped the opengl calls formthe old version.
With alphatesting 0.5 or even 0.7 the image should scale nicely thought. Did you try ma examlemwith alphatesting?

Qube

Quote from: Kitty Hello on 2011-Dec-05
With alphatesting 0.5 or even 0.7 the image should scale nicely thought. Did you try ma examlemwith alphatesting?

I have tried alphatesting settings and it just knocks out alpha'd pixels. This is not the answer as you *need* the full alpha information as-is in the PNG file especially when using ALPHAMODE 1 to blend the nebula effects. Knocking out alpha info on those along causes a right mess.

Quote from: Kitty Hello on 2011-Dec-05
I cant find any differences. I even dumped the opengl calls formthe old version.

Try harder  :whip:  :nana:


Wampus

Hmm. Maybe its not OpenGL at all. Maybe something has changed with the loading of sprites. Could that be a possibility?

Just in case it is that I'm going to run a little test to get 10.118 to save sprite information using SPRITE2MEM. Then I can read the data back using MEM2SPRITE in the most recent GLBasic update and see if the same problems occurs. I'll post the code and the results here as soon as I'm done.

Wampus

#161
Darn. There seems to be a bug with 10.118 when it comes to SPRITE2MEM that was consequently fixed. All sorts of nasty is happening when I use it om 10.118. I know it worked in older versions because sample code I have from back in version 8. The trouble is I can't find a download of an older version (8, ideally) and I've deleted my back ups of the old installers. Anyone know where I can get one?

EDIT: Its ok, I found one.

EDIT AGAIN: I don't think its the loading of sprites anyway since data saved in version 10.191 works fine when loaded into 10.118 via MEM2SPRITE.

Wampus

SUCCESS!  :happy:  After testing I found that the loading of sprites is definitely not the problem. I was going to post the code but then I started a new test. What I found finally tracked down the underlying issue. I far as I'm concerned the antialiasing issue is finished with now and there was nothing wrong with GLBasic.

Thanks for trying to fix this Kitty. Whatever changed between 10.118 and later versions I don't think it matters. It seems 10.118 was alpha blending edges of sprites with a dark blue instead of white and that was the big difference. I know to some that might sound like it simply can't be all it was. Well, the attached code to this post demonstrates what I said is the case without doubt. Compile it in 10.118 and later and you will see for yourself.

What the attached code does is display 4 scaled sprites in turn with SMOOTHSHADING turned off and on for demonstration purposes. The first two sprites, box32A and box32B, show weird blue borders in 10.118 and white borders in versions beyond 10.118. The second two sprites, box32C and box32D, have RGB values as well as a little alpha value added to the empty areas around the edges of the sprites. The result is that they work perfectly in 10.118 and later versions.

Basically, to fix this you must create sprites to take into account that OpenGL wants to know what colour empty spaces around sprites should be. I don't know why it wants to know that, but it does. If you really want to have sprites scale or rotate with perfect alphablending at the edges then you have to make sure the pixels around the edges of your sprites have alpha channel information and an RGB value that would blend nicely. This goes for 10.118 as well as later updates. It works 100% in all alpha modes and with any kind of sprite. No problems occur and there is no need for the ALPHATESTING command.

A quick way to make the fix in Photoshop is to make a copy of your sprite and put this copy in the layer below your sprite. Next, apply a Gaussian Blur of 1.1 pixels to the copied sprite layer. Finally, reduce the opacity of the copied sprite layer to 1% (making it virtually invisible but retaining the blurred colour information. Save this as a PNG file and your alpha blending will work.

Please note that its a good practice to include an empty border of 2 pixels, 1 at the least, around each sprite if you're using a textureatlas. If you've done this then the above method will not cause any colour clashes with transparency of other sprites if applied to the entire textureatlas.

I know that is all probably clear as mud. If people feel they could benefit from it I could find time to create a short tutorial at some point, but that won't be before sometime next week because I am crazy busy.

[attachment deleted by admin]

fuzzy70

Nice one Wampus  :nw:

I have no idea what a textureatlas is but I understood the rest of it (am still playing with other things in GLB at the moment) :D

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Ruidesco

It's basically a big graphics file where you include a whole sprite set, instead of having them in separate smaller files.
A quick simile would be having the current standard GLBasic bitmap font file where every character is there, versus having each character in their own file.