[BUG] BP - Alpha on Draw Rect no longer appears to work

In the latest Rocket, I did following (black fade in the moment the game starts - timeline auto starts):

This worked perfectly fine in previous build. Does not work in this new one.

I tried to disconnect the timeline and just manually enter the Alpha. No matter what alpha value I enter, I can never make the rect semi transparent. It is always 100% opaque, as if it ignores alpha.

Hi Sjoerd,

Sorry for the delay in response. We are working on getting the right person to answer this issue. Thank you for your patience.

-Alexander

I have the same problem when using DrawRect in c++ code

the HUD function, DrawRect, the alpha channel does not work at all

and that has made things a bit difficult for my hud plans :slight_smile:

Even though the comment says “can be translucent” that does not appear to be true in this build

hud.h

/**
	 * Draws a colored untextured quad on the HUD.
	 * @param RectColor			Color of the rect. Can be translucent.
	 * @param ScreenX			Screen-space X coordinate of upper left corner of the quad.
	 * @param ScreenY			Screen-space Y coordinate of upper left corner of the quad.
	 * @param ScreenW			Screen-space width of the quad (in pixels).
	 * @param ScreenH			Screen-space height of the quad (in pixels).
	 */
	UFUNCTION(BlueprintCallable, Category=HUD, meta=(BlueprintProtected = "true"))
	void DrawRect(const FLinearColor& RectColor, float ScreenX, float ScreenY, float ScreenW, float ScreenH);

Rama

What version are you using ?
There was an issue with DrawRect in the July release that should be resolved in the August one.

I’ve only been working with Rocket for past 2 weeks approximately, so I have only ever had the latest version installed.

And it’s definitely a big issue, I’ve had to make a material and use DrawMaterial just to get around this,

which is actually very inefficient for my purposes but its the best I can do right now :slight_smile:

Again I am referring only to the single function DrawRect that is in the HUD class

I’ve tried alpha ranges of 0 to 1 and they all give same result of 100% opaque.

I’ve only tested in the c++ code of my custom HUD class

:slight_smile:

Rama

**Here’s the Rocket-beta-build working version of HUD::DrawRect, thanks to Bruce! **

void AVictoryHUD::JoyDrawRect(
	const FLinearColor Color, 
	float ScreenX, 
	float ScreenY, 
	float Width, 
	float Height
) {
    if (!Canvas) return;

    if (Width <= 0 || Height <= 0) return;
	//~~~~~~~~~~~~~~~~~~~~~~~~~~
    
	//Uses Default White Texture
	FCanvasTileItem TileItem( 
		FVector2D(ScreenX, ScreenY), 
		FVector2D( Width, Height ), 
		Color 
	);
   
    TileItem.BlendMode = SE_BLEND_Translucent;
    Canvas->DrawItem( TileItem );     
}

Hi,

On further investigation It seems the current version of rocket will still contain this issue.

As a temporary I would suggest creating your own HUD function along the lines of:

void AMyHUD::DrawRectTemp(const FLinearColor Color, float ScreenX, float ScreenY, float Width, float Height)
{
	if (Canvas)	
	{
		FCanvasTileItem TileItem( FVector2D(ScreenX, ScreenY), GWhiteTexture, FVector2D( Width, Height ), Color );
		TileItem.BlendMode = SE_BLEND_Translucent;
		Canvas->DrawItem( TileItem );		
	}
}

Apologies for the confusion.

Thanks so much for the code Bruce!

:slight_smile:

Rama

I’m trying to create my own FTexture because the GWhiteTexture is an unresolved external link in my build.

When I try to declare a FTexture* I get this compiler error:

1>------ Build started: Project: VictoryGameEditor, Configuration: Development x64 ------
1>  Parsing headers for VictoryGameEditor
1>E:/RocketVictory/VictoryGame/Source/VictoryGame/Classes/VictoryHUD.h(115): error : In VictoryHUD: Unrecognized type 'FTexture'

So I’m not sure how to set up the temp working DrawRect function :

)

If you remove the GWhiteTexture parameter it will use GWhiteTexture by deault.

ooooh thanks!

I got it to compile now :slight_smile:

:slight_smile:

(for any other readers of this, here is the current-rocket-beta-build friendly version:

/* 
	 * Tile item which uses the default white texture using given size. 
	 *
	 * @param	InPosition		Draw position
	 * @param	InSize			The size to render
	 */
    FCanvasTileItem( const FVector2D& InPosition, const FVector2D& InSize, const FLinearColor& InColor );

so the entire function I am using now is:

void AVictoryHUD::JoyDrawRect(
	const FLinearColor Color, 
	float ScreenX, 
	float ScreenY, 
	float Width, 
	float Height
) {
    if (!Canvas) return;
	//~~~~~~~~~~~~~~~~~~~~~~~~~~
    
	//Uses Default White Texture
	FCanvasTileItem TileItem( 
		FVector2D(ScreenX, ScreenY), 
		FVector2D( Width, Height ), 
		Color 
	);
   
    TileItem.BlendMode = SE_BLEND_Translucent;
    Canvas->DrawItem( TileItem );     
}