Jump to content

Flags, opacity and transparency thresholds


Recommended Posts

Seems like a bug with the shaders/models used for some parts. I have opened a bug report on the tracker here.

 

 

So I've just made a quick flag for the Asteroid Day thingy, and made it with transparent background. As it is a png, it handles transparency and some of the text and image (grey part) is semi-transparent.

VgcSrGH.png

Now, when using the flag in the game it works fine, except when using it on the Mk2 Cockpit and on the Boar booster (maybe other parts but I did not notice it).

ss26ac4.png

When editing the flag after seeing this, I could replicate the look of it by tweaking opacity of the png layer. (Flag is the same, and it doesn't seem to depend on colour or curvature of the flag as it works well on a lot of other parts)

 

So I was wondering how KSP handles flags on parts, what is required for displaying/not displaying a part of the flag (transparency thresholds), and how opacity is handled.
Any hint or help on this issue is welcome !

(Not sure where to put this, mods please move if it's not at the right place, thanks!)

Edited by Gaarst
Link to comment
Share on other sites

I think this comes down to the shader used for each specific part, which is set in the material before the part is exported to the .mu format.

On the left it appears it is using a cutoff-based shader; so things are either completely transparent or completely opaque depending upon the value of the alpha channel for the pixel and the specified cutoff value.

On the right it looks to be using a proper 'transparent' shader with full alpha support, giving you the full range of alpha transparency.

Link to comment
Share on other sites

4 minutes ago, Shadowmage said:

I think this comes down to the shader used for each specific part, which is set in the material before the part is exported to the .mu format.

On the left it appears it is using a cutoff-based shader; so things are either completely transparent or completely opaque depending upon the value of the alpha channel for the pixel and the specified cutoff value.

On the right it looks to be using a proper 'transparent' shader with full alpha support, giving you the full range of alpha transparency.

(I don't know anything about texturing stuff)

That makes sense, but I am wondering why it should be different for these two parts (Mk2 and Mk2 Inline Cockpit) that were both designed/redesigned by C7 or Porkjet (not really sure for these two).

Link to comment
Share on other sites

7 minutes ago, Snark said:

Moving to Modeling and Texturing Discussion.

Even though texturing stuff seems to be involved, this is not about add-on development, just an issue with the stock game, maybe it would be better in Technical Support or Gameplay Questions.

Link to comment
Share on other sites

2 minutes ago, Gaarst said:

Even though texturing stuff seems to be involved, this is not about add-on development, just an issue with the stock game, maybe it would be better in Technical Support or Gameplay Questions.

It's about "how do I make an image file so that it plays nice with the way KSP displays things", which I'd wager makes it good fodder for the modeling & texturing forum-- a flag texture is a texture.  That forum is well-populated with the kind of folks who would be likely to know the ins and outs of this sort of thing.  :)

Link to comment
Share on other sites

13 minutes ago, Snark said:

It's about "how do I make an image file so that it plays nice with the way KSP displays things", which I'd wager makes it good fodder for the modeling & texturing forum-- a flag texture is a texture.  That forum is well-populated with the kind of folks who would be likely to know the ins and outs of this sort of thing.  :)

Didn't see it from that perspective, makes sense.

Link to comment
Share on other sites

16 hours ago, Gaarst said:

(I don't know anything about texturing stuff)

That makes sense, but I am wondering why it should be different for these two parts (Mk2 and Mk2 Inline Cockpit) that were both designed/redesigned by C7 or Porkjet (not really sure for these two).

Simply put:  He picked different shaders for the parts when he compiled them.  No clue on the reasoning behind it; it could have been a simple mistake, or one was made earlier in the dev cycle before the shaders were well known.

Sadly there is no (simple/easy) way to fix it that I'm aware of.  As the shader is compiled into the binary model file, it pretty much would have to be re-compiled and re-exported from Unity on the Squad side.  There are ways to hack stuff inside those model files (have done it for some of my own models), but I believe that is against the TOS/EULA for stock models/textures (no decompiling of Squad assets).


Perhaps you should file a bug report so that they are aware of the problem and have a chance to fix it for 1.2?  I would say that using the cutoff shader is probably the error; flags should have proper transparency support.

Link to comment
Share on other sites

9 hours ago, Shadowmage said:

Simply put:  He picked different shaders for the parts when he compiled them.  No clue on the reasoning behind it; it could have been a simple mistake, or one was made earlier in the dev cycle before the shaders were well known.

Sadly there is no (simple/easy) way to fix it that I'm aware of.  As the shader is compiled into the binary model file, it pretty much would have to be re-compiled and re-exported from Unity on the Squad side.  There are ways to hack stuff inside those model files (have done it for some of my own models), but I believe that is against the TOS/EULA for stock models/textures (no decompiling of Squad assets).


Perhaps you should file a bug report so that they are aware of the problem and have a chance to fix it for 1.2?  I would say that using the cutoff shader is probably the error; flags should have proper transparency support.

Bug report is done, thank you for your help!

Edit: link to the bug report here

Edited by Gaarst
Link to comment
Share on other sites

 

From KSP 1.1 through 1.1.2, there was a bug in the VAB that made transparency break pretty badly with the normal "alpha translucent" shader used for flag decals. The bug didn't apply to "alpha cutoff", so it's possible they did that just to avoid their own bug in the VAB. The shader was fixed in 1.1.3. "Alpha cutoff" makes each pixel in the decal either 100% transparent or 100% opaque, with no partial transparency in between, so it'll do exactly what the OP is describing.

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...