maptool icon indicating copy to clipboard operation
maptool copied to clipboard

Aesthetic Light Options - Gradients/Fades, Blending modes

Open melek opened this issue 5 years ago • 9 comments

Is your feature request related to a problem? Please describe. A few options would make lights 'prettier' in MapTool. This is related to the additive color/darkvision issue #1895, but is a feature request on top of that. These changes would combine with Additive lighting to make really neat, stage-lighting like effects.

Describe the solution you'd like

  • Gradient lighting effects that support fading to black/no light, particularly so you can 'fade out' a torch light into the darkness.
  • CSS Blending modes, especially 'Screen' for normal light. Would allow for a variety of effects like desaturation, darkening, fog-like effects, etc.

I love me some glowy light effects. Perhaps this would generally separate the lights mechanics from its presentation, but I'm not sure that is needed.

Describe alternatives you've considered Using MT lights to illuminate pre-rendered glow effects on map images. Blah!

Additional context Samples of how lights could look: image image

melek avatar May 21 '20 20:05 melek

I found a relatively easy solution in AWT's RadialGradientPaint, though it only does a linear interpolation between the two provided colors (including alpha), so stuff like this would take more work:

lamp: circle 20#ffffdd>#000000    linear
lamp: circle 20#ffffdd>>#000000   inverse square
lamp: circle 20#ffffdd>>>#000000  inverse cube

I'm definitely interested in this, though. It could easily give maps more ambience if done correctly!

adyoungblood avatar Jan 17 '22 01:01 adyoungblood

If there is a performance concern we can always make it optional per client.

Phergus avatar Jan 17 '22 12:01 Phergus

It would definitely look nicer/more modern.

Thanks for working on these lighting issues @adyoungblood !

FullBleed avatar Jan 17 '22 15:01 FullBleed

In addition / as an alternative to gradients, we could use assets as textures for light sources. That would allow creating subtle lighting effects. Here's a sample of what that could look like with a fairly simple tinted light: image

kwvanderlinde avatar Aug 25 '22 10:08 kwvanderlinde

In addition / as an alternative to gradients, we could use assets as textures for light sources. That would allow creating subtle lighting effects. Here's a sample of what that could look like with a fairly simple tinted light:

That looks really interesting...

Can you provide some more examples? How would such textures blend? That doesn't look like it's using the new additive light method...

FullBleed avatar Aug 25 '22 13:08 FullBleed

It is actually using the new blending. Here's an example that uses the same asset as a texture, but tints it three ways (red/green/blue): image

This is what it would look like on a plain background: image

Do note that I did this as a hacky POC, so the colours may not be 100% as they should be. The general idea is there though.

kwvanderlinde avatar Aug 25 '22 17:08 kwvanderlinde

Oh, then, I think that's a pretty nice option. :)

Though it does kind of "washout" the map more that I'd expect. If you have photoshop, pop open that map image, put down a circular yellow fade to alpha, set the layer to "soft light", and drag the light around. See how that preserves (even "highlights") map details instead of washing them out? Could MT pull that off?

FullBleed avatar Aug 26 '22 04:08 FullBleed

Short answer is "yes": image

The long answer is that we can't do it performantly. I am hoping that once we get libGDX integrated we'll be able to pull off some more interesting effects in a way that doesn't absolutely destroy performance.

kwvanderlinde avatar Sep 24 '22 09:09 kwvanderlinde

What a shame... that looks pretty amazing!

The headwinds that Craig indicated libGDX has dashes my hopes for that happening any time soon though. :(

FullBleed avatar Sep 24 '22 18:09 FullBleed

I've been hacking away on adding a lumens overlay + environmental lighting, and I experimented with textured lights when that was still in the PoC stage. I think the idea worked out pretty well, so I intend to pursue it further.

The idea is that a light can be textured using any image asset, and we would tint the image according to the light's colour. The experimental light syntax I used for this was:

Light: circle 20#ffa500+100 40#a56600+50 texture=asset://dbd1a5eb4d3a883289813183c40636dc

So a light can have a single texture, but each range can have its own tint.

While I only focused on asset URLs (they are the most general), we could easily support certain keywords that use predefined textures, so that users wouldn't have to provide their own textures for basic effects. E.g.:

  • texture=flat would correspond to today's lights (solid colour, no fade) and would be useful for upgrading existing campaigns.
  • texture=linear would be a linear radial fade, and would make a good default for new campaigns (I've found this effect is enough to make maps "feel good"). It would also be easy to implement using @adyoungblood's suggestion of RadialGradientPaint with two keyframes.
  • Various other fades could be supported either by making our own paints for them, or by approximating the curves using RadialGradientPaint with multiple keyframes.

For anyone following this FR, let me know what you think of this approach.

kwvanderlinde avatar Feb 15 '23 06:02 kwvanderlinde

I think the most important feature to create "good looking" lights is a simple fading out RadialGradiantPaint. This would lights make look like lights. The visualization of transparent light overlays in version 1.12.0 has nothing to do with "lights", while the flat lighting in version 1.13.0-beta.1 can be considered as "lights" and indeed a significant improvement compared to how it was before. However, it is still apparent that real lights don't overbrighten the background like it currently does.

When using textures i think it would be great if the colors of the gradient stop would be optional, so that wierd magical lights would also be possible where the hue also comes from the texture.

One more thing I would like to consider for future improvements is animation. I believe that to make light sources more immersive, a flickering torch in the wind would be great, which could be achieved by scaling/rotating the light's texture according to some keyframes we could include by default (e.g. "flickering" for torches or campfires). Since this is not as important as radial gradients, I would keep this in mind while focusing on the more important improvements for now.

Furthermore, as a framework developer / gm and player, I would also like to mention that I am really looking forward to your work here. :)

Lector avatar Apr 09 '23 09:04 Lector