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

Tutorial Effects - Pixelshader Preparations

Italian | Spanish | Mandarin | French | Japanese

TOC: Of Effects and Shaders
Next: Manipulating Colors


For all the pixelshader examples we are using the same basic patch setup featuring a 2x2 Grid (EX9.Geometry) and a FileTexture (EX9.Texture) connected to an effect and the renderers View Transform scaled by two so that the grid fills the whole view:

Instead of the Template node in the patch we always clone us a new effect as described on the effects page. Connect your newly cloned effect as shown in the patch and open the CodeEditor via a rightclick on the node. Then take the code below and replace it with the templates code as this one is even more simplified leaving out the vertexshader portions which we don't need for now.

//texture
texture Tex <string uiname="Texture";>;
sampler Samp = sampler_state    //sampler for doing the texture-lookup
{
    Texture   = (Tex);          //apply a texture to the sampler
    MipFilter = LINEAR;         //sampler states
    MinFilter = LINEAR;
    MagFilter = LINEAR;
};
 
//the data structure: "vertexshader to pixelshader"
//used as output data with the VS function
//and as input data with the PS function
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();
    }
}

Press CTRL+S to save/compile the code. No errors should show up. If you get an error at this point make sure you really copied everything and your code in the editor looks exactly as pictured above.


Next: Manipulating Colors
TOC: Of Effects and Shaders

anonymous user login

Shoutbox

~2d ago

joreg: vvvvTv S02E01 is out: Buttons & Sliders with Dear ImGui: https://www.youtube.com/live/PuuTilbqd9w

~9d ago

joreg: vvvvTv S02E00 is out: Sensors & Servos with Arduino: https://visualprogramming.net/blog/2024/vvvvtv-is-back-with-season-2/

~9d ago

fleg: hey there! What's the best tool for remote work? Teamviewer feels terrible. Thanks!

~23d ago

joreg: Last call: 6-session vvvv beginner course starting November 4: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-i/

~1mth ago

joreg: Missed the last meetup? You can rewatch it here: https://www.youtube.com/live/MdvTa58uxB0?si=Fwi-9hHoCmo794Ag

~1mth ago

theurbankind: When is the next big event, like node festival ?

~1mth ago

~1mth ago

joreg: Join us for the next vvvv meetup on Oktober 17th: https://visualprogramming.net/blog/2024/25.-vvvv-worldwide-meetup/

~2mth ago

joreg: 6 session beginner course part 2 "Deep Dive" starts January 13th: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-ii/