Lights difficult to see in Rack v2 unless room is dim

So, like the topic says. Here are two screenshots from v1 to v2, and notice how difficult it is to see lights now (they’re close to the bottom of both modules). Is this because of the colors I’m using or what? And I should note that the lights look great in v2 dark room.

What is the bgColor of your LightWidget? Lights can only brighten, not darken, so they need a dark background color to be able to distinguish their illuminated color.

1 Like

Ok, I actually don’t have a bgColor set for my lights. Only the addBaseColor(). I’ll try adding a bg color.

I had to set my background to a gray when going to v2 JW-Modules/JWModules.hpp at v2 · jeremywen/JW-Modules · GitHub

2 Likes

Ok I tried setting the background. It looks like I will need to play around with the options now since I have lights that sometimes appear on top of something, and other lights that should essentially disappear when they aren’t on. And in the Cosmosis module, there are lights under the MODE knob that help indicate which line is scrolling. If I use a background to see the lights, they show up but then there’s a grey dot when they’re off. If I don’t use the background they disappear when they’re off but don’t really show up in a bright room.

I’ll have to figure out the best compromise for this.

Note: The following code in this post and the next has been updated to work with the Rack 2 code release from 10/17/2021.

I had the same problem with my QuantMT module, where I have optional reference lights that I want to be invisible when they’re off.

I don’t have a solution, but I’ve come up with an alternative.

I added an override of the LightWidget draw function, where I commented out the calls to nvgGlobalCompositeBlendFunc and drawHalo. This gives me back my constant bright-blue reference lights, but the cost is the complete removal of the light’s halos (halos break badly without the blend function).

I haven’t yet decided if I’m going to switch to this alternative.

ref_lights

  • Rack 1: blue lights look good, but I just learned that my stealth lights don’t work very well with Modular Fungi Lights Off.
  • Rack 2 default: blue lights washed out when bright, but look good when darkened (30% light bloom).
  • Rack 2 alternative: blue lights look good when bright, but no halos very obvious when darkened.

Here’s the (updated) code:

template <typename TBase>
struct PetiteStealthLight : TSvgLight<TBase> {
	void draw(const widget::Widget::DrawArgs& args) override {
		LightWidget::drawBackground(args);
		Widget::draw(args);
	}
	void drawLayer(const widget::Widget::DrawArgs& args, int layer) override {
		if (layer == 1) {
			//nvgGlobalCompositeBlendFunc(args.vg, NVG_ONE_MINUS_DST_COLOR, NVG_ONE);
			LightWidget::drawLight(args);
			//LightWidget::drawHalo(args);
		}
		Widget::drawLayer(args, layer);
	}
	PetiteStealthLight() {
		this->bgColor = nvgRGB(0xbb, 0xbb, 0xb0);
		this->borderColor = nvgRGB(0xbb, 0xbb, 0xb0);
		this->setSvg(Svg::load(asset::plugin(pluginInstance, "res/PetiteLightFlat.svg")));
	}
};

1 Like

Update to my previous post: I realized that if I like the alternative light and the default halo, why not just do both of them?

I copied my light definition, but this time I used the default background colors and blend function, and disabled drawBackground and drawLight, while leaving only drawHalo.

The only disadvantage is that this now requires two light instances for each of these types of lights.

Also add the following (updated) code:

template <typename TBase>
struct PetiteStealthLightHalo : TSvgLight<TBase> {
	void draw(const widget::Widget::DrawArgs& args) override {
		//LightWidget::drawBackground(args);
		Widget::draw(args);
	}
	void drawLayer(const widget::Widget::DrawArgs& args, int layer) override {
		if (layer == 1) {
			nvgGlobalCompositeBlendFunc(args.vg, NVG_ONE_MINUS_DST_COLOR, NVG_ONE);
			//LightWidget::drawLight(args);
			LightWidget::drawHalo(args);
		}
		Widget::drawLayer(args, layer);
	}
	PetiteStealthLightHalo() {
		//this->bgColor = nvgRGB(0xbb, 0xbb, 0xb0);
		//this->borderColor = nvgRGB(0xbb, 0xbb, 0xb0);
		this->setSvg(Svg::load(asset::plugin(pluginInstance, "res/PetiteLightFlat.svg")));
	}
};

And then when placing these lights, use both of these:

addChild(createLightCentered<PetiteStealthLight<BlueLight>>(mm2px...
addChild(createLightCentered<PetiteStealthLightHalo<BlueLight>>(mm2px...

I had the same issue when migrating Stoev modules to v2. In the end, I had to change the background color to gray too. It seems we don’t have any other options at the moment.

It’s worth mentioning that you can either set the bgColor of the light itself, or, if the light is transparent and sits on top of another component, change the color of that component.

It would have been great if we didn’t have to do this, though, as it (significantly) changes the module’s appearance when the lights are off.

Maybe you can override LightWidget::drawBackground() to set your bgColor’s alpha to that of the foreground color. That way when the lights turn off the background will turn off too. Something like this:

void drawBackground(const Widget::DrawArgs& args) override {
		this->bgColor.a = this->color.a;
		LightWidget::drawBackground(args);
	};
2 Likes

@xandra-max, I have tried your suggestion, and it works great. Thank you!

1 Like