Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: KARMA on October 17, 2002, 05:16:36 am

Title: opacity
Post by: KARMA on October 17, 2002, 05:16:36 am
it was asked by somebody sometimes ago, but i know you all have a lot to deal with (and are not paied to do so), but...
did somebody looked at how to change the opacity of textures?
(i mean.. to make glasses or even stealth fighters)

*it isn't urgent, i don't need it at all, i'm just curious


(maybe something like calling "glass" a subobject in hyerachy or giving a name like glass01,glass02.. to textures could make the game render them with an opacity of, mmm, like 30%... but maybe there are better ways)
Title: opacity
Post by: ##UnknownPlayer## on October 17, 2002, 06:28:36 am
Well, I know I can mess around with the alpha code for textures and make all the fighters and objects translucent. Looks pretty funky - like your fighting ghosts.
Title: opacity
Post by: KARMA on October 17, 2002, 10:38:53 am
ops i've lost bobbau's other post about that sorry guys
Title: opacity
Post by: Fry_Day on October 17, 2002, 10:45:29 am
unknownplayer, that just simply won't cut it, since stuff will look wrong (Like the half-life training sequence, where there's that hologram, and there are sometimes double-layers because of the back-to-front drawing order and interpenetrating polies). To do a cool looking translucency effect (for whole ships, not single polies), you'd ideally draw every ship in a back-to-front order, and draw ships fading away at a front to back order, so there won't be overlapping transparent pixels (The Z-Buffer should take care of those). if you want only partial translucency, you need to stick to the current back-to-front drawing order, though, but draw all the translucent polies last.
Title: opacity
Post by: mikhael on October 17, 2002, 10:56:43 am
There's also the issue of what you would see through the "glass". Consider that reverse-wound (IE, backfacing) polys are, IIRC, culled prior to rasterization. That leaves you looking through the glass at the back side of nothing. Transparency on any front facing poly ends up being a window all the way through the ship.

To beat that, you'd have to model in a cockpit of some sort, even if its just a depression in the mesh. Its a whole lot of work for not a lot of return.

On the other hand, adding a model wide translucency handler for creating 'cloak' effects would be reasonable, but it would still be subject to to poly overdraw/overlap issues as Fry Day pointed out.
Title: opacity
Post by: Fry_Day on October 17, 2002, 11:15:20 am
Quote
Consider that reverse-wound (IE, backfacing) polys are, IIRC, culled prior to rasterization.

A simple state-change disables backface culling in the hardware(the culling of faces that aren't facing you), and you'd have to remove only a single "if" statement to disable that sort of culling if it's implemented in software (disable the check if the dot product of the normal vector of the poly and the POV vector is <0)
Title: opacity
Post by: RandomTiger on October 17, 2002, 11:31:31 am
Let not go there, that would half the speed of the graphics and there would still be a lot of sorting issues.
Title: opacity
Post by: mikhael on October 17, 2002, 11:42:41 am
Quote
Originally posted by RandomTiger
Let not go there, that would half the speed of the graphics and there would still be a lot of sorting issues.


Agreed. Its too much effort for a minimal return.
Title: opacity
Post by: Fry_Day on October 17, 2002, 02:59:33 pm
RandomTiger, I never, EVER suggested doing so for all polygons. Only for ones marked as transparent (since they're the only double-sided polies), and, assuming noone goes wild with the transparency stuff, the preformance hit wouldn't be that great at all.
Title: opacity
Post by: ##UnknownPlayer## on October 17, 2002, 04:27:40 pm
For the record I was joking...
Title: opacity
Post by: KARMA on October 17, 2002, 05:11:08 pm
i can't say a word about the tech part...but about the uses i wasn't thinking at cockpits as main goal (to make the inside of a cockpit would be pain the ass with too polys required) but at stealth fighters and architeture things like observatories, hydroponic areas and few others i was having in mind, but i agree it is really a minor thing (well stealth fighters would be cool)
Title: opacity
Post by: Galemp on October 17, 2002, 06:49:05 pm
Quote
Originally posted by KARMA
...architeture things like observatories, hydroponic areas and few others i was having in mind...


Now THAT would be cool! Though I think a nice reflective finish on some surfaces would be used more. Like the shiny winscreens on the fighters, as seen in the spinning ship ANIs.
Title: opacity
Post by: EdrickV on October 17, 2002, 10:26:46 pm
You can make invisible but solid faces by asigning them to the texture "invisible." See the Orion's fighterbay. That won't look like glass though. You can also make a face or part of a face transparent by making it bright green, but only when using D3D mode, not Glide. Neither of those would IMHO quite do glass. (And the first at least you can shoot through.)
Title: opacity
Post by: Bobboau on October 17, 2002, 10:42:50 pm
did you look at my thread about how I have this somewhat implemented
this one (http://www.hard-light.net/forums/index.php/topic,10762.0.html)
Title: opacity
Post by: Fry_Day on October 18, 2002, 01:06:42 am
Bobbau, without sorting, alpha textures look wrong - if, say, the transparent texture is drawn before objects behind it, they won't be drawn at all (because of the Z-Buffer), and everything will look wrong (if you have a huge window set in space, you could theoretically see only space tinted to the color of the window through it, even though you have a ship which you know that is directly behind it.
Title: opacity
Post by: Bobboau on October 18, 2002, 01:15:12 am
I only did minimal testing but I think it's sorted,
textures with alpha or any transparency are handeled diferently, it uses the same code to render as the thrusters and weapon effects, only it gives lighting values to the verts before rendering (wich actualy causes a bit of a problem with only the well lit pollys being visable)
Title: opacity
Post by: KARMA on October 18, 2002, 05:40:34 am
Quote
Originally posted by Bobboau
did you look at my thread about how I have this somewhat implemented
this one (http://www.hard-light.net/forums/index.php/topic,10762.0.html)


yes i did, i've seen it just after making posting and i was asking excuses for the unnecessary thread before all the tech discussion started:)