Multiple texture brush bug!

Archives Forums/Blitz3D Bug Reports/Multiple texture brush bug!

Boiled Sweets(Posted 2005) [#1]
Hi I think I have found a bug...

I have an a mesh with 3 surfaces (its a cube - the top face is surface 1, the bottom face is surface 2 and the sides are surface 3. I then create a brush and set the first 2 brush layers to different textures.

Then I paint each surface with the brush. Up to now all is fine. The cube has the right textures on each surface.

However if I half alpha the entity out it 'disappers' and only the 2nd brushes texture is visible.

I shall try and create a code example but has any one hit this problem?


Boiled Sweets(Posted 2005) [#2]
It appears to be related to the fact that I load the 2nd texture (the crack.jpg) with a flag of 4 - if I don't then all is ok. Why is this?


; CreateCamera Example
; --------------------

alpha# = 1

Graphics3D 640,480
SetBuffer BackBuffer()

; Create camera
camera=CreateCamera()

light=CreateLight()

cube=map_create_unstable_block()

PositionEntity cube,0,0,5

While Not KeyDown( 1 )

If KeyDown(200)
 If alpha < 1
	 alpha = alpha + 0.005
 EndIf
 EntityAlpha cube, alpha
EndIf

If KeyDown(208)
 If alpha > 0 
	 alpha = alpha - 0.005
 EndIf
 EntityAlpha cube, alpha
EndIf

TurnEntity cube, 0.4, 0.6, 0.9
RenderWorld
Flip
Wend

End



Function map_create_unstable_block()

	m = CreateMesh()
   s = CreateSurface(m) 

	;bottom face 
	v0 = AddVertex(s,-1,+1,+1,0,1)
	v1 = AddVertex(s,+1,+1,+1,0,0) 
	v2 = AddVertex(s,+1,+1,-1,1,0)
	v3 = AddVertex(s,-1,+1,-1,1,1) 
	AddTriangle s,v0,v1,v2
	AddTriangle s,v0,v2,v3 

   s1 = CreateSurface(m) 
  
	;top face 
	v0 = AddVertex(s1,-1,-1,-1,1,0)
	v1 = AddVertex(s1,+1,-1,-1,1,1) 
	v2 = AddVertex(s1,+1,-1,+1,0,1)
	v3 = AddVertex(s1,-1,-1,+1,0,0) 
	AddTriangle s1,v0,v1,v2
	AddTriangle s1,v0,v2,v3 

   s2 = CreateSurface(m) 

	;left face 
	v0 = AddVertex(s2,-1,+1,+1,0,0)
	v1 = AddVertex(s2,-1,+1,-1,1,0) 
	v2 = AddVertex(s2,-1,-1,-1,1,1)
	v3 = AddVertex(s2,-1,-1,+1,0,1) 
	AddTriangle s2,v0,v1,v2
	AddTriangle s2,v0,v2,v3 

	;right face 
	v0 = AddVertex(s2,+1,+1,-1,0,0)
	v1 = AddVertex(s2,+1,+1,+1,1,0) 
	v2 = AddVertex(s2,+1,-1,+1,1,1)
	v3 = AddVertex(s2,+1,-1,-1,0,1)
	AddTriangle s2,v0,v1,v2
	AddTriangle s2,v0,v2,v3 

	; front face
	v0 = AddVertex(s2,-1,+1,-1,0,0)
	v1 = AddVertex(s2,+1,+1,-1,1,0)
	v2 = AddVertex(s2,+1,-1,-1,1,1)
	v3 = AddVertex(s2,-1,-1,-1,0,1) 
	AddTriangle s2,v0,v1,v2
	AddTriangle s2,v0,v2,v3  
	
	;back face 
	v0 = AddVertex(s2,+1,+1,+1,0,0)
	v1 = AddVertex(s2,-1,+1,+1,1,0) 
	v2 = AddVertex(s2,-1,-1,+1,1,1)
	v3 = AddVertex(s2,+1,-1,+1,0,1) 
	AddTriangle s2,v0,v1,v2
	AddTriangle s2,v0,v2,v3 

	UpdateNormals m
	
	crack = LoadTexture("crack.jpg", 4)
	TextureBlend crack, 3
	
	floor_brush = CreateBrush()
	
	BrushTexture floor_brush, LoadTexture("wood2.jpg"), 0, 0
	BrushTexture floor_brush, crack, 0, 1
	
	PaintSurface s, floor_brush

	ceiling_brush = CreateBrush()
	
	BrushTexture ceiling_brush, LoadTexture("wood2.jpg"), 0, 0
	BrushTexture ceiling_brush, crack, 0, 1

	PaintSurface s1, ceiling_brush

	wall_brush = CreateBrush()
	
	BrushTexture wall_brush, LoadTexture("wood2.jpg"), 0, 0
	BrushTexture wall_brush, crack, 0, 1

	PaintSurface s2, wall_brush
	

	Return m

End Function


You'll need 2 texture files...


jfk EO-11110(Posted 2005) [#3]
Maybe it has something to do with the fact some cards don't like to mix alpha and multiplication blending, see versions.txt, the re-implementation of that ability to mix them.