Okay, be warned, this is something of a mega thread as there's a lot of background associated with my investigations into this blending technique and I've been researching it since about 2017 and it is by far one of the most fiddly and frustrating shader/blending/mesh manipulation techniques I have ever come across in game development so far. Procedural generation is more straight forward than this damn thing.

I've been working on my game for a long while now and had to switch over from Unity as some people may know from a bit of my ranting on the topic. I can implement just about every mechanic myself now thanks to people explaining things to me except for this very specific effect I'm looking for. In Godot terms the idea is that I have a village with a sphere collider around it, this dictates where you can and can't interact within the scene.

I've managed to set this up even in 3.5 absolutely fine but the problem arises when I want to implement the visuals to represent this. That is, a transparent outline representing the colliders so that the players can see what's going on. It would be extremely ugly simply having a bunch of spheres overlapping each other or just lazily putting rings in and calling it a day so I've been trying my hardest learning about how to make something neater and that is rings which do not overlap each other but blend nicely as they grow in size. It's a really nice effect when it works but difficult to pull off in any engine.

Games like the original Black and White 1, Civilization VI and Elite Dangerous to a degree all have this effect, here are some examples.

https://blackandwhite.fandom.com/wiki/Influence

Elite Dangerous is a more complicated setup but that one is within an entirely 3D space and it looks great, I would love to know how they did that as well properly but it's a pretty complex thing to pull off. Now, as far as actual implementation of this effect, with a lot of help I managed to get the effect working in Unity and it looks so nice. The big question is going to be can we pull off the same effect in Godot 4?

Now I'm calling out @cybereality here a bit because they claimed it would potentially be better to set things up in Godot 4 so now that the stable version has been released now I believe is the time to experiment, this is ultimately the effect that I'm looking for.

I'm posting up the previous unity threads as well in a more organised manner as they should provide a lot of insight into how me and the other devs managed to get the effect working.

https://forum.unity.com/threads/black-and-white-1-style-overlapping-influence-border.1146602/

This is where I ended up with the Godot 3.5 implementation, I managed to just about get a similar effect using the shader outline people suggested and viewports, however the movement was not behaving itself because there were quite a few problem with the outline shifting about with the camera positions and they would not stay static. I did however managed to achieve the visual effect that I wanted for the most part, but it would inevitably take some tweaking to match the terrain.

https://godotforums.org/d/31383-multiply-ring-viewport-effect-scale-rotation-and-positioning-issue

https://godotforums.org/d/30372-how-to-prevent-ring-overlap-with-a-3d-material/34

I'm pretty determined this year to finally tackle this problem in Godot 4 and hopefully leave this mega thread here for people to see so they can implement it in the engine if they want to as well.

Okay, I see exactly where you're going with this now and I freely admit I was sceptical about how it could be implemented but I was glad to be proven wrong on this count and it's just because I've had such a nightmare implementing any of this previously lol. So what I did was I got a simple 2D circle from krita that I made, imported it in, and with some appropriate scaling of height voila, I now have a 2D overlay for my influence that I did in five seconds. Obviously I'd have to code everything properly so the radius matches but this is a great proof of concept. I'm actually floored at how easy this is and I haven't even messed with anything complicated yet.

The big question is though, how can we we replicate the ring effect in 3D? I did spot an option that I found interesting which might be part of the answer and that's a 3D Mesh Texture, however I have no idea what it's supposed to do, I was wondering if we could put a custom mesh on that and use it somehow and take advantage of that decal projection you were describing which I can see playing out now.

At least now I have some sort of workaround or alternative and can have my influence represented properly on the terrain, people may even prefer the 2D look so I'm going to keep that as an option you can switch between.

Very nice, just needed to change the cull mask for the decal and then the visual instance layer for the terrain mesh and it's now only projecting onto the terrain like I want.

Oooo, I bet with decals now could probably do a fancy 3D project selection box if you wanted to but I won't get distracted.

Two things I have noticed with this setup, when the decals merge with each other the colours seem to bleed a bit somehow, I want to make it so that the colours stay consistent even when merging, there is also some odd pixelation effect happening on the borders of the decals depending on the angle I put my camera at. Would be nice if someone told me how to fix this.

6 days later

Would appreciate an answer on the decal situation with the colour and the pixelation now the forums are back to normal, going to poke around the settings and see what I can find.

I am staggered at how easy decals are to setup in Godot 4, CyberReality was right, but why did they then decide to make it difficult for me to find out how to deal with blend modes? Am I going to have to troubleshoot custom shader solutions with people again? 🙁

The ideal solution here would be for me to re-use that method CyberReality posted me about where you have a white circle within the ring, this would be easily solved if I could just make another decal and have it overlap with a multiply mode enabled on the decal I think it was we originally used. By the way, in case you guys had been pondering the decal node yourselves, it's fantastic for bullet holes, already experimented with that, I can easily see it being used for blood or even mud effects if you want to get fancy.

I would also really like to know if it is possible to make these rings I've got look more 3D and give them some Y depth.

For the sake of visualising this is what I have in mind.

I'm 99% sure this will work if I can get some sort of multiply effect on these decals then I will be very happy.

Holy mother of god I think I found the solution, I just don't know how to do MeshTextures at all, will do research, MeshTexture lets me have the standard materials so surely it should mean if applied to a decal I will be able to get the blend modes working right? This should also mean that I can have my 3D rings without too much trouble.

You can have two layers of decals. The first layer is transparent (the edge, this can just be a filled circle) and then a second layer on top that is a solid color like white. You don't need to mess with the blend modes, but you might have to change the render priority so the white circle always draws over the orange circle.

Bear with me because I've always struggled a bit with sorting orders and blend modes, I don't see an option for render priority in the decals for image textures, would I need to make the decal node a different way to deal with the render priority? I did see a sorting option but that hasn't done what I'm looking for.

When I get this all setup I'm definitely doing a bit of a writeup on this thread partly as a reminder to myself but it should help anyone trying to look at these sort of effects for Godot.

Does anyone know if there's a way to increase the scale/radius of your decal without any stretching behaviour happening? Or is that not possible? I've noticed the ring gets massively thicker as you increase the size.

8 days later

I thought I'd post some screenshots just to show what's going on properly, would be nice to be able to increase the ring without the decal stretching at all, I think that's what's going on.