[SOLVED] Alpha and multiple Sci-Fi laser beams

In my current project I need to achieve the effect that is commonly seen in various sci-fi games, where, for example, multiple ships fire multiple semi-transparent beams. However, I am getting into the well-known issue that alpha on some of the beams cancels pixels of other beams, and also, occasionally, other transparent geometries that are in the 3D field (and I am very well aware of what is said here: Alpha/Transparency Sorting, Your Z-buffer, and You).

Currently all my beams are a single dynamic mesh with a simple texture that has alpha fade-off toward the edges, with blend mode set to alpha, and the queue bucket to transparent.

How do I achieve the effect that these beams and other transparent meshes do not cancel each other, so I could display many such beams? I have experimented with blend modes and render buckets, but it did not change anything, some beams still cancel others.

I would appreciate an advice on this, since I am certainly sure that this is somehow possible because games like Homeworld handle hundreds of such beams, starship trails and other transparent entities on screen. The original Homeworld had even managed to do it in year 1999.

I think there are only two real options… sort them by depth based on the current view (an imperfect solution).

Or, draw them last (translucent bucket) and turn off depth write.

Note sure what other solutions there could be.

Edit: I mean, yes, screen door effects can work for some things but maybe not here.

…and those other games you mention might have been using a additive blend mode instead of alpha… probably alpha add.

1 Like

It worked! Thank you very much! Turning off depth write was the way to go! Plus I set the additive alpha blend mode as per your advise. With the additive move, the beams look much better than with other settings.

For now I’ve set the bucket to be the transparent one because I have some 3D GUI elements that have to be over anything, even the beams. But later, I think, I’ll experiment with moving the GUI to a dedicated viewport for this.

Is the GUI 3D then? If it’s in the guiNode then it’s already rendered over everything else.

Yeah, the GUI is like normal objects within the scene. I am still not sure if that’s a good option, but it will require more experimentation to decide upon it. It’d be cool to have 3D GUI elements in the game.

Yeah, I do it all the time. Lemur was written with that in mind.

…so I wasn’t picking on you. Just asking. :slight_smile:

Hehe, I’ve already linked Lemur to the project and did some experiments with it. I plan to use it for the windows-and-buttons part of GUI. And that also brings us to the next question :slight_smile: Lemur texts and fonts (Lemur + JME-TTF ?)