New IPP series

Re: New IPP series

Postby ikam » Monday, 15.October 2012, 19:44

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.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby Skinnytorus » Monday, 15.October 2012, 20:24

OK. I see now. Thanks.
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: New IPP series

Postby ikam » Tuesday, 16.October 2012, 17:03

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.
You do not have the required permissions to view the files attached to this post.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby Skinnytorus » Tuesday, 16.October 2012, 18:11

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! :)
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: New IPP series

Postby ikam » Tuesday, 16.October 2012, 20:02

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.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby Skinnytorus » Tuesday, 16.October 2012, 20:21

Yes. I've noticed and appreciate that. You've done an excellent job. Thumbs up! :)
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: New IPP series

Postby ikam » Tuesday, 16.October 2012, 21:32

I found some shader effect to test here :

http://wpffx.codeplex.com/SourceControl ... 962#521893
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby Skinnytorus » Wednesday, 17.October 2012, 07:29

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.
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: New IPP series

Postby ikam » Wednesday, 17.October 2012, 07:38

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
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby ikam » Wednesday, 17.October 2012, 07:43

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 :)
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby Skinnytorus » Wednesday, 17.October 2012, 07:52

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?
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: New IPP series

Postby ikam » Wednesday, 17.October 2012, 07:57

depends of the fx.
which file contains your v2p av2 and p2f structures ?
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby Skinnytorus » Wednesday, 17.October 2012, 08:15

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
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: New IPP series

Postby ikam » Wednesday, 17.October 2012, 08:39

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.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: New IPP series

Postby Skinnytorus » Wednesday, 17.October 2012, 11:02

I appreciate your help. More questions are yet to come. :)
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46


Return to Development and contribution



Who is online

Users browsing this forum: No registered users and 10 guests

cron