Sign in to follow this  
Guest

Transparent Textures

Recommended Posts

Hi allI have been trying to create textures with transparency, using PSP7 I set the transparency areas in 0,255,0 (Green) and saving as a Bitmap.Using DXTBmp loading the bitmap and creating a Green alpha channel, a mask in effect, I guess. I output the file as Dxt3 bitmap. Problems with DXT1+A (Invalid Floating point operation) Nvidia problem I think!!!But in FS2002, the texture doesn't show and makes other parts of the building transparent, that don't have a texture assigned to it.I am using FSDS v1.6, which I am told doen't write good scasm code.One problem I am having is how to test whether the texture is part of the problem or whether it is the scasm code for the building.Does the building, on which the transparent texture is applied, need to contain some transparency in it self? ( I would have thought so)You can proberly see I'm confused, and I'm told its easy to create these texturesI hope somebody can help me, I'd be grateful for assistance.RegardsDave

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi,I normally work with palettized bitmaps. I make them from photographs with PSP5.0. Before saving the file I reduce the number of colors to 256. If one of the colors (index) is to appear transparent in FS, I take note of the color index. Then I open a small programme that I wrote and I enter that index. I can make the color completely transparent (Opacity=0) or have different grades of opacity. I normally do not use MIP maps with transparent textures because of the "blurring" (kind of). But if, for any reason, I need MIP maps, or if I want to compress the bitmap to DXT1, I use ImageTool by MS.Kind Regards, Luisps: www.ptsim.com/downloads/transp.exe is the link to the referred to small programme.

Share this post


Link to post
Share on other sites

I prefer to take the following approach when I make a transparant texture.1) I make the texture in my paint program2) I add a new channel to the image (still in the paint program) and name this Alpha or so.3) In this new channel I make my alpha channel, so I make the pieces I want fully transparant black, if I want a level of transparancy or reflective textuers I make them some color of gray.4) I save this image in a format that ImageTool can read and that also can store the alpha channel (TGA or PSD for example).5) I open that image in ImageTool, convert it to DXT1 or DXT3 and add the mip maps.I find this approach much easier, because you have a perfect control over the alpha channel and also the transparancy is not linked to a color but to the location you specify.I hope this helps,Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

Hi GuysThanks for the help, I'll try these out watch this spacethanks for the hopeDave

Share this post


Link to post
Share on other sites

Hi Thanks for your thought's on transparent textures1 I created a TGA file from psp with a mask2 I loaded this file and created a alpha Chl in (green 255) and saved it as a DXT3 fileThis is part of the code which FSDS produced, which I edited with the Loadbitmap(), which has produced a result. Previously, the commands Blanked out did not produce any transparency.;Transparent section;RGBSColor( e6 185 153 117 );Dwx( 2d ) ; color command;Dbd( 185 ) ; red;Dbx( ef ) ; flag/transparency;Dbd( 153 ) ; green;Dbd( 117 ) ; blue;TexPoly( 0 -5508 -32300 -74.15 15 19 189 16 6 237 7 241 237 6 226 189 )Loadbitmap( 0 6 e0 0 255 0 Ct_Elev512_SmT.bmp )TexPoly( 0 -5508 -32300 -74.15 15 19 189 16 6 237 7 241 237 6 226 189 )TexPoly( 0 5508 32300 74.15 15 19 189 16 6 237 7 241 237 6 226 189 )Now to my surprise I realise that I need semi-transparent texture, I am confused whether the code needs to be altered, or the texture.Arno, mentioned various greys in his procedure, how would this work?I am getting their, honest!!!!Cheers dave

Share this post


Link to post
Share on other sites

Hi Dave,No the code does not have to be alter when you have a transparant texture. The code is just the same as for a normal texture, the information for the transparancy is all in the texture.The FSDS code with the Dwx and Dwd commands you state is (or should be) equivalent to the LoadBitmap command, but they use these commands because when FSDS came out SCASM didn't support LoadBitmap yet.Then about the semi-transparant thing. In your paint program you can add the alpha channel. For DXT3 this is a 4 bit channel, so that means that you can have 16 colors in them. With different levels of gray you can give different levels of transparancy. Where black is fully transparant and white is completely not transparant. With gray colors you can get semi-transparant levels.Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

Thanks ArnoIntresting to learn about Why the FSDS coding was like that.I will try with the greys.Am I write to use a mask and save to alpha and grey is colour in maskThanks for the supportDave

Share this post


Link to post
Share on other sites

Hi Arno and hi to Luis also!In my recent development of scenry I have found out, that dwx, dbx and dba instructions used instead of LoadBitmap DO posess some really nasty problems. For example:I have put in my scenery a little more complex fire truck (okay, tires are made from 16 point 1 segemnt tube, truck from the side is not made from ordinarily cubes but from 1 segment 20 point tube). This truck has also some non-textured cubes also but when I looked at it in FS, I almost fell of the chair!:-eek I put DXT1 texture (without transparency!!!) and the truck was transparent, the bitmap was on the cube which should be textureless... Only tires had textures. After I changed every dbx/dwx/dba instructions for LoadBitmap, the truck got his textures back...To be honest, these instructions have impact to other macros also. For example, I made a really (almost photorealistic) localizer antenna which is made of lines and polys without any textures. And wow, since I made rather complicated terminal building API. This API is really quite long so that FSDS 1.6 api could not be compiled straight away (Jumps to :Skip are waaay to long for example). After I installed this macro I see on my glide slope antenna some textures when I am about 200-500m away from it and those textures are from who knows which object.Arno, I know this is quite complicated but have You experienced such problems also???:-rollAnd Luis, If You read my post, could You make a little change in FSDS when producing API; if I put let say door is visible only at distance nearer than 300m, the code produced by FSDS would be like this::X3IfVarRange( :Skip 0 150 )Points(.....ReturnAnd could it be changed to :X3IfVarRange( :Ret3 0 150 )Points(......:Ret3Return (x instead of Part.. because of smileys...)I am sorry to write about different things here also but somehow they fit in context.Best regards to all,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites

Hi Goran,No I haven't seen such strange things happening, but I only made a few airports with FSDS (the most complex I made in SCASM).About the second question (the one for Luis :)). Yes, you can make that change, but I think the code needs to be a bit different::X3IfVarRange( :Ret3 0 150 )Jump( :Obj3 ):Ret3Return:Obj3Points(......Your change will not work, as you still have to jump over the entire point list (and polygon definitions) and that is the part that is too long.Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

>I find this approach much easier, because you have a perfect >control over the alpha channel and also the transparancy is >not linked to a color but to the location you specify. Dear Arno,Yes I agree and I also use this method. But please note a small tip in my post that can be useful to secenry designers. I refer to the part of using a "8-bit paletized bitmap FS format" instead of DXT1 or other FS supported formats.Here is a description of a trick I use for taxilines. For the "non-curved" segments there are situations where I use a 32x32 yellow texture with a brown central region. The taxilines will be double lateral yellow lines with a brown center line. Say that I use 2 colors (yellow and brown). I want all the pixels of this small texture to be fully opaque. If I declare any of the non-used 254 colors to be transparent (with the alpha-channel approach I do not know how to do it), I get no MIPS in my taxilines even if I have "Image Quality Options" set to MIPs. The taxilines will be crispy and clear and not blurred.Kind Regards,Luis

Share this post


Link to post
Share on other sites

Hi Luis,For that specific problem using 8 bit seems the best solution indeed, but in general I prefer to use DXT texture as much as possible, as they seem to be the best for the performance.But you will probably also know the case were you have made a texture and used black as a transparant color, but there were also a few black pixels in the texture that shouldn't be transparant. In that case the alpha channel approach works best :).As always every method has his pros and cons it seems :D.Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

Hi AllThanks for the clues and interesting debate on how too'sThis seemed to work for me, but may be costly on frame rates!!!1 I created a mask of my transparent windows and saved to file2 In DXTBmp I imported the mask and saved as a Dxt3 file.3 In my code I chose the colour and transparency and used the Poly() command and then loaded my bitmap on top of the polygon enabling me to have semi transparent windows.;*************RUNWAY WINDOW ELEV *****************************;Transparent section;RGBSColor( e6 185 153 117 )Dwx( 2d ) ; color commandDbd( 161 ) ; redDbx( e8) ; flag/transparencyDbd( 133 ) ; greenDbd( 79 ) ; bluePoly( 0 -5508 -32300 -74.15 15 16 7 6 )Loadbitmap( 0 6 ef 0 0 0 Ct_Elev512.bmp )TexPoly( 0 -5508 -32300 -74.15 15 19 189 16 6 237 7 241 237 6 226 189 )TexPoly( 0 5508 32300 74.15 15 19 189 16 6 237 7 241 237 6 226 189 )I did manage to achieve semi transparency using the greys, but the colour grey was un suitable for my building and I assumed I was restricted to that colour.I agree with one of the writers about strange happenings with the following commandsDwx() Dbd()Dbx() Dbd() Dbd()Thanks for the links, I'll check these outAlways learning in this game, help as always is appreciatedCheers DavePS tried to upload image and couldn't, sorry guys

Share this post


Link to post
Share on other sites

Hi Dave,One question. You write:"The color gray was unsuitable for my building"This makes me think you didn't completely understand what I was trying explain. Your texture can have ANY color you like, but you add an extra channel (alpha channel) and there you can set the level of transparancy by using different gray scales. So this has nothing to do with the colors in your normal texture.Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this