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

Tutorial Effects - Preparar el Pixelshader

English | Italian | Mandarin | French | Japanese

The original english version of this page is newer and may contain information this translation does not have! Click here to view the english version.

TOC: Of Effects and Shaders
Next: Manipulating Colors


Para todos los ejemplos del pixelshader estamos usando la misma configuración básica en el patch con un 2x2 Grid (EX9.Geometry) y un FileTexture (EX9.Texture) conectado al efecto y la View Transform del renderer escalada a 2 (por eso el grid rellena toda la vista):

En vez de utilizar el Template node en el patch siempre lo clonamos como un nuevo efecto como se explica en la página EX9.Effect.Template. Conecta tu recién clonado efecto como se muestra en el patch y abre el CodeEditor haciendo click derecho en el nodo. Copia el códogo de abajo y sustituye el de la plantilla: este es más simple ya que deja quita el VertexShader que no necesitaremos por ahora.

//textura
texture Tex <string uiname="Texture";>;
sampler Samp = sampler_state    //sampler para buscar la textura
{
    Texture   = (Tex);          //aplica la textura al sampler
    MipFilter = LINEAR;         //sampler states
    MinFilter = LINEAR;
    MagFilter = LINEAR;
};
 
//la estructura de la data: "vertexshader to pixelshader"
//usada como data de salida de la función VS
//y como data de entrada en la función PS
struct vs2ps
{
    float4 Pos  : POSITION;
    float2 TexCd : TEXCOORD0;
};
 
float4 PS(vs2ps In): COLOR
{
    return 1;
}
 
technique TSimpleShader
{
    pass P0
    {
        VertexShader = null;
        PixelShader  = compile ps_2_0 PS();
    }
}

Presiona CTRL+S para salvar/compilar el efecto. No se mostrarán errores. Si te sale un error comprueba en el editor que has copiado todo el código (debe aparecer exactamente como arriba).


Next: Manipulating Colors
TOC: Of Effects and Shaders

anonymous user login

Shoutbox

~7d ago

joreg: Postponed: Next vvvv beginner course starting April 29: https://thenodeinstitute.org/courses/vvvv-beginner-class-summer-2024/

~1mth ago

~1mth ago

joreg: The Winter Season of vvvv workshops is now over but all recordings are still available for purchase: https://thenodeinstitute.org/ws23-vvvv-intermediates/

~1mth ago

schlonzo: Love the new drag and drop functionality for links in latest previews!

~2mth ago

joreg: Workshop on 29 02: Create Sequencers and Precise Clock Based Tools. Signup here: https://thenodeinstitute.org/courses/ws23-vvvv-08-create-sequencers-and-precise-clock-based-tools-in-vvvv-gamma/

~2mth ago

joreg: Workshop on 22 02: Unlocking Shader Artistry: A Journey through ‘The Book of Shaders’ with FUSE. Signup here: https://thenodeinstitute.org/courses/ws23-vvvv-12-book-of-shaders/