Transparency in textures.

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
Flying_Circus
Dangerous
Dangerous
Posts: 118
Joined: Thu Dec 09, 2004 10:04 pm
Location: Hexham, UK

Transparency in textures.

Post 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.
And so I gave myself to God. There was a pregnant pause before He said "OK"
Image
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.
User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

I imagine it could be supported by using a custom shader.
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Post 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?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.
User avatar
Charlie
---- E L I T E ----
---- E L I T E ----
Posts: 262
Joined: Wed Sep 27, 2006 5:33 pm

Post 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...
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---

Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main

Charlie
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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.
User avatar
Flying_Circus
Dangerous
Dangerous
Posts: 118
Joined: Thu Dec 09, 2004 10:04 pm
Location: Hexham, UK

Post 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...
And so I gave myself to God. There was a pregnant pause before He said "OK"
Image
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post 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.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

There was also some sort of bug (fixed now) that gave you transparent planets, or semi-opaque whatever.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Post 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 :-/
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post 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.
Download Resistance Commander plus many other exciting OXPs HERE
dajt
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 364
Joined: Tue Aug 17, 2004 7:05 am
Location: Orange, NSW, Australia

Post by dajt »

Cloud formations work because planets are drawn differently to ships.
Regards,
David Taylor.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post 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.
Riding the Rocket!
Post Reply