blending artifacts

HEllo!

I’ve notice some image quality problems when using blending:
http://www.stud.uni-goettingen.de/~npovala/blending.jpg (68 kb)

The blending mode is

glBlendFunc(GL_SRC_ALPHA, GL_SRC_ONE_MINUS_ALPHA)

the texture is compressed with ARB_texture_compression, and contains an alpha channel. Color depth doesn’t play any role (both 16 and 32 bit produce the same image). backface culling is disabled, depth buffer writes are disabled also, The artifacts appear with 6.50 drivers as well as with 12.41, hardware is GF 1 DDR. Texture env mode is GL_ADD. mipmapping enabled (trilinear).

Now i think I gave all the information that could be relevant, so what may be the problem?

Thanks in advance,
-Lev

You are being sure to draw the polygons in back to front order and they’re not so close together that they’d fight in the depth buffer?

–Zeno

Are you using a compressed format that supports an alpha channel? Some compressed formats don’t offer much variation in the alpha channel (some only give one bit of alpha).

I’m drawing just 1 object, so depth buffer should not be a problem since depth buffer writes are disabled. I’ve even disable the depth test - problem persists.

And as far as texture compressino goes - I turned it off and set texture format to GL_RGBA8 and the artifacts remain!

I’ve really no ideas what it could be, so further suggestions are very appreciated!

Cheers,
-Lev

Given the fact that you mention blending in your 1st post, I assume this is a two pass render you’re doing?

If so, try this. On the 1st pass enable Z writing, and depth Testing, with depth function GL_LESS. On the 2nd pass, disable only the writing, and set the depth function to GL_EQUAL.

If you do that, with no texture compression, and anything else dodgy then it should work. If it doesn’t get back to us, maybe let others run the program to see if it’s your system??

Nutty

This is ust 1 pass very simple blending! Now what i’ve noticed that with GL_SRC_ALPHA as source factor and GL_ONE as destination factor the image quality is just fine! No artifacts at all! So some blending modes give artifacts, others dont, this seem very very strange to me.

i’ll upload my program and then post here so that you can see if it looks the same on other systems.

-Lev

i’ve uploaded an exe which demostrates the problem:
http://www.stud.uni-goettingen.de/~npovala/blend.zip (505 KB)

extract the files, launch the exe, in the file menu choose load mesh and load fighter.mesh now choose load shader and load blenderror.shd.

On my system I can see image errors at this stage. So if everything looks fine on your system this might be a driver bug on mine

You can also load geosphere.mesh this is the model I used to create the image I posten in this thread before.

The app is in development, so many bugs exist. It make use of ARB_texture_compression, NV_vertex_array_range, ARB_texture_env_add, ARB_texture_env_combine, ARB_texture_env_dot3 if they are available.

The only required extension is ARB_multitexture.

-Lev

I always forget things
One more thing to say: the program creates a key CURRENT_User/Software/Shader Editor, so don’t forget to delete the key after you delete the app if you want to keep your system clean!

Cheers
-Lev

It really seems like to me you just aren’t sorting your polygons correcly. You realize you have to do this even within a single object.

The fact that additive blending modes DO work correctly supports this claim.

– Zeno

hmm it seems to me that this is looking like it is supposed to look when using TexEnv GL_ADD and blending…just use GL_REPLACE

Chris (noch a bisserl müd…)

My objects looked the same as I tried transparent modes. It is in fact the z-sorting, that makes the problem here. Just activate backface culling to prove it. As this is a convex object, there should be no overdrawing after activating it. Then the artifacts should be vanished.

hm, bad thing, i’ guess i’ll have to live woth additive blending or no blending at all. Ok, anyway, thanks for the hints, guys!

-Lev