This meant there were both “Fade” and “Transparent” modes. But they only exposed the same set of blend modes for both the lit and unlit versions of the shader. For the most part these were a huge upgrade from the older shaders in terms of functionality and useability. Basically they made the change and then they removed any resources for working on particle or shader related stuff, and by the time they put more resources on it a few years later the argument was “well, someone might be relying on that broken behavior now, so we can’t change it”.įast forward a few years and they brought out the “Particle/Standard” shaders. Several of us noticed this broken behavior immediately and pointed it out, but they ignored the complaints for multiple years. I say “correct” there, but it depends on if you consider a shader to be “a premultiplied shader” depending on how it handles the color multiplier’s alpha value & output blend mode, or just if it works with a premultiplied input texture. The “correct” fix would have been only multiplying the RGB, but because it’s also multiplying the alpha by itself it produces a broken output. The shader multiplied the output RGB A by the alpha to incorrectly mimic traditional alpha blending, but can take a premultiplied alpha texture. So they modified that shader so the alpha also modifies the opacity, but they did it wrong. There were a lot of complaints that the default particle shader didn’t fade when the alpha was reduced, which is expected since it’s was a premultiplied alpha shader, but obviously confusing for those unfamiliar with it. The original default particle shader was a proper premultiplied alpha shader in Unity 5.0 and prior, but they “fixed” it in Unity 5.3 … by modifying the default premultiplied shader to no longer be premultiplied. Unity’s internal shader devs have consistently misunderstood premultiplied alpha for the last 5 years, and it’s incredibly frustrating. It also means you can paint black into the Alpha where you specifically want to remain a ‘hot spot’… or white in the alpha to keep darker/opaque spots. Premult also means color and alpha share no overlapping operation to make VFX fade out you must tint RGB & Alpha both to black X + means X’s addition are proportionally larger when blended on non-black content. *the catch being all alpha values < 1 operate non-proportionally since you are adding values to a multiplied destination - You will always get brightness on the feathering of VFX when Premultiplied (see blue laser in my post above) If you just supply it a value of 1 then this is nearly* identical to Alpha blending. Premult blend expects an alpha value to operate on destination. painting what you want on black is the idea of it being pre-multiplicative Yes illustrating for premult blending is identical to Additive blending in terms of RGB. I don’t think you can salvage the blend mode in the shader preset pulldown, you have to compile and make it by hand CG/HLSL or w/e language afaik the pulldown in Shader graph is broken and has been for a whileĭraw on a black background (with alpha) but without multiplying it with anything pre-engine? It darkens source color creating black halos on VFX as well as causes it to go ‘invisible’ Identical & redundant to Blend srcAlpha, OneMinusSrcAlpha That breaks Pre-mult because it multiplies Color by alpha. The destination is ‘masked’ identically to a multiply layer by 1-alpha (e.g.Source behaves identical as an additive layer (linear dodge layer in photoshop).Pre multiplied alpha blending = Blend One, OneMinusSrcAlpha So before you add them you may ‘operate’ on them with a number of optionsĭstColor = multiply by the Destination color values (incase you want to tint your source with the destination below it) Source * (operation) + Destination * (operation) Output Alpha = * OpacityĪll blending is performed by summation in the final step: Output RGB = Texture RGB * ( Vertex RGB * Tint RGB) * Emission Intensity So I came up with this formula to use in Unity Shader Graph: Where it is Black in the alpha channel, RGB black would be come transparent.įor premultiplied blend mode to work, it would have to use premultiplied textures, which are textures that have the RGB multiplied with it’s own alpha channel. For alpha blend, the image is masked using the alpha channel?Īnd the premultiplied blend mode is meant to use the alpha channel to determine where the texture is additive (black) and where is alpha blend (white). For multiply, the imagine is multiplied with the background. For additive, the image is add to the background. Here’s my current understanding: in engine, to create transparency, the image on top is blended with the image behind it. I’ve read this: Alpha Blending: To Pre or Not To Pre | NVIDIA Developerīut I’m not too sure what “SourceColor” or “DestinationColor” is referring to. I’m using version 10.4 of shader graph/HDRP/URP for this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |