Lemur IconComponent issue with transparent icons


Curious why “AlphaDiscardThreshold” is needed for IconComponents? And is there a way to turn it off globally for IconComponents in the style?

UI icons might have a transparent shadow on them, specifying “AlphaDiscardThreshold” will eliminate the shadow.

See shadows in this Lemur Label example:

Without “AlphaDiscardThreshold”:

With “AlphaDiscardThreshold”:

Note, the blue background is the skybox.

I don’t know. It seems like layering would have taken care of any ordering z-buffer issues… so it might be a hold-over from something ancient.

No… at the moment this would have to be reset after the icon component is created.

…at least until the problem is fixed properly.

Looks like it is also used in “QuadBackgroundComponent” and “GuiGlobals.loadFont” too.

Do you build Lemur from source right now or just use a standard release?

Build it from the source.

Cool. I’ll see if I can fix it in the next few days.

1 Like

I’ve just checked in a fix that should solve your problem… though it may slightly create problems for others. At least the value is not hard-coded anymore.

Basically, I allow alpha discard to be set on QuadBackgroundComponent and IconComponent and it now defaults to 0 instead of 0.1. (May be a breaking change for some… though even in the demo code I found it to have fixed a problem I didn’t even know was there.)

Lemur got its start from the UI code for the second iteration of the Mythruna engine and all of those UIs were 3D. Alpha discard was kind of important in that case. (Though that was also before layers were added to enforce local sort ordering.) For 2D UIs, alpha discard should not even be necessary because the JME Gui bucket always sorts back to front on hard Z. There is no room for “which angle am I looking” style interpretation messing things up. And I think for the 3D case, most issues will be resolvable with layering since even a 3D UI will probably have rectangular (or at least full-coverage) backgrounds on the base layer.

This new alphaDiscard is only “stylable” in the sense that the IconComponent or QuadBackgroundComponent themselves are stylable. If application code is setting the icon directly for some GUI element then they will have to be aware of it and set it if they care to. But even that seems best as one icon might require one value while a different icon requires another.



Is this the same as clearing the param?

Also, is this one left out intentionally?

Is it causing you issue?

Fonts are one of those ones that are super hard to fix at the application level and are pretty much always jacked up whenever used in 3D without discard. The fixFont() method exists for no other purpose.

No. I looked for some method to remove a parameter but “clear” was the one name I didn’t think of.

Given that alpha discard is wired to a define, I believe it’s essentially the same as not setting it when it’s zero. But it is an oversight that I didn’t clear it.

No, but it could be an issue if the font has shadows.

You will find that bitmap fonts don’t like shadows. The letter quads overlap and things potentially get really janky for anything that goes outside the letter borders.

…moreover, the shadows would also become colored.

There are numerous reasons that shadows won’t work well built into the font… and coincidentally they are very similar reasons to why alpha discard is pretty much required for rendering the fonts in 3D.