Author Topic: Transparency issues and how to solve them?  (Read 4590 times)

0 Members and 1 Guest are viewing this topic.

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Transparency issues and how to solve them?
Okay, here's a question.

I've been trying to make a model planet and it's rings to appear in FS2_Open. The planet part is no biggie, obviously it's just a big sphere with texture on it. But the rings (like the ones on Saturn) seem to be a bit problematic. When I slap a transparent texture on them, the rings themselves become transparent all right. The problem here is that everything else behind them also becomes transparent. That is, where the rings are over the planet, you can see the background through the planet when you should be seeing the planet's surface instead.

This is quite possibly related (or even the same) to the issue with "show ship" flag when the cockpit texture has a transparent HUD screen on it, it creates all kinds of wacky stuff that causes you to partially see through your ship's nose... or floor, if you're on external camera. I don't know if it's a bug or a feature, but I know that it is possible the have correctly transparent parts in models - the cockpit glasses are perfect examples of that. I just don't know how it is done, and search wouldn't find a tree in a forest. So... what do I have to do to make the rings of the planet transparent so that other models are still visible behind them?

I've tried different modle hierarchies - subobjects and stuff. I even created separate planet and ring models, but with exact same results. So I'm guessing I need to do something to the surface of the model itself. Closest bet would be that the polygons would need to be inverted or something like that... but wouldn't it make the whole ring invisible, or rather only visible to the inside of it? The ring model itself is a flat torus instead of flat rim, by the way.

Another question I have is related to PCS and TS 3.2 and where the hell is that lottery machine that decides how many normals a model uses...

Thanks for answers.
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: Transparency issues and how to solve them?
I'm sure that someone else will have an idea or two as well (and probably betters ones), but one thing that you could try is to use a non-transparent texture (no alpha) and name it properly so that the game renders it with additive blending like it does for effects and what not.  Basically, just change "texture.dds" to "texture-trans.dds", and change the reference in the model to "texture-trans" and then it should be transparent.  This isn't a fool-proof solution though, since it can sometimes create other rendering issues.

The other course of action is probably just to get your model hierachy in the correct order so that you are sure that the rings are rendered last.  That way it can properly deal with the blending with alpha from the texture.  I think what you would want to do (I'm not the expert on this though) is set the planet itself as a subobject, and the rings as what would be considered the main hull.  Since subobjects are drawn first, that will draw the planet, then the rings, which should allow the blending to work properly.  Someone else might correct me on this though, but you could probably test it for yourself in the meantime.

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Transparency issues and how to solve them?
Will do, thanks for suggestions. :)

EDIT: That hierarchy seems to have done the trick. Thanks.
« Last Edit: March 17, 2007, 12:46:02 am by Herra Tohtori »
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Getter Robo G

  • 211
  • Elite Super Robot Pilot
Re: Transparency issues and how to solve them?
Can we see a screenie? :D
"Don't think of it as being out-numbered, think of it as having a WIDE target selection!"

"I am the one and ONLY Star Dragon..."
Proof for the noobs:  Member Search

[I'm Just an idea guy, NOT: a modeler, texturer, or coder... Word of advice, "Watch out for the ducks!"]

Robotech II - Continuing...
FS2 Trek - Snails move faster than me...
Star Blazers: Journey to Iscandar...
FS GUNDAM - The Myth lives on... :)

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Transparency issues and how to solve them?
Can we see a screenie? :D

Here you go... :drevil:

There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 
Re: Transparency issues and how to solve them?
Those rings look very cool!  :)

 

Offline aldo_14

  • Gunnery Control
  • 213
Re: Transparency issues and how to solve them?
Sweet!

Insofar as transparency goes, it's sometimes a wee bit tricky; for cockpits it's a case of keeping the canopy 'glass' part of the main hull (with a different texture) and the cockpit as a submodel IIRC (actually, it occurs to me the latter bit might not be strictly necessary, so I'll need to check that out for myself), which works fine provided the glass faces don't have low point (vertice) ids as the vertice order seems to determine rendering and transparency order.

The trickiest bit, in my experience, is getting the ship hull to show through the glass, not the cockpit.  One thing you'll want to look out for is to check the smoothing on the planet 'body' is ok, subobjects tend to have very funky smoothing going by modelview.
« Last Edit: March 20, 2007, 05:54:45 am by aldo_14 »

 

Offline Raven2001

  • Machina Terra Reborn
  • 211
  • Im not the droid your looking for, move along
Re: Transparency issues and how to solve them?
You dont need them o be separat subobjects... make them all a single object, then detach the ring from the rest of the planet, and then re-attach it to the planet (keep in mind the planet body has to be the "parent" object of teh attach)... that should make the ring faces to be rendered last (due to face numbers).

Atleast that works for Max
Yeah, I know you were waiting for a very nice sig, in which I was quoting some very famous scientist or philosopher... guess what?!? I wont indulge you...

Why, you ask? What, do I look like a Shivan to you?!?


Raven is a god.

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Transparency issues and how to solve them?
Well, no Max here, I have to deal with TurdSpace 3.2 but I guess it's better than nothing. And as it works at the moment without any performance loss that I notice on my PC, I can't bother to change it at least at the moment. The rendering order definitely explains why problems arise when the HUD screen of the cockpit model has transparent texture - it's part of the cockpit subobject so it renders transparent last, making everything else behind it also transparent. Also probably because of vertice/face ID numbers, in some ships only part of the HUD makes the ship behind it disappear.

As far as smoothing goes, it looks good enough... Though I wonder where you can actually set the smoothing - under which tool group is that setting hidden in TS3.2's outerface (calling it an interface insults all proper ones...)? I once got smoothing setting visible by accident, it came up when I did something, but then it disappeared and I can't find it again. :mad:

And does it affect how PCS converts the object into a POF?

Considering other planets... is there some way to make a shine map that only affects the specular lighting and not the environmental mapping? Because it's a pain to make water reflect sunlight but not the backgrounds. Or is the only option to turn env mapping off?
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline aldo_14

  • Gunnery Control
  • 213
Re: Transparency issues and how to solve them?
Well, no Max here, I have to deal with TurdSpace 3.2 but I guess it's better than nothing. And as it works at the moment without any performance loss that I notice on my PC, I can't bother to change it at least at the moment. The rendering order definitely explains why problems arise when the HUD screen of the cockpit model has transparent texture - it's part of the cockpit subobject so it renders transparent last, making everything else behind it also transparent. Also probably because of vertice/face ID numbers, in some ships only part of the HUD makes the ship behind it disappear.

As far as smoothing goes, it looks good enough... Though I wonder where you can actually set the smoothing - under which tool group is that setting hidden in TS3.2's outerface (calling it an interface insults all proper ones...)? I once got smoothing setting visible by accident, it came up when I did something, but then it disappeared and I can't find it again. :mad:

And does it affect how PCS converts the object into a POF?

Considering other planets... is there some way to make a shine map that only affects the specular lighting and not the environmental mapping? Because it's a pain to make water reflect sunlight but not the backgrounds. Or is the only option to turn env mapping off?

I think so; I believe you can control the env mapping using alpha channels on shine-maps, but I've never really used env (never had much of a desire for it) mapping so I can't give any specific details.

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Transparency issues and how to solve them?
Okay, I've got another thing to complain about.

Now the model and transparent ring textures work all right in itself. But, if the model is not centered enough, and if there's another model behind the rings... the transparent rings turn the other model behind them transparent, for those parts where it's covered by the transparent rings of the first model. :wtf:

Mind you, this does not occur if the ringed planet is in the center of the view. But if I turn my craft so that the view doesn't have the ringed planet close enough to the center, then the parts of another model behind the ring suddenly turn transparent. The actual angle in which the transition occurs I don't know, but there's pretty sharp limit on it.


I think it's caused because for some reason, the game alternates the order in which it draws polygons, based on the attitude of the craft. :nervous:

Dunno why, but couldn't it be simply changed by making the models in view render in order of proximity, if they don't already do so? Or, assign rendering priority to each craft - perhaps even use distance as one?

If transparent parts must be drawn first and parts behind them after that, wouldn't that take care of the problems regarding separate models obscuring each other with their transparent subobjects?
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Transparency issues and how to solve them?
that ring isnt one big polygon is it? if it is then thats probably your problem. you could try using a higher poly grid instead so that the sections are being rendered in the proper z order. if you have one big polygon and its center is too far from the area infront of another object, it could seriously screw up the render order.

one thing ive come to realize about freespace's rendering order is that its greatly antiquated.  though it has been modified to take basic advantage of htl, it still hasnt been brought up modern standards. most modern game engines i have seen have almost zero limitations to the use of transparency. if theres one more feature id like out of the freespace engine, it would be a much more robust render list.

ive been able to do a couple ships with cockpits while using only one texture with alpha for the whole ship, but its not something you can do every time without glitches. id like to be able to do more with transparency.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Transparency issues and how to solve them?


It has plenty enough polygons... Probably too many to be optimized, but it looks good and doesn't really hit performance in a way I would notice it. :nervous: So that can't be the issue.

It's more likely that the order of rendering does some quirk that causes the problem to occur. I'm curious... does this happen with everything transparent, like Ship cockpits? I may have to stage some field tests to find out if cockpits obscure other models behind them... :blah:
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Re: Transparency issues and how to solve them?
Don't think it happens with everything or you'd be able to see through the Orion, Demon, Typhon and Lucifer... I guess.

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Transparency issues and how to solve them?
What do you mean by that? :nervous:
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Re: Transparency issues and how to solve them?
The Orion, Typhon, Demon and Lucy have transparent textures, don't they?

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Transparency issues and how to solve them?
Do they?

...anyhow, now I'm not talking about transparent parts making the same model transparent.

I'm talking about transparent part in one model obscuring another model behind it, and making the other model partially see-through... which is quite clearly something that I would classify as "bug" or at least poorly managed way to render things, because it's triggered by changing your ship's attitude...
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Transparency issues and how to solve them?
i do get a glitch like that when using weapon models with transparency. usually the weapon will black out the backgrounds. ive always attributed that to freespace's funky transparency handeling.

are you implementing the planet as a skybox or as a ship? you might try one or the other and see if that helps. also try making the planet a child of the ring too. that might do it.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

  
Re: Transparency issues and how to solve them?
If I would know all this stuff about transparencies was available...:

http://i29.photobucket.com/albums/c254/Shadow0000/Eartht_Hi_Poly_0001.png
http://i29.photobucket.com/albums/c254/Shadow0000/Eartht_Hi_Poly_0002.png
http://i29.photobucket.com/albums/c254/Shadow0000/Eartht_Hi_Poly_0003.png
http://i29.photobucket.com/albums/c254/Shadow0000/Eartht_Hi_Poly_0004.png
http://i29.photobucket.com/albums/c254/Shadow0000/Eartht_Hi_Poly_0005.png
http://i29.photobucket.com/albums/c254/Shadow0000/Eartht_Hi_Poly_0006.png

Well this is pretty easy to do, basically one Sphere for the Earth (Terrain), one for the Clouds, notice the clouds rotate at different ratio than the terrain sphere, though is only noticeable when the game is at fast forward speed.

The Atmosphere is not done as it should, it is actually set at a 3rd Sphere, which is using a texture with RGBA 0, 0, 128, 128. It seems this effect is either done as a mask or as an outer glow nowadays. The Hierarchy is set like this:

+Clouds
    +Atmosphere
         +Terrain

That way the transparent clouds are always rendered on top, while the Atmosphere will always be rendered behind both Clouds and Terrain, you will only see the outer edges and it will not add the 128 transparent blue to the rest of the clouds and terrain.

That detail is at 7200 polys with medium to high size textures, though there is a problem with the spheres if the planet is too big (real scale). Still, I think the ocean has an Specular Level map which can't be implemented in game (not too sure), and bumpmapping could improve it in the future...
« Last Edit: March 31, 2007, 05:06:38 am by Shadow0000 »

 

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Re: Transparency issues and how to solve them?
BTW, Shadow, for that model, could you shinemap the water? It looks cool and realistic, no?