This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

# cn.Tutorial Effects - Function Printing

Back: Mr. Wiggle
Next: Vertex Data

### f(x, y) = z

```float2 Frequency = 10;
float2 Phase = 0;
float2 Amplitude = 0.01;

vs2ps VS(
float4 PosO  : POSITION,
float4 TexCd : TEXCOORD0)
{
//declare output struct
vs2ps Out;

//calculate two waves
float2 wave = sin(PosO.xy * Frequency + Phase) * Amplitude;

//set z coordinate
PosO.z = wave.x + wave.y;

//transform position
Out.Pos = mul(PosO, tWVP);

//transform texturecoordinates
Out.TexCd = mul(TexCd, tTex);

return Out;
}```

### f(u, v) = xyz

```x = v*cos(u)
y = v*sin(u)
z = v```

```float3 Cone(float2 uv)
{
float u = uv.x;
float v = uv.y;

float3 newPos;
newPos.x = v * cos(u);
newPos.y = v * sin(u);
newPos.z = v;

return newPos;
}```

```#define twopi 6.28318531

float2 Scale = 1;
float2 Offset = 0;

float3 Cone(float2 uv)
{

uv *= Scale;
uv += Offset;

float u = uv.x * twopi;
float v = uv.y;

float3 newPos;
newPos.x = v * cos(u);
newPos.y = v * sin(u);
newPos.z = v;

return newPos;
}

vs2ps VS(
float4 PosO  : POSITION,
float4 TexCd : TEXCOORD0)
{
//declare output struct
vs2ps Out;

//set new position
PosO.xyz = Cone(PosO.xy);

//transform position
Out.Pos = mul(PosO, tWVP);

//transform texturecoordinates
Out.TexCd = mul(TexCd, tTex);

return Out;
}```

Next: Vertex Data
Back: Mr. Wiggle

# Shoutbox

~1d ago

bjoern: Yo peeps! I am looking for a job/project starting July. For contact info check: vvvv specialists available for hire

~30d ago

joreg: Summer Season 23 vvvv workshops are now ready for sign-up: https://thenodeinstitute.org/vvvv-intermediates-summer-2023/

~1mth ago

schlonzo: yeah! shader input pins now also visible, while the variable it not used!

~1mth ago

benju: Job opportunity, teaching Sounddesign for New Media purposes in Berlin (6hrs/week): https://www.letteverein.berlin/wp-content/uploads/2023/03/Ausschreibung_MIA_LK_6_UStd._Sounddesign_NEU.pdf

~1mth ago

~1mth ago

~2mth ago

domj: Coming to LPM next weekend? Learn more about one of the first full vvvv gamma apps, Schéma! https://liveperformersmeeting.net/editions/2023-muenster/program/detail/schema-talk/

~2mth ago

joreg: Want to get started with #vvvv? Check this 12 session beginner online course starting May 8th: https://thenodeinstitute.org/courses/vvvv-beginner-class-summer-2023/

~3mth ago

~3mth ago

mediadog: @ggml Yup, lots. Only used in 4.x, haven't tried in 5.x yet: https://www.unrealengine.com/marketplace/en-US/product/simple-udp-tcp-socket-client