GLBasic forum

Main forum => GLBasic - en => Topic started by: FutureCow on 2009-Dec-10

Title: How do I draw a transparent 3D object?
Post by: FutureCow on 2009-Dec-10
Two questions
1) I've got a flat square (280 triangles making up a grid of squares - 14x10). I want to overlay it on my 3D scene without it appearing (I'm using it for collision detection with X_COLLISIONRAY and X_GETCOLLISIONFACE to pinpoint a grid location on my map.)
I've tried alphamode -1, -0.00000000001, 0, +0.00000000001, and 1. Using a very small positive number it is almost invisible, but it can still be seen (screenshot). I want it entirely invisible - is this possible?

2) Is it possible to apply a 3d texture with transparent bits in it? eg To make a grid have a texture that's a box with an invisible centre? I haven't gotten it to work yet.


[attachment deleted by admin]
Title: Re: How do I draw a transparent 3D object?
Post by: matchy on 2009-Dec-10
Only 2D textures can be applied (I presume 2D was meant) to 3D objects with transparency to create an "invisible" object. A hatch pattern texture map will created a fishing net effect. It's totally possible and no need for alphamode. Another example is light beems where black (set as transparent) to white gradient texture maps with alphamode. ;)
Title: Re: How do I draw a transparent 3D object?
Post by: Hemlos on 2009-Dec-10
Use this texture to make it invisible....
It is 2x2 so opengl is happy, and it is saved with 255,0,128 as the background color.
If the .png doesnt do it, convert it to 24 bit bmp, and make sure you save it with the background color as the one above.....this can be done in mspaint.

If you do not mess with the transparency command...then this texture will(should) make your object disapear.


[attachment deleted by admin]
Title: Re: How do I draw a transparent 3D object?
Post by: FutureCow on 2009-Dec-11
I didn't realise if you apply a texture with the "transparent" colour on it then it would render transparent. For 3D I (for some unknown reason) thought you had to use alpha.
What an easy solution! Cheers guys!!!!