gnatogryz Posted October 29, 2018 Share Posted October 29, 2018 Hi everyone, I have gui assets from my previous Unity project - mostly greyscale textures. That's because we've been using tint color on ui elements to make it easier to adjust color palette project-wide, and also to create color transitions on ui elements. Is there any way to replicate that behaviour in Babylon? The only thing I've figured out so far is to use the css hue filter, but I can't get even that to work. Here's a playground (the texture is not really suitable, but I just want to achieve a proof of concept) https://www.babylonjs-playground.com/#50VN6Q Quote Link to comment Share on other sites More sharing options...
Guest Posted October 29, 2018 Share Posted October 29, 2018 Hello and welcome!! The GUI is rendered using HTML canvas 2d operations and thus we can use composite operations (https://stackoverflow.com/questions/2688961/how-do-i-tint-an-image-with-html5-canvas) You could probably replace control._draw but if you are interested I could add a new observable (like control.onBeforeDrawObservable) so you could change the current canvas context Quote Link to comment Share on other sites More sharing options...
gnatogryz Posted October 30, 2018 Author Share Posted October 30, 2018 Thank you for the response. Sorry to be a nag, but can you please help me out a bit on how to integrate that into the example playground? I'm guessing I should use the domImage field somehow? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2018 Share Posted October 30, 2018 https://www.babylonjs-playground.com/#50VN6Q#1 The list of composite op: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation Dad72 1 Quote Link to comment Share on other sites More sharing options...
gnatogryz Posted October 30, 2018 Author Share Posted October 30, 2018 Perfect, thanks! Quote Link to comment Share on other sites More sharing options...
Guest Posted October 31, 2018 Share Posted October 31, 2018 Flagging as solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.