Stop Alpha Blending from Toggling?

Noodles

Queen of Ramen
Joined
Sep 20, 2018
Messages
727
Location
Illinois
SL Rez
2006
Joined SLU
04-28-2010
SLU Posts
6947
Hopefully someone has some ideas on this.

So, when making stuff from purchased Mesh templates, it's common to add a transparent prim to the object as the root prim, so you show as the Creator and not the template creator.

I do this with a small cube set to 100% transparent. I find this easier than using a transparent texture because it means I can just edit and add the texture for the object, instead of using edit face.

When I start using a template, I will usually pre set up a set of blanks by rezzing all of the clothes sizes out, adding all of the invisible prims and taking them all back for later use.

So, here is my problem. Sometimes, not Everytime, when I add the texture later, the alpha mode is toggled automatically to "Alpha Blending" instead of "None". This makes everything look hollow and weird. I can easily toggle it back, but I am wondering if there is any way to stop this from changing on its own. It seems to happen randomly as out of a dozen sizes, maybe 2-3 will change.
 

Summer Haas

Scripted Agent
Joined
Sep 23, 2018
Messages
51
SL Rez
2007
If you are having to set your clothing textures to blending mode None then you are uploading your textures wrong to begin with. Sounds like you are probably using 32 bit PNGs when 24 bit TGA, BMP, or even JPG would work better. You should only use 32 bit if you are actually using an alpha channel, otherwise you are adding quite a bit of texture memory for no reason. Also materials, ie Specular and Normal maps will look significantly better on true 24 bit instead of forced with a None mask.

As far as your settings randomly changing, you might look at applying your textures via a drop in self-deleting script that also sets your alpha mode. If you want some help with this in world I would be glad to put something together for you.
 
  • 2Like
Reactions: Noodles and Eunoli

Clara D.

FOR PRESIDENT 2020!
Joined
Dec 24, 2018
Messages
2,240
Location
Phoenix, AZ, USA
SL Rez
2006
Joined SLU
Back in the day.
SLU Posts
100000000
Just have a copy of the transparent cube for linking to things and link it after you're done texturing the main object, you get the most texture memory savings with SL's default transparent texture, or just use "edit linked parts" to set the cube to the transparent texture when you're done.

As an addendum to Summer's post: if you don't need alpha make sure to "flatten image" in your graphics program, both png and tga will default to transparent if you don't. The safest bet is to export to bmp, which doesn't support transparency. (jpg is a bit lossy)
 
Last edited:
  • 1Like
  • 1Interesting
Reactions: Fionalein and Noodles

Noodles

Queen of Ramen
Joined
Sep 20, 2018
Messages
727
Location
Illinois
SL Rez
2006
Joined SLU
04-28-2010
SLU Posts
6947
Does SL support BMP? Does it convert the image? I have always steered away from BMP because the file size tends to be huge.

I will look into changing the file format. I beleive I have been using the 32bit PNGs mentioned.

How would the script work? I assume it would select "Linked Prim 2" and apply a texture with a UUID of the texture I want to apply. Maybe also selecting "root prim" and applying the linden transparent texture? I hadn't thought of doing that but that does make sense as a way to do things.
 

Clara D.

FOR PRESIDENT 2020!
Joined
Dec 24, 2018
Messages
2,240
Location
Phoenix, AZ, USA
SL Rez
2006
Joined SLU
Back in the day.
SLU Posts
100000000
Does SL support BMP? Does it convert the image? I have always steered away from BMP because the file size tends to be huge.
It converts it to jpg2000 like everything else.

What I do to keep things straight -- I save all "flat" images as PNG (making sure to flatten in gimp), and things I *want* transparent as TGA.

Only annoyance is that Winderps doesn't preview TGA's.

{ETA} Fix for TGA's thumbnails is to install the DirectX SDK and reboot


It's like renting a dump truck to pick up groceries, but it works...
{/ETA}
 
Last edited:

Summer Haas

Scripted Agent
Joined
Sep 23, 2018
Messages
51
SL Rez
2007
I use TGA for everything because you have total control over whether you want 24 or 32 bit. Yes the file sizes are larger because they are uncompressed, but TGA is going to give you the best quality.

Another thing you may notice with PNG is sometimes on your alphas you get a hairline halo around your alpha that is black if the alpha is a hard transition from fully opaque to fully transparent. This is because often the graphic will be automatically filled in with black under the alpha. Due to SL's blur that is applied to a texture, you will see that black poking over into the non-transparent area. With TGA you can avoid that black background and choose what color is matted under the alpha.

If you are working in Photoshop directly with transparency on layers, you can convert that transparency into an alpha channel by using Layer/Layer Mask/From Transparency. Save that layer mask as your alpha channel and you are good to go for 32 bit Targas. This method is 100% reliable and does not result in surprises after you've uploaded.
 
  • 1Like
Reactions: Noodles

Noodles

Queen of Ramen
Joined
Sep 20, 2018
Messages
727
Location
Illinois
SL Rez
2006
Joined SLU
04-28-2010
SLU Posts
6947
I use Photoshop, but most of my textures are not transparent but filled with black where nothing is shown.

On related note to the turn this conversation has taken, can you apply a Transparency to part of a mesh object? I tried it once on some bathing suits hoping to make cut outs on the sides of the waist but the transparent bits showed up white instead of transparent.

For example, say I wanted to add fake tears to some clothing, could I add in transparency and have it just show through?

Or maybe I have a template with some sort of straps on it (hanging off, not covering anything else), but I don't want the straps. I can't edit the mesh itself, but could I alpha those parts out? Maybe I would need to use TGA for that instead of PNG.
 

Summer Haas

Scripted Agent
Joined
Sep 23, 2018
Messages
51
SL Rez
2007
You can do that with TGA or PNG. That's what an alpha channel is for. The issue with it showing up white instead could be due to a few things. It could be that you saved the texture without the alpha channel, ie 24 bit. Or it could be due to your alpha settings not being set to blend or mask with a median cut off.

Play around with the settings I mentioned. Start out with a transparent layer and draw some squiggly lines, then go to Layer/Layer Mask/From Transparency and watch what happens. Also try saving that mask as an alpha channel and then TGA 32 bit. It will show you in the upload window if there's transparency or not. Then try playing with the different mask modes. Try Mask with a cutoff value of 128.
 
  • 1Like
Reactions: Noodles

Clara D.

FOR PRESIDENT 2020!
Joined
Dec 24, 2018
Messages
2,240
Location
Phoenix, AZ, USA
SL Rez
2006
Joined SLU
Back in the day.
SLU Posts
100000000
It converts it to jpg2000 like everything else.

What I do to keep things straight -- I save all "flat" images as PNG (making sure to flatten in gimp), and things I *want* transparent as TGA.

Only annoyance is that Winderps doesn't preview TGA's.

{ETA} Fix for TGA's thumbnails is to install the DirectX SDK and reboot


It's like renting a dump truck to pick up groceries, but it works...
{/ETA}
As a very belated follow-up to this.

When installing the SDK, only the runtime and utilities sections are needed, red-X the rest. Unless you really need them.

You may have to copy TxView.dll from C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x64 to C:\windows\system32 and then register it.

From an administrator command prompt:

cd C:\windows\system32
regsvr32.exe TxView.dll

After all that, TGA thumbnails still didn't work with gimp as the default program for .TGA files, but they do if I set my antique copy of Pre-Corel PaintshopPro 6 to default o_O

To change default in Winderps10: Right-click -> Open With -> Choose Another App -> {App} -> [X] Always use this app . . .
 
  • 1Like
Reactions: Noodles

bubblesort

Active member
Joined
Nov 16, 2018
Messages
339
If you really want to dig into how alpha masking works in SL, you should probably start with Niran's write up about it, over on his Black Dragon viewer web site.

He came up with his own workarounds for this, which may help you. Black Dragon runs extremely slow on my system, but it has some nice features. Somehow I can hit like 80 or 90 fps, but it still takes half an hour for a room to rez in Black Dragon, no matter how I have my graphics prefs set up. They do have an excellent Discord chat, though.