TEXTURE HELP!

Blitz3D Forums/Blitz3D Beginners Area/TEXTURE HELP!

Stevie G(Posted 2003) [#1]
I have a single surface track which has been vertexcolored. I have a texture which I created which is simply a black 16x16 pixel square with a vertical line on the left and one on the right. I'm trying to get my texture to be overlayed ontop of the vertex color with no joy. I've tried changing the brushblend to 2 & 3 but in both instanced I just get the texture overwriting any vertexcolor I have. Can anyone help or better still tell me how I can blend the white lines in with the vertexcolor but leave the road as is without blending the black with it.

Any help would be appreciated


jhocking(Posted 2003) [#2]
I don't exactly understand what you are trying to do (your description is pretty vague) but here are a few things to keep in mind when working with vertex color. First off make sure you are setting the track to EntityFX 2. Note also that vertex color can only make surfaces darker; since black is as dark as you can get, vertex color has no effect on black surfaces/areas of texture. Finally, make absolutely sure that you have carried over the vertex colors. Try viewing the track with EntityFX 2 but without any texture applied to verify that it has vertex colors assigned.


Stevie G(Posted 2003) [#3]
Sorry the problem is not with vertex color - this is working fine. I simply want to lay a texture over the top a road (a) which is coloured using vertex color. The texture has a white vertical line to the left and right of a black square (b). I don't want the black part to obscure the vertex colour underneath but the white lines to show over or blended with the road and the black part to be ignored (c).

I can't think of any other way to explain this .. make sense to anyone???

(a) (b) (c)
..... * * *...*
..... * * *...*
..... * * *...*
..... * * *...*


big10p(Posted 2003) [#4]
So you want the black part of the texture to be completely transparent, yes? Are you using flag 4 when loading the texture?

I may be way off here but that's all I can think of at the mo. :)


Stevie G(Posted 2003) [#5]
Yes. I'm not actually loading the texture but I have created it as .. road_tex=createtexture(16,16,4) so the masking flag should be set.

Then I create a brush and use

Brushtexture brush,road_tex,0,1 (tried keeping index as 0)
Paintsurface road,brush


big10p(Posted 2003) [#6]
Right, I'm with you now - I came up against this prob a while back. See, when you CreateTexture the alpha if set to $FF (255) even when setting flag 4 (which you still need to do, BTW). So, you need to manually go through your newly created texture and write an alpha level of 0. Try something like this:

road_tex = CreateTexture(64,64,4)
SetBuffer TextureBuffer(road_tex)
For y = 0 To 63
	For x = 0 To 63
	WritePixel x,y,$00000000
	Next
Next
; Now draw your white lines here.


That sorted the prob for me, anyways. Hope this helps.


Stevie G(Posted 2003) [#7]
Nice one - worked perfectly. Thanks for your help!