Wuceng
Topic Author
Posts: 18
Joined: 04 Aug 2024, 16:43

Overlaying Texture over Panel

03 Jan 2025, 15:02

I want to overlay a texture (basically a transparent texture with a lock on it to signify that some part of the UI is not "unlocked" yet) above arbitrary panels.
My initial approach would have been to write an Effect that takes the overlay texture and blends it with the color of the element (GetInput).
But it seems that the EffectHelpers doesn't have a SetTexture method like BrushHelpers and I'm not sure how I would go about passing a texture to the shader otherwise without access to the source code.
I think an ImageBrush won't work for my case where I want to apply it to the rendered element that is not only an image but a Panel with various content instead.

Is there some other way I could achieve my desired effect? Perhaps overlaying an Image in some other way in XAML?
 
User avatar
jsantos
Site Admin
Posts: 4822
Joined: 20 Jan 2012, 17:18
Contact:

Re: Overlaying Texture over Panel

03 Jan 2025, 19:28

You are right, extra textures are not supported in ShaderEffect, at some point we should add this.

In the meantime, one possible workaround is to implement a custom shader effect and use it to set the opacity of an image. This approach allows you to control the texture's opacity directly through the shader.
 
Wuceng
Topic Author
Posts: 18
Joined: 04 Aug 2024, 16:43

Re: Overlaying Texture over Panel

05 Jan 2025, 13:45

Thanks for the input. For now I can live with just adding the lock as an image in xaml to the elements that need to be locked since I don't need any fancy blending logic and dont have a lot of elements using the locking mechanism. But an effect would be cleaner and easier if I want to use this locking effect in many places and want to do some fancy blending effects.
Nontheless I would greatly appreciate adding the possibility to input textures into ShaderEffects. I think this is a great feature that's missing.
 
User avatar
jsantos
Site Admin
Posts: 4822
Joined: 20 Jan 2012, 17:18
Contact:

Re: Overlaying Texture over Panel

08 Jan 2025, 18:57

Please file a ticket for this. Thank you!
 
Wuceng
Topic Author
Posts: 18
Joined: 04 Aug 2024, 16:43

Re: Overlaying Texture over Panel

12 Jan 2025, 20:54

Created a Ticket(3892)
Thank you!

Who is online

Users browsing this forum: Google [Bot] and 11 guests