Input? (HWA Effects Question)
I was just updating a flip horizontal effect to use a switch rather than just applied right away so im using a if logic. When the box is ticked it works ok but although i don't get any errors it just returns a white area for the unticked (0) value. I have made various things which work fine now but i have had no luck when it comes to this on/off bit. I need to just pass the original image for the 0 value, i tried Out.Color = Out.Color etc and a few other things but no luck.
Code:
// Pixel shader input structure
struct PS_INPUT
{
float4 Position : POSITION;
float2 Texture : TEXCOORD0;
};
// Pixel shader output structure
struct PS_OUTPUT
{
float4 Color : COLOR0;
};
// Global variables
sampler2D Tex0;
int iFx;
PS_OUTPUT ps_main( in PS_INPUT In )
{
// Output pixel
PS_OUTPUT Out;
if(iFx==0)
Out.Color = tex2D(Tex0, In.Texture) ;
if(iFx==1)
Out.Color = tex2D(Tex0, float2(1.0-In.Texture.x,In.Texture.y));
return Out;
}
// Effect technique
technique tech_main
{
pass P0
{
// shaders
VertexShader = NULL;
PixelShader = compile ps_1_4 ps_main();
}
}
Im guessing im missing something fairly simple but i haven't used this code type that much so im hoping someone can help. Thanks
Re: Input? (HWA Effects Question)
I think your approach of using a parameter as the bit should work if you hammer out the code properly, but I think theres an even easier solution- having the MMF code apply/remove the effect as necessary. I mean, just using any of the existing flip effects and adding/removing them should do it..
Re: Input? (HWA Effects Question)
Try compiling as another pixel shader version.
There were a lot of changes as the versions increased, I don't think PS1 even supports ifs properly, which would certainly explain why it doesn't work.
Re: Input? (HWA Effects Question)
By the way, Sphax actually has such a shader in his shader pack. ;)
Re: Input? (HWA Effects Question)
Quote:
Originally Posted by Pixelthief
I think your approach of using a parameter as the bit should work if you hammer out the code properly, but I think theres an even easier solution- having the MMF code apply/remove the effect as necessary. I mean, just using any of the existing flip effects and adding/removing them should do it..
Well what i was hoping for was to learn to use switches from this, i can of course switch 2 effect or set one on/off but that means making 2 seperate things or doing it with events. This is just to get used to the code i guess because i plan to make much more complex things so this would not work for what i want this time. Thanks though :)
Quote:
Originally Posted by Dynasoft
Try compiling as another pixel shader version.
There were a lot of changes as the versions increased, I don't think PS1 even supports ifs properly, which would certainly explain why it doesn't work.
Thanks for the tip, I know complex software pack uses PixelShader 2 so would this be the best version now?
Quote:
Originally Posted by Looki
By the way, Sphax actually has such a shader in his shader pack. ;)
Thanks looki this looks just like what i needed. Seems it uses if and else (if then) which is where i was going wrong i think as i was using 2 if events. Seems i can use else if also for 2 and im guessing more comparisons also. I will have to have a look at this to see whats done but i think this should tell me everything i need to know. :)
Thanks for the help everyone i think i should be sorted now :D