Page 4 of 5

Re: New IPP series

PostPosted: Monday, 15.October 2012, 19:44
by ikam
yes, this the debug window, you can show inside the shader compiler errors. In fact It doesn't work like I want, normally this window opens when you click on the debug shader button, to allow to show you where are your errors, line number etc... But the problem is that I can't retrieve the log compiler if I don't catch up on the fly, it's why I opens immediatly the window, when the compiler return an error. It exist a similar mecanism that works fine with CustomMaterial, I copy this mechanism, but I can't understand why it doesn't work here. So in wait to fix this It always open the window to show errors (I think ask to ryg some help for this) - so in wait just keep open this window, and close it only when your shader works.

Re: New IPP series

PostPosted: Monday, 15.October 2012, 20:24
by Skinnytorus
OK. I see now. Thanks.

Re: New IPP series

PostPosted: Tuesday, 16.October 2012, 17:03
by ikam
I've found an issue for the debug window, added parameters for vertex shader, added textures filters for extra textures...

All is working now, I think it's ready for a merge ;)

I gave some little explaination on how to use it and some ipp example in the wz4 file.

Re: New IPP series

PostPosted: Tuesday, 16.October 2012, 18:11
by Skinnytorus
Now it works like a charm! Thank you. The tutorial is also great! I will pose my questions later - frankly speaking, it will take time for me to get deeper into this shader madness, so I completely trust your judgement on this one. So, OK. Waiting for the merge! Thanks again - this is a really huge step forward, man. Congrats! :)

Re: New IPP series

PostPosted: Tuesday, 16.October 2012, 20:02
by ikam
Thanks ;)

Don't know if you saw, but in the examples, I've added comments in the pixel shader code to describe which variables are used to control the fx.

Re: New IPP series

PostPosted: Tuesday, 16.October 2012, 20:21
by Skinnytorus
Yes. I've noticed and appreciate that. You've done an excellent job. Thumbs up! :)

Re: New IPP series

PostPosted: Tuesday, 16.October 2012, 21:32
by ikam
I found some shader effect to test here :

http://wpffx.codeplex.com/SourceControl ... 962#521893

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 07:29
by Skinnytorus
Hmm... Interesting. It seems that I will have to split the .fx files into a2v, v2p and p2f parts and copy them to wz accordingly.
I think I will be able to use your examples for the task ;). I will revert later.

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 07:38
by ikam
yes shader are in the .fx files
normally you just need the pixel shader function, search the main function (there is good comments in files) and copy it inside the pixel shader text operator. a little adaptation to declare variables (principally global and sampler2D variables) and function prototype and it should work.

I've tried this transition effect : (here the full shader code) :

Code: Select all
/*---------------------------------------------------------------------//
 - Transition FX wave
 var0.x; = seed
 var0.y; = time transition

//---------------------------------------------------------------------*/


sampler2D s0 : register(s0);    // screen
sampler2D s1 : register(s1);    // first texture
sampler2D s2 : register(s2);    // second texture

uniform float4 var0 : register(c9);  // var0
uniform float4 var1 : register(c10); // var1
uniform float4 var2 : register(c11); // var2
uniform float4 var3 : register(c12); // var3
uniform float4 var4 : register(c13); // var4




float4 Water(float2 uv)
{
   float randomSeed = var0.x;
   float progress = var0.y;

   float2 offset = tex2D(s1, float2(uv.x / 10, frac(uv.y /10 + min(0.9, randomSeed)))).xy * 2.0 - 1.0;
   float4 c1 = tex2D(s2, frac(uv + offset * progress));
   float4 c2 = tex2D(s0, uv);

    if (c1.a <= 0.0)
        return c2;
    else
        return lerp(c1, c2, progress);
}

void main
(
        in float2 uv0 : TEXCOORD0,
        out float4 r : COLOR0
)
{
      r =  Water(uv0);
}


add two bitmap and in the customIPP animation script to animate th effect add :

ps_var0.y = clamp(time *10,0,1);

you will see a cool wave transition

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 07:43
by ikam
on the web site, there is a video of all effect : http://mschnlnine.vo.llnwd.net/d1/ch9/6 ... MB_ch9.wmv

I think its' possible to add all this fx with customIPP :)

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 07:52
by Skinnytorus
So, may I assume that in our case we should copy only the v2p part and there is no need to take care about a2v and p2f parts, techniques and passes?

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 07:57
by ikam
depends of the fx.
which file contains your v2p av2 and p2f structures ?

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 08:15
by Skinnytorus
Don't take my words too seriously. I'm just beginning to understand the shader pipline, so correct me if I'm wrong.
I use these tutorials and consider which part of them I can omit ;)
http://www.neatware.com/lbstudio/web/hlsl.html
http://www.catalinzima.com/tutorials/cr ... e-in-hlsl/
http://rbwhitaker.wikidot.com/hlsl-tutorials

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 08:39
by ikam
ok, good tutorials, I've already seen them.

for little more precision, in wz4, vertex shader and pixel shader code is splitted, 1 textbox for each, not in an unique fx file. Technique and passe are not used.

there is also some variable pre-declared - for example mvp matrix in the vertex shader (you can show it's declaration if you click on shadercode in debug, as uniform float4x4 mvp : register(c0); - uniform says that the variable float4x4 mvp is declared outside from the shader code, in internal it's a variable initilized when the shader is created)

The vertex and pixel shader functions entry name entry are "main" (else it doesn't work) for both, despite that you can specify as you want if the main function return void or a value (or structure).

In case of IPP most of the effect is done in the pixel shader, so to code you own effect or reap a code from the web, you principally need the pixel shader code, and adapt the code to rename the entry point function by main, and adapt the constants according to the registers used by wz. Registers are "links" to the GUI variables.

Re: New IPP series

PostPosted: Wednesday, 17.October 2012, 11:02
by Skinnytorus
I appreciate your help. More questions are yet to come. :)