Jump to content

How can I implement gray filter effect on CanvasRenderer?


Aaron Wang
 Share

Recommended Posts

3 hours ago, ivan.popelyshev said:

If you want to apply the filter to all the canvas, you can use CSS filter.

Thanks for you reply, but unfortunately, I need to apply the filter to certain parts of the canvas precisely, I think that'll be verify difficult with CSS.

I just have a thought, can I use half transparent gray picture to cover on target region to simulate the filter effect? Will that be possible?

 

Link to comment
Share on other sites

One option would be to draw the images to separate canvas, then go through all the pixels (in each image you want to grayscale) and calculate gray variation of the image and use that canvas as texture and alphablend between original image and calculated grayscale.

[Edit] To have an area of grayscaled sprites you could then just mask the area which shows grayscaled sprites on an layer above the normal sprites.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...