multitexturing using alpha-blended layers

Blitz3D Forums/Blitz3D Programming/multitexturing using alpha-blended layers

JoeGr(Posted 2003) [#1]
From the docs entry for 'TextureBlend':
In the case of multitexturing (more than one texture applied to an entity), it is not recommended you blend textures that have been loaded with the alpha flag, as this can cause unpredictable results on a variety of different graphics cards.

I just wondered how much truth there is in this. I tried it myself and my GeForce2 didn't seem to have any problems. So should it definitely be avoided?


Neochrome(Posted 2003) [#2]
Im my experience. NO. i have three different GFX cards and all three seemed to do this OK tho some slow down does occur on the voodoo and older cards, But not much!


jhocking(Posted 2003) [#3]
I seem to recall problems with texture blending of alpha textures on my hardware (ATI Rage Fury Pro) but I haven't tried it in a while so I can't say for certain.

To clarify, I don't think there is any problem with multi-texturing of alpha textures. The problem is in texture BLENDING (ie. using "multiply" or "add" blend modes.) Just to clarify in case you are getting the general case confused with the specific case.


Binary_Moon(Posted 2003) [#4]
There shouldn't be any problem with multiply or additive blending. Multiply is the default blend mode when multi texturing so if that went wrong I don't know where we would be.

Joe - The best thing to do would be to post a small demo and see wether anyone complains or not. Personally I would just add it and only take it out if there are problems. Either that or make it an optional special effect.


JoeGr(Posted 2003) [#5]
Thanks for the replies everyone.

I don't think there is any problem with multi-texturing of alpha textures. The problem is in texture BLENDING (ie. using "multiply" or "add" blend modes

jhocking, I'm not sure what you mean by that - the docs make no mention of problems with 'multiply' or 'add' (modes 2 and 3 respectively). I'm using mode 1, confusingly described as 'no blend or alpha'.

To clarify, what I'm doing is applying an ordinary opaque texture to the default layer (0) in the normal way. Then I'm loading a .png with alpha information (using flag 2) and applying it to texture layer 1. At this point if I run the code, the object will appear completely black. But if I use TextureBlend mode 1 on the second texture, it all works correctly, ie the first texture shows through transparent areas in the second.

Personally I would just add it and only take it out if there are problems. Either that or make it an optional special effect.

Thats sensible advice BM, but this is quite fundamental to my game, so I need to make the right choice now (at the beginning) really.


jhocking(Posted 2003) [#6]
The documentation is actually pretty clear in this case (rare for the command reference.) It says you shouldn't blend alpha textures; as it's description specifies mode 1 is not blending. There's also nothing confusing about 'no blend or alpha;' those are just alternative names for the mode. Mode 1 is no blending, meant for use with alpha textures.


JoeGr(Posted 2003) [#7]
Ah, now I see. At last! Got it. Thanks a lot for explaining this. So what I'm doing should be fine. Man, I wish the docs explained things properly.


jhocking(Posted 2003) [#8]
Glad to help but I caution you against taking my word as gospel (here or elsewhere.) I didn't say I'm 100% sure there isn't any problem with multi-texturing of alpha textures, I just seem to recall the problem was specific to blending and not multi-texturing in general.