Advertisement

Making soft, blobby lights

Started by May 21, 2022 11:00 AM
4 comments, last by Thaumaturge 2 years, 6 months ago

For a project of mine, I want to implement a form of lighting in which individual lights merge into blobby masses of light. The trick is that I don't want their intensities to accumulate: I want them to fade into each other instead.

However, I'm finding myself stuck on how to do so, and hence come here in the hopes that someone will have some aid to give!

So, consider two simple, fuzzy lights. (For the sake of simplicity I'm using approximations created in an image-editor; they're not quite the same as my actual lights, but they should hopefully serve for illustrative purposes.)

Thus far I've been combining my lights by taking the maximum value at a given point. This prevents accumulation--but doesn't look great:

Simple addition, however, naturally produces accumulation:

What I'm hoping for instead is something like the following--merged, soft, and non-accumulating:

Now, the “metaball” approach produces a promising silhouette--but only in silhouette.

And thus far all attempts--of which I've made a number at this point--at finding a way to shade the “metaball” approach using light-intensities have failed. In particular, I had a shot at producing intensities via weighted average--but either I was mistaken in my approach or it didn't work as I'd hoped.

So, all that said, does anyone here have any suggestions?

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

Given light values l0 and l1 in the range [0, 1], you can try using l0 + l1 - l0 * l1. This will give you a smooth continuous function that looks like addition for small values of either l0 or l1 without ever exceeding 1.

Advertisement

@a light breeze Ah, indeed, that looks like just the thing--thank you very much! ^_^

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

I think Inigo Quiliez' SDF blending functions would work.

Here a blend of two boxes, and there is no accumulation effect in the interior:

I use the ‘exponential blending’ here, which is order independent.
I guess that's also often used for meta balls.

@JoeJ Ah, sorry--it looks like we replied at pretty much the same time!

Indeed, if the approach given by a light breeze, above, turns out to not work in some case, then what you post looks like it might well be worth investigating. Thank you! ^_^

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

This topic is closed to new replies.

Advertisement