Multitexturing and alpha
BlitzMax Forums/MiniB3D Module/Multitexturing and alpha
| ||
Hi, I have a couple of textures (size 8x8 pixels) which I want to blend over each other. Each texture is a part of a character, for instance I have one texture for the head, one for the body and so forth. The textures contain large areas of transparent areas (more than half of the head texture is alpha etc.) I use this code below to render the textures to a cube (for debugging): Import sidesign.minib3d Strict Graphics3D 640,480 Local camera:TCamera=CreateCamera() MoveEntity camera,0,0,-3 AmbientLight 255,255,255 Local cube:TMesh=CreateCube() Local tex1:TTexture=LoadTexture("media/pic1.png", 2) Local tex2:TTexture=LoadTexture("media/pic2.png", 2) TextureBlend tex1,1 TextureBlend tex2,1 EntityTexture cube,tex1,0,0 EntityTexture cube,tex2,0,1 CameraClsColor(camera, 0, 0, 255) While Not KeyDown(KEY_ESCAPE) If AppTerminate() End TurnEntity(cube, 0, 0.1, 0) RenderWorld Flip Wend Without the fix presented here: http://blitzbasic.com/Community/posts.php?topic=94623 this does not work at all, just leaving a black cube. Using the fix, the textures blend fine, but all transparent areas now become white. Any one got a hint here? EDIT: Media: ![]() ![]() Last edited 2011 |
| ||
I'm probably wrong, but you might need to make sure the entity is using alpha blending, i think that's entityFX 32. Cheers Charlie |
| ||
Naw that didn't do anything. Thanks for the suggestion though. |
| ||
Your base color may be white. If you need a texture as the base, set the TextureBlend(0) Then with the fix (GL_DECAL), TextureBlend(1) for textures on top layers. The problem with gl_decal, is it isn't affected by opengl lights. |