[BUG] Translucent Texture always displays as fully opaque with Verse

Translucent Texture always displays as fully opaque with Verse

Hi everyone, recently, I’ve been writing Verse code to create a canvas and display an image inside of an overlay. As of now, the code I’m using looks like this:

TranslucentTexture := texture_block{DefaultImage := TranslucentImage, 
                      DefaultDesiredSize := vector2{X := 300.0, Y := 50.0}}

Widget := overlay: 
              Slots := array:
                 overlay_slot:
                    Widget := TranslucentTexture

Canvas := canvas:
              Slots := array:
                  canvas_slot:
                      Widget := Widget
                      SizeToContent := true

PlayerUI.AddWidget(Canvas, player_ui_slot{InputMode := ui_input_mode.None})

Note: I’ve cut out some parts of the code such as the if statement for getting PlayerUI for sake of brevity.

The image TranslucentImage is an image with 50% opacity.

When I run this code in my session, the image displayed on the screen is at 100% opacity. It seems like the opacity value in the original texture is automatically being set to 100%.

Does anyone know why this could be happening and if there is any way to fix it?

Also, I have tried using a color_block to display a yellow color_block with 50% opacity (using DefaultOpacity := 0.5), but it ends up being completely opaque yellow instead of being a bit translucent. Furthermore, when I use the TranslucentImage texture (from the code above) in a Widget Blueprint and then I display the Widget Blueprint with the HUD message device, it is displayed with the correct opacity. With the Verse code, however, it is always displayed as opaque. :frowning:

Update: The issue seems to be related to the AddWidget() function for a canvas. When using this function, the alpha channel of the texture in an overlay seems to be overridden to zero. I wasn’t able to completely pinpoint the issue, but I was able to narrow it down to something surrounding AddWidget().

Thank you for letting us know. I forwarded this info to the devs.

Update: The error was on my end and wasn’t because of a bug in Verse. I was accidentally continuously displaying the same image on top of itself without removing the previous canvas before. Continuosly overlaying a translucent texture will make it darker over time, so it created the illusion that the alpha channel was being overridden. Getting the PlayerUI with GetPlayerUI and removing the previous widget fixed the issue. Sorry for the confusion.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.