Clamp UVs versus Multiply Blendmode !?!
Blitz3D Forums/Blitz3D Programming/Clamp UVs versus Multiply Blendmode !?!
| ||
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? |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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? |