Page 1 of 2

Transparency in textures.

Posted: Sun Apr 01, 2007 12:16 am
by Flying_Circus
When last I tried it, transparency of any kind (much less alpha transparency) didn't seem to be supported by Oolite's rendering? Is this still so, and would it be a huge task, to fix?

As always, let me know if you need any ellucidation.

Posted: Sun Apr 01, 2007 12:29 am
by JensAyton
It is not, and it would. This is a long-term issue – it won’t be fixed until after the next “full” (non-testing) release at earliest.

Posted: Sun Apr 01, 2007 12:10 pm
by aegidian
I imagine it could be supported by using a custom shader.

Posted: Sun Apr 01, 2007 12:20 pm
by JensAyton
Not really. Shaders still require polyogons to be sorted from back to front for transparency to work properly. Also, Oolite draws each entity’s profile in dark grey before drawing in colour to avoid gaps, remember. :-) (I’m not sure this actually has any effect other than stopping attempts at transparency, though, since it draws exactly the same mesh.)

Exception: a shader can reject a fragment, i.e. stop it from being rendered at all. This allows, effectively, 1-bit transparency masking, but not alpha blending (like the difference between GIFs and PNGs). Because of the dark grey thing, you’ll only be able to see through to the ship itself.

Posted: Sun Apr 01, 2007 4:25 pm
by Killer Wolf
Also, Oolite draws each entity’s profile in dark grey before drawing in colour to avoid gaps
So what would happen if you removed alll those 127s from the dat?? would that allow transparency where the texture was missing or is it way more complaex than that?

Posted: Sun Apr 01, 2007 4:43 pm
by JensAyton
No. The first ”127” is now smoothing group, and the other two are ignored. If you just remove them, your DAT won’t load properly.

Posted: Sun Apr 01, 2007 5:22 pm
by Charlie
FWIW:
Quite some time ago I tried to do a transparent ship. ( I wasn't aware it couldn't be done! )
The result was the Falcon-S...
It's not see-through as such, but using a transparent .png did have some effect. I'd describe it as an advanced camouflage paint.
@Flying_Circus:
Is that enough for whatever you're up to?

P.S.
Just for my curiosity:-
I have a feeling that aegidian posted some time ago that the reason transparency doesn't work properly despite such .png's being accepted is that faces are all rendered twice. Once carrying the texture & again ( black? ) to reduce the appearance of any gaps between verts.
True?
Just my addled imagination?
If true, I assume real transparency would 'just' need this second rendering switched off... though @ the cost of seeing stuff through any discontinuities in the model.

Hmmm, that may also require the ability to render a texture on both sides of a face to avoid some odd effects...

Posted: Sun Apr 01, 2007 5:33 pm
by JensAyton
What you are describing is the “dark grey” stuff I mentioned. (Which, I might add, I don’t think has any actual effect.)

The primary problem with transparency is that, to avoid glitches, polygons that have transparent bits must be sorted in back-to-front order. This severely pessimizes rendering, so cleverly and selectively only sorting the bits necessary is needed. This is a big job, and is connected to various other big jobs that need doing.

Posted: Sun Apr 01, 2007 8:41 pm
by Flying_Circus
Charlie wrote:
@Flying_Circus:
Is that enough for whatever you're up to?
Quite possibly. I was really just wondering whether things like scaffold-like gantries, and such were possible, by just faking it together, rather than modelling every detail. It's a non-issue, really: nothing I'm 'up to' :) (you make it sound so ominous).

What's he building in there?
What the hell is he building
In there?
He has subscriptions to those
Magazines... He never
Waves when he goes by

I heard he was up on the
Roof last night
Signaling with a flashlight
And what's that tune he's
Always whistling...
What's he building in there?
What's he building in there?

We have a right to know...

Posted: Mon Apr 02, 2007 11:57 am
by Ramirez
I eventually got transparency working in-game with the AstroFactory and the Imperial Freighter - the only problem was that it was a bit hit and miss whether opaque objects inside the transparent bodies actually appeared. Having said that, for simple single-object things like gantries it might work quite well.

Posted: Mon Apr 02, 2007 12:12 pm
by TGHC
There was also some sort of bug (fixed now) that gave you transparent planets, or semi-opaque whatever.

Posted: Mon Apr 02, 2007 1:53 pm
by Killer Wolf
how do the cloud formations work then? i assumed they were a cloud texture on a transparent orb placed around the planet :-/

Posted: Tue Apr 03, 2007 3:22 pm
by Ramirez
Here's some transparency at work:

Image

While you can see the chimneys through the dome, I don't think you can see the other side of the dome itself. So if you just had a box on its own in space and applied a transparent texture, it would appear fainter but you still wouldn't necessarily be able to see through it.

Posted: Tue Apr 03, 2007 6:52 pm
by dajt
Cloud formations work because planets are drawn differently to ships.

Posted: Wed Apr 04, 2007 4:04 pm
by Arexack_Heretic
If it is just a matter of shaders, some nice effects may be possible after all. (with a lot of extra effort ;) )

...gonna peek at how that dome works.
...then with cycling shaders it should be possible to create gif-like neon signs. (like of a edible poet, seductively waving it's tentacle.)
...only problem could be the emitting light part.