I’m trying to replace some of my simple Flash UI elements with ScriptedTextures that I draw directly to the HUD. It’s not going well. I’m wondering if any of you have experience with this and can tell me what I need to do differently.
So first off, it seems you cannot draw a ScriptedTexture directly to the HUD. So I created a Material with a TextureSampleParameter2D and in UnrealScript I create a MaterialInstanceConstant and then I use SetTextureParameterValue to put my ScriptedTexture into the material instance.
The material apparently cannot be translucent. It has to be BLEND_AlphaComposite if I want to attempt any translucency. But no matter what I do, I can’t get the translucency to show up correctly. If I attach the alpha to the material’s opacity, then the whole thing becomes translucent (or maybe added?–it looks really bright in outdoor scenes). And if don’t attach anything to the material’s opacity, then the whole thing stays opaque.
And then it seems I cannot use Canvas.DrawBox in the ScriptedTexture’s render delegate function. No matter what I do, I just don’t see anything there when I try to use DrawBox. But if I use DrawRect with a plain white texture, then the rectangle shows up.
And I just cannot get translucency to work. If I set the ClearColor to (0, 0, 0, 0) then translucency shows up as black. Whatever I do, translucency shows up as the ClearColor, only opaque. I’ve tried Canvas.SetDrawColor to the translucent color I want to draw with. I’ve tried setting the draw color to (255, 255, 255, 255) and setting my ClearColor to the color/translucency of what I actually want to draw. I’ve tried setting my draw color, and then drawing a rectangle with a translucent texture. But no matter what, the whole material draws as opaque on my HUD.
Have any of you had success drawing translucent ScriptedTextures on your HUD?