» 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

~3d ago

fleg: This Tuesday, Cologne: exhibition opening of "interwoven", textile disinformation patterns created with vvvv. https://fleg.de/news/exhibition-interwoven

~16d ago

manuelgonzalvez: Assimp nodes all broken afted Win Update w/exception "COM object that has been separated from its underlying RCW(...)"

~16d ago

manuelgonzalvez: @levi thanks would love to! anyway managed to get something similar working based on forum search and anthokio's patches.

~17d ago

levi: @ravasquez thanks. 31.2 x86 verrion worked. @manuelgonzalvez i have a dx11 projectTexture if u a want.

~18d ago

manuelgonzalvez: Anyone has a dx11 port of "projectedTexture" dx9 fx for projection mapping?

~18d ago

manuelgonzalvez: Anyone has a dx11 port of "projectedTexture" dx9 fx for projection mapping?

~19d ago

ravazquez: @levi not sure bout the ImagePack, but I believe VL.OpenCV should give you the same tools and should work with beta just fine

~19d ago

levi: anyone knows of a VVVVpacks.image that works for elliot's projector calibration patches?x64,dx11. always crashes v4 on solve.

~26d ago

Lorenz: VJing with GIFS: https://lorenzpotthast.de/gifjockey/ A fun little side project, that I first prototyped in v4 and now turned web-based ;)

~1mth ago

schlonzo: finally fixed in 4.8 nice1