Hey guys. I’m very new to Urho and Im only using Urhosharp.
Since I cant really get any interface working, Im just coding everything and trying that out. Since Im experienced with using the Unity engine and C#, this worked for me, until I had to implement a new shader…
I have never coded a shader myself and I only got one shader working in Uhro from a tutorial I found.
Tutorial
So I translated the shader I need to implement into HLSL and tried to implement it but nothing worked. Maybe you guys can help me.
Shader:
sampler MainTex;
sampler RampTex;
float Speed = 4f;
float DeltaTime = 0f;struct v2f_img
{
float4 position : SV_POSITION;
half2 uv : TEXCOORD0;
};void PS(v2f_img i) : SV_Target
{
float4 col = tex2D(MainTex, i.uv);
return tex2D(RampTex, float2(col.r + DeltaTime * Speed, 2));
}
Technique XML file:
<technique ps="Basic"> <pass name="MainTex" psdefines="MainTex"/> <pass name="RampTex" psdefines="RampTex"/> <pass name="Speed" psdefines="Speed"/> <pass name="DeltaTime" psdefines="DeltaTime"/> </technique>
Material XML file:
<material> <technique name="Techniques/Basic.xml" /> <texture unit="MainTex" name="Textures/Background/Main/p13.jpg"/> <texture unit="RampTex" name="Textures/Background/Ramp/g1.jpg"/> <parameter name="Speed" value="4"/> <parameter name="DeltaTime" value="0"/> </material>
In the end this shader should put the colors of the “RampTex” onto the “MainTex” and change that over time to get some kind of kaleidoscope effect.
Can you guys tell me what Im doing wrong, or give me tutorials or anything, so I can understand this topic? Anything would be helpfull.
Thank you very much guys!