Textureblend 2 masked textures?

Blitz3D Forums/Blitz3D Programming/Textureblend 2 masked textures?

Boiled Sweets(Posted 2006) [#1]
Hi,

this is making me go crazy. All I am trying to is create a star field with 2 textures. The skybox is red and the 2 star fields should be as they are but the black background transparent so you can see the red skybox.

WHY IS THIS NOT WORKING? I HAVE TRIED ALL COMBOS OF ENTITYTEXTURE ETC. HELP!!!

Global g_game_star_texture_inner_rate = 2

	Graphics3D 800,600

	; spacebox
	g_spacebox = CreateCube()
	EntityColor g_spacebox, 255,0,0
	ScaleMesh g_spacebox,70000,70000,70000
	EntityFX g_spacebox,9
	EntityOrder g_spacebox, 10
	EntityAlpha g_spacebox,1
                FlipMesh g_spacebox ; edit!

	g_game_camera = CreateCamera()
	CameraRange g_game_camera, 1,500000;1700000
	CameraFogMode g_game_camera, 1
	CameraFogRange g_game_camera, 500,160000

	
	g_game_star_texture_inner2=CreateTexture(512,512,13)
	SetBuffer TextureBuffer(g_game_star_texture_inner2)
	ClsColor 0,0,0
	Cls
	For i=0 To 9000
		Color 255,255,255
		Plot Rnd(512),Rnd(512)
	Next

	SaveBuffer(TextureBuffer(g_game_star_texture_inner2), "stars1.bmp")

	SetBuffer BackBuffer ()

	; inner world 
	g_game_world_inner=CreateCylinder(8, 0, g_game_player)

	g_game_star_texture_inner1 = LoadTexture("stars1.bmp")
	g_game_star_texture_inner0 = LoadTexture("stars1.bmp")

	TextureBlend g_game_star_texture_inner0,2
	TextureBlend g_game_star_texture_inner1,3

	ScaleTexture g_game_star_texture_inner0,1.4,10
	EntityTexture g_game_world_inner,g_game_star_texture_inner0,0,0
	ScaleTexture g_game_star_texture_inner1,2,10
	EntityTexture g_game_world_inner,g_game_star_texture_inner1,0,1

	FlipMesh g_game_world_inner
	ScaleEntity g_game_world_inner,25000,100000,25000	
	RotateEntity g_game_world_inner, 90,0,0
	PositionEntity g_game_world_inner, 0,0,120000
	EntityFX g_game_world_inner,9
	EntityAlpha g_game_world_inner, 1
	EntityOrder g_game_world_inner,2

While Not KeyDown(1) 
	g_game_background_pos# = g_game_background_pos# + 0.0001
	PositionTexture g_game_star_texture_inner0, 0, (g_game_background_pos#*1) * g_game_star_texture_inner_rate 
	PositionTexture g_game_star_texture_inner1, 0, (g_game_background_pos#*1.6) * g_game_star_texture_inner_rate 
	PositionTexture g_game_star_texture_inner2, 0, (g_game_background_pos#*2.2) * g_game_star_texture_inner_rate 
	RenderWorld 
	Flip 
Wend 



Matty(Posted 2006) [#2]
flipmesh g_spacebox

put that in and it will fix it (after you create the cube so that you can see the inside)


Boiled Sweets(Posted 2006) [#3]
Whoops - I did miss that line.

BUT still you cannot see the box thru the star textures.

Nice try...


Matty(Posted 2006) [#4]
entityblend g_game_world_inner,3 (or 2 for a different effect...)

you need to set the blend mode of the entity. Textureblend will blend the texture with the other textures already applied to the entity. But they will not cause the entity to blend with the background.


Boiled Sweets(Posted 2006) [#5]
Matty,

many thanks you have resotred by sanity.