Erase .fx modification

For questions about using Classic.

Post » Mon Jul 02, 2012 6:50 am

I know this is more of a shader request, but having taken a look at erase.fx, I thought someone could help me:

What I need is a shader that works like Erase, but instead of taking the alpha channel and erasing with it, I'd like it to take one of the color channels instead.

I need it for pasting transparency into a Canvas, where the opacity would be stored in one of the color channels. I already tried the Grayscale To Opacity shader with Erase on top of it, as well as through an intermediate Canvas, but it didn't work.

Thank you in advance.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Tue Jul 03, 2012 2:10 pm

erase.fx was done with altered render states. I'm not experienced with it, but here is a list with possible blend modes (explanation of each one further down the page):
D3DBLEND enumeration

Blending is done between source and destination.

Just make sure to omit the suffix D3DBLEND_ and remember case sensitivity. Write them in uppercase as shown in the list. It's trial and error, I'm afraid. Just use combinations for SrcBlend and DestBlend, eg.
SrcBlend = DESTALPHA;
DestBlend = SRCCOLOR;

(don't know if this one makes sense^^)

EDIT: Also have a look at Construct's source code. It seems that only a subset is supported. Common renderer definitions (start at line 156)tulamide2012-07-03 14:26:36
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Jul 03, 2012 7:43 pm

It does make perfect sense.

However, blending modes won't help in this case and not because Construct only supports a subset.
It seems that there are none that blend across channels. Alpha only blends with Alpha, R with R etc.

Yet I managed to find a solution - I'm in the process of cannibalizing the Color Mask Effect to do what I require - the logic flow is quite clear and easy to replace with a simple channel shifter - I have the basic operation done, but before releasing, I want to add the following:

-ability to manually select the channel to shift over to alpha
-a choice of either multiplication by the existing alpha or replacement
-an option to inverse the incoming channel

Once done, I'll post it in the Completed addons forum.

Thank you for pointing me in the right direction.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests