Okay, I've been trying to fiddle around with the shader effects editor in MMF2/CF2.5. Sketchy's article ( http://create-games.com/article.asp?id=2275 ) and examples have been a big help, but I keep running into little things that I think SHOULD work, but for reasons I can't understand, don't.
The latest is my attempt at using a second texture as a parameter. There's support for this, and as far I as I can tell, I set it up right, but it's not working.
Here's what I've got:
xml file: ( disregard the ' in the <c'ode> )
<effect>
<name>Texture Test</name>
<description>Trying to get texture loading to work</description>
<author>Me</author>
...What I WANT this to do is take the alpha channel of the original object, and display the color channels of the second texture that I'm including. But the texture is showing up as completely black, no matter what I try.
...which is the same as your long and complicated formula.
The technical term for it is "swizzling", and it lets you do some neat tricks.
eg. "Color.rgb = Color.grb;" is an easy way to swap the red and green color channels.
Awesome, thanks! I didn't know that the registers needed to be consecutive. And for some reason, I thought that s1 was reserved for the background, and if you weren't using it it should be skipped. I have no idea why that was.
But it works now, thanks! And that "swizzling" bit it good to know, too!
Here it is working properly. The texture that the two diamonds are using is shown in the middle there. I've got it stretched across them using some parameters for X and Y scaling.
And the second texture repeats automatically! I was hoping that'd be the case, heh.
This takes the alpha channel of an object and subtracts from it the provided pattern image. It's weighed against a threshold, and ends up either visible or invisible based on that.
The test here is just a bunch of feathered circles over a sort of bumpy noise pattern.
Probably! But I actually have no idea why it's fading to black in the first place. In the first one, the circle objects are solid red. Some side effect of the additive blending + alpha-blending + the shader I'm using, I guess?
Maybe I'm doing something wrong (likely) but I've never been able to get shaders working on layers, only on individual objects or the entire frame. Is this normal?
Originally Posted by nim Maybe I'm doing something wrong (likely) but I've never been able to get shaders working on layers, only on individual objects or the entire frame. Is this normal?
Same.
I actually kinda avoid shaders since I want my stuff to work on as many of the runtimes as possible.
I do kinda miss going crazy with extensions and not worrying about it though.
Maybe I'm doing something wrong (likely) but I've never been able to get shaders working on layers, only on individual objects or the entire frame. Is this normal?
Well, I know that you can only apply shaders (even the normal ink effects) to layers if you've got a HWA-enabled build mode selected, but otherwise I can't imagine why that why that would be.
Anyway, if anybody wants to play with these, I've zipped up the ones I've made so far, along with some example files. Just let me know if anything needs clarification: