Add "overlay" as a supported blending mode

Things that we aren't going to implement
posila
Factorio Staff
Factorio Staff
Posts: 5408
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Add "overlay" as a supported blending mode

Post by posila »

In https://www.factorio.com/blog/post/fff-172 I mentioned formulas that are used for blending. Tinting only removes color, so if you have a white highlight, it can't be in layer that has tint as that would make it not white. Deadlock's suggestion to make the highlight another layer is pretty good ... it might be worth thinking if the highlight can be in the base sprite and mask transparent in regions that are supposed to have the highlight.

Our artists usually tint masks with non-premultiplied alpha 0.5, making them semi-additive.

But sometimes one mask is not enough. Biters and spitters have two masks, and I tried to do the math to see if I can combine them with identical result, but I can't. Which is a pitty because units are most VRAM hungry entities due to size and shear amount of different animations combined with 16 rotations. Luckily, rendering backend overhaul and texture compression improvements in 0.17 seem to have been effective as we didn't get usual wave of "The new update is uplayable for me with my <insert mid-range GPU from 5 years ago> with high res sprites" posts while at the same time the update had the largest amount of sprites updated to high resolution. What I am trying to get to ... you probably don't need to try to be super optimal, and it won't be problem with most people. And people with poor computers probably don't expect to be able to mod the game heavily.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Add "overlay" as a supported blending mode

Post by Deadlock989 »

posila wrote: Wed Mar 11, 2020 11:22 am In https://www.factorio.com/blog/post/fff-172 I mentioned formulas that are used for blending. Tinting only removes color, so if you have a white highlight, it can't be in layer that has tint as that would make it not white. Deadlock's suggestion to make the highlight another layer is pretty good ... it might be worth thinking if the highlight can be in the base sprite and mask transparent in regions that are supposed to have the highlight.
I tried to say that before but it came out wrong ... But yes if you have made your own masks that have white highlights, you could bake those highlights into the base layer and then subtract their lightness value from the alpha of the mask (or add it? I can never remember which way round alpha values are).

I feel like I want to point out that white highlights make things look very non-metallic, giving them a "ceramic" effect. If your intended effect is metallic then it's fine to use only a tinted mask because metals reflect lights back tinted by their own colour.
Our artist usually tint masks with non-premultiplied alpha 0.5, making them semi-additive.
I followed that convention with turrets because it produces the same kind of results as vanilla does for runtime masks. I found that it made life harder with things like crafting tints where it's easier to be able to specify the "real" colour and have the alphas as part of the actual masks, e.g. for things like the ore in these drums. They also had a white highlight layer to make them look more like there is water sloshing over them (simulated with a randomly displaced transparent shiny grid over the ore blobs).

Image
Post Reply

Return to “Won't implement”