» Tutorial Effects - Sr. Wiggle
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

Tutorial Effects - Sr. Wiggle

English | Italian | Mandarin | Japanese

TOC: Of Effects and Shaders
Back: Vertexshader Preparations
Next: Function Printing


Comencemos con el famoso efecto MrWiggle que distosiona una malla mediante ondas sinusoidales:

El vertex shader es llamado por cada vértice de la malla. Como has aprendido aquí here, el input del vertex shader es la data almacenada en los vértices de la malla que son ahora procesados:

vs2ps VS(
    float4 PosO  : POSITION,
    float4 TexCd : TEXCOORD0)
{
...
}

Aquí estamos interesados en el PosO vector, que es la posición del vértice actual. Añadiremos un offset a la coordenada x del vértice que va a depender de su posición vertical (coordenada y):

PosO.x += sin(PosO.y);

Añadimos algunos parámetros para controlar las ondas:

PosO.x += sin(PosO.y * Frequency + Phase) * Amplitude;

Así el vertex shader con sus inputs queda como esto:

float Frequency = 10;
float Phase = 0;
float Amplitude = 0.01;
 
vs2ps VS(
    float4 PosO  : POSITION,
    float4 TexCd : TEXCOORD0)
{
    //declara la estructura de salida
    vs2ps Out;
 
    //offset de la coordenada x
    PosO.x += sin(PosO.y * Frequency + Phase) * Amplitude;
 
    //transforma la posición
    Out.Pos = mul(PosO, tWVP);
 
    //transforma las coordenadas de textura
    Out.TexCd = mul(TexCd, tTex);
 
    return Out;
}

y el patch:

mr wiggle patch

Next: Function Printing
Back: Vertexshader Preparations
TOC: Of Effects and Shaders

anonymous user login

Shoutbox

~1mth 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

~1mth ago

ggml: someone has sent udp bytes to unreal ?

~2mth ago

micha_nismus: worked out, thank you very much ! :-)

~2mth ago

joreg: @micha_nismus does this help? https://youtu.be/xkrbT45BgOQ

~2mth ago

micha_nismus: thx joerg. Can anybody help me why i can't see any renderer in gamma? thx :-)

~2mth ago

joreg: @micha_nismus instead of discord, we're using matrix, see: chat

~2mth ago

micha_nismus: searching for a public discord server for vvvv

~2mth ago

joreg: Join us for the 20th #vvvv meetup on January 19th: https://thenodeinstitute.org/event/20-worldwide-vvvv-meetup/

~2mth ago

joreg: @schlonzo re "SDSL support" did you see the Shader wizard? or do you mean something different?