Brushes and multitexturing
Blitz3D Forums/Blitz3D Beginners Area/Brushes and multitexturing
| ||
Hi all. I'm relatively new here, and I've already learnt a lot from reading various threads that relate to whatever I've been doing at the time. A big thankyou to all the contributors! Unfortunately, I've hit a brick wall... The BrushTexture command mentions that a brush can have 4 texture layers (though people on this forum have mentioned that it actually has 8). Regardless, I just can't get the thing working. I'm trying to use the example code for BrushTexture, with a couple of minor modifications. When I run the code below, I get a cube that is almost black, and the circle and square seem to have combined in a weird way, but are barely visible on the cube. circle.png is just a green circle on a black background. square.png is a red square on a black background. Both png's are 256x256 pixels. Can anyone point me in the right direction? Thanks very much for any help. Graphics3D 640,480,32,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,90,0,0 cube=CreateCube() PositionEntity cube,0,0,5 tex=LoadTexture( "c:\circle.png") tex1=LoadTexture("c:\square.png" ) brush=CreateBrush() BrushTexture brush,tex,0,0 BrushTexture brush,tex1,0,1 PaintMesh cube,brush While Not KeyDown( 1 ) pitch#=0 yaw#=0 roll#=0 If KeyDown(208)=True Then pitch#=-1 If KeyDown(200)=True Then pitch#=1 If KeyDown(203)=True Then yaw#=-1 If KeyDown(205)=True Then yaw#=1 If KeyDown(45)=True Then roll#=-1 If KeyDown(44)=True Then roll#=1 TurnEntity cube,pitch#,yaw#,roll# RenderWorld Flip Wend End |
| ||
Check out the TextureBlend() command. The default blend is multiply, and if I understand correctly red (255,0,0) multiplied by green (0,255,0) is black (0,0,0). Note that if you use alpha blending make sure your PNGs have alpha information saved. Forum codes are found at the bottom of the faq: http://blitzbasic.com/faq/faq_entry.php?id=2 |
| ||
Thanks octothorpe. Red+Green makes perfect sense now that you mention it. I'll try it shortly. [EDIT] It works!!! TextureBlend gave me what I needed! All I was missing was: TextureBlend tex1,3Also, thanks for the link to the forum codes. I've edited my original message accordingly. |
| ||
Glad I could help, welcome aboard! :) |