setting alpha on part of an object?

Blitz3D Forums/Blitz3D Programming/setting alpha on part of an object?

ryan scott(Posted 2006) [#1]
i would like the top of a tunnel to become transparent when my vehicle drives through the tunnel, so i can see what's going on inside. if the tunnel is very long, is there a way to make part of that entity transparent, the part above my vehicle?

or do i have to break apart the tunnel into smaller meshes/entities so that i can set the alpha of the entire entity using EntityAlpha?


octothorpe(Posted 2006) [#2]
You'll either need to use an alpha texture or break it up into separate surfaces/entities.


gosse(Posted 2006) [#3]
or you change the vertex alpha of the vertices of that part


jhocking(Posted 2006) [#4]
For the specific situation he describes, I'm guessing vertex alpha would look/work best. Then again, bear in mind that as soon as you adjust the alpha of any vertices, the entire mesh won't be z-buffered anymore, so parts obscuring other parts (which is going to happen with a long tunnel that curves around) won't render correctly.


ryan scott(Posted 2006) [#5]
is there a way to make the mesh be z-buffered again?

if not is there some kind of brilliant workaround? surely this is possible :)


Stevie G(Posted 2006) [#6]
You should be able to get the mesh z-buffered again by changing the entityfx back to what it was.

Stevie


poopla(Posted 2006) [#7]
EntityFX has nothing to do with vertex alpha(beyond toggling it.). You turn off vertex blending and you loose the initially desired effect.


Stevie G(Posted 2006) [#8]
Eh ... sorry but I don't agree. By setting Flag 32 you are disabling z-order on that object. Logically if you set the Flag back to 0 the z-ordering is re-enabled.

To demonstrate for ryan ... ( note that the plane and the cube are created at the same point ). Excuse the code ... thrown together .. press space to toggle z-order.




BlackJumper(Posted 2006) [#9]
Just a thought...

Could you do this with a two-pass render ?

First render the full scene, with tunnel seen from above. Then render just the vehicle with a suitable (circular ?) section of track just below it... You could probably get away with texturing a quad and then rotating it to get different directions. {Maybe even an animated texture to get in-tunnel movement ??}

... I am assuming a top-down 'SpyHunter' style game, so apologies if this is way off base !


Stevie G(Posted 2006) [#10]
To save all the faffing around why not just show an arrow mesh pointing in the same direction as the car if you're under a tunnel. Do you really need to see the car?

Stevie


poopla(Posted 2006) [#11]
Because that's not what he wants?


Stevie G(Posted 2006) [#12]
Dev / Mike

I don't see the harm in offering a suggestion.

What exactly are you contibuting here to help Ryan ..... other than taking a dig at everything I say?

Stevie


ryan scott(Posted 2006) [#13]
thanks guys

you could call it a spyhunter type game, except that you can drive up the sides of the tunnel. i do need to be able to see through the tunnel because the entire level takes place in it. it actually takes place inside a blood vessel. you can drive on any part of it. i need to be able to see through the tunnel 'ceiling' down to the tunnel 'floor'.

when i use entityfx it certainly makes everything look weird. i found some useful code:

http://www.blitzbasic.com/Community/posts.php?topic=25162

for cutting a hole in a mesh (vertexalpha on all vertices around a certain point)

but because the zorder stuff is all goofy, it doesn't really work.

i wish i could post code but it's not isolated, its all within a bigger program.

you could imagine this problem as having a car driving on the inside of a sphere. You wouldn't be able to see the car unless you cut an alpha hole into the sphere to see what was going on. since the camera is child of car, the alpha hole moves, always to opposite side of sphere that car is on.

i am unsure what to do - the entityfx zorder requirement certainly makes some objects look inside out.

blackjumper, that sounds interesting, the 2 pass method. i would have to display what was really in the tunnel, not 'fake' it though. there would be all kinds of baddies in there with you, etc. i am not clear on how to do a 2 pass render tho. sorry if i'm misinterpretting your idea?