Jump to content
Sign in to follow this  
Fortran

Occlude/Alpha Texture?

Recommended Posts

Not sure really how to title this post, but I wanted to ask how something worked. If you open up the BIS MLOD A-10 (from A1) in O2, in the view-pilot LOD infront of the cockpit window is a large rectangle geometry which "obscures" the 3D HUD elements of the A-10 (the 3D Compass and 3D Artifical horizon etc.) Now the large rectangle shares the same texture as those 3D elements and has an alpha channel with the information inside it. What I don't understand is how the large rectangle blocks out the 3D HUD elements outside of the centre. If you rotate around the cockpit in perspective view the 3D Hud elements dissapear when behind the rectangle, but are viewable again when on the opposite side of it. Also obviously in-game it works in the same way, the visual 3D HUD is only visable in the centre of this large rectangle and not outside of it. The rectangle has no centre which explains how the 3D elements can be seen in the centre but I just don't get how it blocks out the 3D elements when they are not in the middle but doesn't block anything else like the nose of the plane etc ?

I might be being very stupid but I just don't grasp how this works ? Its like a double alpha channel, it blocks out everything of the 3D HUD outside of the middle of the rectangle, but is also see-through itself and ONLY blocks out the 3D HUD elements and nothing else.

Can anybody explain how this is done to me? I am about to make some 3D HUD elements myself and could also use this techinque to overcome some other minor things I have had to make work-arounds for.

Edited by Fortran

Share this post


Link to post
Share on other sites

I think I .... might understand what you're asking ... maybe ... not LOL

Are you sure this is simply not a texture priority display level *thingy* ?

i.e. 1 texture is drawn after or before another, using FACES->MOVE TOP or FACES->MOVE BOTTOM

or even the FACES->MOVE TO NEXT ALPHA etc ?

Share this post


Link to post
Share on other sites

I think you might be right lol, just reading my post again I even managed to loose myself lol. Thanks Gnat, I haven't experimented with those commands so far will have a go and see if this provides the same result. Thanks for your help again.

Share this post


Link to post
Share on other sites
Guest RKSL-Rock

Its sounds like what you want is somtimes called an "opacity mask". Its not the most accurate name but its what we've bene calling it for the last 6 years or so. Gnat has pointed you at the right commands.

All you need do is create you mask apply an alpha texture to it and use FACES->MOVE BOTTOM. Then just shift the object/textures you wan to see all the time to the top of the alpha layer stack.

Share this post


Link to post
Share on other sites

It's a combo of 2 techniques.

1. As per rock & gnat... the sorting of the poly's in the alpha stack while in o2.

and

2. Note that although the 'large rectangle' indeed points to the same primary texture as the 3d hud poly's do. It is for all intensive purposes a completely distinct texture mapping.

That is the 'large rectangle' is ONLY mapped to some 'see through' texture.

Whereas the 3d hud poly's are also mapped to some 'see through' texture AND they have a material that uses "NoZWrite","NoAlphaWrite","AddBlend".

It just so happens that the modeller mapped the 'large rectangle' to a small 'see through' portion of the same texture file used by the 3d hud elements for efficiency.

They are 2 distinct 'sections' of rendering for the engine. The 'large rectangle' will be counted in ZWrite calcs., will 'occlude stuff' 'cause it will be used in 'Alpha' calcs. But, because your 'pre-sorting' in O2 using move-bottom & top your effectively placing the plane 1st., the rectangle 2nd. and the hud 3rd. in the view frustrum.

Hard to come to grips with i know.

I find it hard to understand how you say you can see the 3d hud elements while in 3rd person / perspective view when ingame (if I didn't misunderstand) 'cause when in third persp. your looking a LoD 1.0 of the A10 which doesn't have the 3d hud poly's.

Share this post


Link to post
Share on other sites

Magic! Many thanks to all three of you guys, it's quite an odd concept but I think understand it now, will really get to grips with it when I give it a go for myself, this is the first engine I have worked with that allows manual face sorting in this manner. Thank you very much for your help, seriously appreciate it. I am hoping to be able to utilize this same technique to correct a small problem with my MFD which I have "worked around" but this would provide a much nicer solution, allowing for a much larger centre artificial horizon which is blocked by a similar method, instead of currently only operating within the boundary of the actual MFD geometry.

It's a combo of 2 techniques.

I find it hard to understand how you say you can see the 3d hud elements while in 3rd person / perspective view when ingame (if I didn't misunderstand) 'cause when in third persp. your looking a LoD 1.0 of the A10 which doesn't have the 3d hud poly's.

Ah no, I meant just in the O2 viewport when rotating around the view-pilot LOD in perspective view :).

Edited by Fortran

Share this post


Link to post
Share on other sites

Just following up on this:

Been trying to get this to work but am having a bit of a headache. In the O2 viewport window the masking and alpha layer order works perfectly, the opacity masks work fine and it looks just as I had planned. However in bulldozer and in-game the opacity mask does not function ?

I have the (under-mask) HUD parts using an rvmat with

renderFlags[]=

{

"NoZWrite",

"NoAlphaWrite",

"AddBlend"

};

(same problem occurs with no rvmats at-all also)

The opacity masks have no rvmat and use the same texture as the other parts but just solid alpha.

I don't understand where im going wrong with this. Here is a shot from the O2 viewport window showing the opacity masks are working perfectly:

o2_1.jpg

and here it is in Bulldozer where the masks are NOT working:

o2_2.jpg

Anybody have any ideas what im doing wrong here?

Share this post


Link to post
Share on other sites

ok well im baffled to say the least. Have half fixed this problem but by using a bit of a "hacked" method. Turns out it was both my mask geometries and the texture. I exported out the mask from the A10 into 3DS and edited it in Max, re-imported and applied the same texture from the A10 hud and it works. However using my own texture on it just results in the same old problem again. My new texture is set-up identically to the original A-10 mask, ie. pure white in the area the mask is UV'd to and pure black in the alpha channel in the same area. As far as I could see my mask geometry was also identical, just a simple one-sided plane mesh with a hole where the underlying geometry should show through, but no dice, just simply won't work unless I edit the original A10 mask and use it's texture. Have even tried just a simple 16x16 alpha texture with the same setup (ie white and black in the alpha) but still no joy. Is annoying and weird lol. Just don't understand where the problem is with this, would really prefer to use my own texture as I don't really want to have to include a whole 1024x1024 sheet JUST to use it's alpha.

Share this post


Link to post
Share on other sites
Guest RKSL-Rock

ok this is easy to fix. You cannot use a texture with a totally black(RGB 0,0,0) alpha channel. Try using (RGB 1,1,1) and see what happens. Just up the value if you have problems.

Share this post


Link to post
Share on other sites

Ah! Your absolutely right! Thanks alot mate, would have never figured that myself. How come it needs to be like that ? Can the engine not interpret the alpha channel for layering if its totally black or something ? Just had another look at the A10 hud texture and indeed the alpha is set to 1,1,1 just in the area the mask is mapped to, but 0,0,0 everywhere else.

Thanks again Rock, really appreciate it.

Share this post


Link to post
Share on other sites
Guest RKSL-Rock
Ah! Your absolutely right! Thanks alot mate, would have never figured that myself. How come it needs to be like that ? Can the engine not interpret the alpha channel for layering if its totally black or something ? Just had another look at the A10 hud texture and indeed the alpha is set to 1,1,1 just in the area the mask is mapped to, but 0,0,0 everywhere else.

Thanks again Rock, really appreciate it.

Ive no idea why they changed it but i have found it quite useful at times. I was lucky enough to find out by accident.

I'm glad it works for you if you need anything else just ask mate.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×