Clamp UVs versus Multiply Blendmode !?!

Blitz3D Forums/Blitz3D Programming/Clamp UVs versus Multiply Blendmode !?!

jfk EO-11110(Posted 2007) [#1]
I have a problem with the Multiplying Blendmode. Although I set the textureflags 48 to clamp UVs, there's still a dark border on the textured quad. The texture is a dds dxt1. The idea is to use simple shadow "blobs" on some quads, but I don't want to use ordinary alpha blending due to z-fighting.

Clamp UVs works well as soon as I use the blendmode 3 (additional), but gives the dark seam in blendmode 2 (multiply). Is this a known "feature", or am I doing something wrong here?


Stevie G(Posted 2007) [#2]
Never used dxt1 but do pgn / jpg textures work? If not, the only thing possible would be your texture uv's being slightly out. Do you offset the coords by .5 / TextureWidth() and .5 / TextureHeight? If not, this could be your issue.


jfk EO-11110(Posted 2007) [#3]
Thanks Stevie. It turned out I have to use the alpha flag when loading, so the texflags are 2+16+32. This way it works, but unfort. using this blendmode instead of alpha does not solve z-fighting troubles with other alpha-blended things as I used to hope.

Any ideas how to solve this? (other than lightmapping)

Thinking... Based on Beakers Z-Sort source and some studies of mine I guess somebody should try to write a function that is able to do the following:

-check a list of all loaded meshes for alpha transparent parts
-write their handle to a list that is sorted by the positions
-reposition them using the sorted list

This could - maybe - fix some of z-fighting problems.


Stevie G(Posted 2007) [#4]
Have you tried using the mutiply blending mode on the quad and load the texture normally, without alpha?

Does this BMP texture work using this method?

http://www.steviegoodwin.plus.com/images/Shadow.bmp

Sorry if this doesn't help.


jfk EO-11110(Posted 2007) [#5]
I didn't try a bmp so far, but I think it's about the same as a dds dxt1 without alpha. I used to hope the Multiply mode or the Additive mode would be z-sorted correctly, but they are exactly the same as the alpha blending mode.

yes I tried Multiply blendmode without alpha flag, that's where the mysterious seam appeared, so I had to add the alpha flag. Tho, gotta test it again to see of the z-order problem is caused by the alpha flag only...

Thanks for your help.


Barliesque(Posted 2007) [#6]
I'm going to guess that the seam is there even in additive blending mode, but is just much harder to see.

Does your image have any transparency, or is it flattened? In Photoshop, is there just one layer called "Background" in Italic? If you have just one layer, but the image hasn't been flattened, then there is an alpha channel. If that's the case, try flattening the image, and then closely check the color values at the image's edges for any signs of a border.


jfk EO-11110(Posted 2007) [#7]
There are several layers. The top layer is fully opaque. The dds exporter additionally doesn't export the alpha channel in DXT1 mode. I also checked the edges, it's $ffffff, as it should be. Now there's even one more strange thing about: When I set EntityFX to 1(fullbright) then the whole thing is darker and things that should be fully transparent aren't. Contrary to EntityFX zero, that will look brighter than the fullbright mode! It also seems with FX zero the seam is disappeared. More and more I think Multiply Mode isn't really exact science.


Barliesque(Posted 2007) [#8]
There are several layers.

Do you mean in your PSD file, or in the DDS you create from it? I'm sure you must be talkign about the PSD... DDS does not preserve all those layers. However, if your original is in layers, the exporter will export an alpha channel--even if your top layer is totally opaque.

So, before you export to DDS, try flattening the image.


jfk EO-11110(Posted 2007) [#9]
Ok thanks I'll try that. Although, I can't imagine why the dds exporter would use the alpha channel when you chose DXT1 that doesn't contain alpha.

Basicly the problem is a z-sorting problem and I couldn't solve it with multiply-blending. I just remember somebody said if there is a further texture layer that is masked and totally transparent then the z-sorting will work again. Anybody who can confirm this?