Trying to grasp textures + blend modes additive/alpha blended

Hey all,

I’ve recently run into a huge question while learning a bit more about making my own textures and shaders for VFX.

Essentially, the primary confusion I have has to do with the standard of using black backgrounds for textures.

I primarily use Unity with Amplify Shader Graph and Photoshop, if that matters.

I’ve recently run into the issue of trying to make simple additive and alpha blended shaders and their transparency. One for glow/brightness, and the other for contrast/being able to render darker colors. However, if you use the same black background-white foreground texture for both of these shaders, you run into a problem with the alpha blended one where it creates a black outline due to the background.

I came across this post which aligns with my concern: Alpha blended in Unity with texture from Substance Designer - with the statement that you can’t use black in a texture that is being used for both additive and alpha blended.

Sure enough, after hiding the black background in photoshop and reexporting using a transparent background, it worked great for both additive and alpha blended.

However, I was under the impression that black background was fairly standard when it came to texture creation. Almost every tutorial and free vfx texture pack I’ve seen is fairly full of black background textures. I am really curious on why this is the case if there is a problem like this: is there something else I can do in the shader creation or importing of the texture that fixes the issue? Is there another reason black background is a standard?

A bonus question in the same vein: When do you use color in the texture itself rather than controlling it in the particle system? What are the benefits in doing so?

Thanks in advance.

2 Likes

Hello there :grinning:

I don’t know anything about using color directly on the texture (I’m a newbie!) but I know sampling a Gradient is very common and is also referred to as LUTs as far as I know.
By doing so you can have multiple colors on the effect and they will blend pretty smoothly :star_struck:

In this post Rensei taught me how to do it in Unity Shader Graph, check it out:

Black background is not a standard for any textures that will not be used as additive because of the reasons you noticed. It’s considered bad practice. Ideally you expand the edge pixels all the way to the edge of the textures, or you find a good background color that matches your texture better.
If it’s the render of a simulation and that’s not a possibility for some reason, you have to unpremult/divide by alpha to get rid of the edge.

You use color in the texture when you need the detail. The particle color can only provide a single color to the whole texture while you can add whatever you want in a DCC. If it’s just a grayscale texture and you are happy to just tint it, then do so. But let’s say you are making some debris, and this one piece is a snickers wrapper. That’ll be very hard to color correctly with just one color from the particle. Of course you could set it up with level masks and LUT it, but at that point, you might as well just texture it properly.

1 Like

I suspect pre-multiplied (on black) precedent we still see really has to do with two things

  1. Easier to share a single RGB image online
  2. PRE-webgames - Affter Effects blend modes like ‘overlay’ and ‘screen’ so black video/textures are fine
  3. TGA and TiFF formats had been the go to for a while
  4. PNGs are relatively new (year > 2002) due to Flash games explosive adoption rate and the fact that Photoshop never made an RGBA png and never has done a good job of it…
    which is why SuperPNG is basically essential for me

but how did all this happens? how things develop - technical and historical - I will do my best to succinctly and thoroughly detail how i believe all this has happened which means it is also going to be verbose and long

because of expectations teams adopted for blend modes

Additive is often

Blend SrcAlpha, One

alpha fades the texture but additive since blending means _Tinting texture *= (0,0,0) is identical in function,

details

alpha channels is now a waste of memory and use/data becomes redundant
(32bit RGBA + PVRTC 4BPP = bad artifacts; yes places still use PVRTC 4BPP)

Then you have Alpha blending

Blend SrcAlpha OneMinusSrcAlpha

RGB is going to be RGB *= Alpha ‘darkening’ your color and yields undesirable dark halo; When you attempt to use a 24bit texture that looked fine Additive it won’t look right in Alpha blending…

to re-address how to standardize texture authoring…which is why i made the fits all solution for Unity users outlined in the link details

Unity extended function to utilize Photoshop’s native PNG compression so artists can author simply with transparency and the file works for both additive and alpha… (even though I completely misunderstood the OP issue with regard to doing it in substance)


contextual opinions based on experiences where things differ UNity vs UE perhaps
Black ‘flattened’ VFX texture is standard for me in projects because RGBA Pre-multiplication blending supersedes use of alpha/additive blend modes

  1. Pre-mult performs both
  2. eliminates two shaders → 1 which intrinsically means draw call savings
  3. functional against bright backgrounds

I never desire [Source] * SrcAlpha I find it it’s redundant frankly


When using files in software like Maya/Unity you are shown 24bit RGB thumbnails — due to Photoshops native PNG format (insert rant) transparent pixels (for compression sake) are ceilinged 1,1,1,1 (white)

checking these files often shows White bounding box / ‘artifacts’ from runline compression in the thumbnails
image
such a nuisance that making PNGs on black became a standard at mobile studios


it was semi-recent ‘alpha’ = greyscale was added so you can convert textures in Unity and get a more comprehensive project layout
image

image
obviously helpful for flexibility and for teams to see objects in project


BUT :white_check_mark:

All this takes a backset to the sheer experience the artist/team has when it comes to working with textures in shaders

the only reason I would use a pre-multiplied (on black) texture for ‘reason’ when not using premult blend modes is

  1. restrict textures to 24bit for memory savings (PVRTC 4bpp is better quality)
  2. and because the project ONLY uses Additive blend mode

there are also artistic expectations / contrasting opinion. many expect Color should be *=Alpha so that sliding ‘transparency’ produces a fade no matter what

this is the difference between additive being

Blend SrcAlpha, One
vs
Blend One, One

It is My opinion Blend One One IS technically ‘additive’
these textures should not have an alpha to save memory, that would be the point. a 24bit RGB on black texture functions identically since LERP RGB → (0,0,0) ostensibly IS transparent . So there is no need to have 33% more texture memory, gain more artifacts with hardware compressions nor even use transparency/Alpha functions & data

1 Like

Right, there is a place for it but I wouldn’t call it standard. Look at your last few sketchbook posts for example, they all have a black edge/glow. Which is super cool when that is the look you are going for, it makes sense. But there is quite a lot of effects where you need clean edges without having to worry about the blendmode. For example in Unreal. And for realistic effects, it puts a lot more pressure on your alpha being perfect to avoid artefacting.

1 Like

my post is long tl:dr

It’s not a standard; that is/was my point, more of ‘why does the OP feel confused’

people copy/paste
lots of textures due to compositing flexibility like ‘overlay’ and ‘screen’ has made on black TGA very ‘common’ but i wouldn’t say standard

more unusual to find people making a perfect (RGBA) png and posting it like this
soft_circle
or taking the time to show an alpha blend version sorta like
image