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

cn.Tutorial Effects - Pixelshader Preparations

English | Italian | Spanish | 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


对于像素着色的案例我们都使用的是同一个基础的程序片,它由一个2x2的 Grid (EX9.Geometry)和一个连接在effect上的FileTexture (EX9.Texture)构成,renderers 节点的View Transform引脚缩放值设置为2,使得grid网格能够充满整个窗口:

替换程序片中的Template节点,按照EX9.Effect.Template 这个页面中的说明,我们通常是先复制一个新的Template节点。把这个重新复制的节点连接到程序片当中去,然后通过右键单击这个节点打开编码器。用下面的代码替换替换templates中已有的代码,因为这个代码十分简单,以至于我们不需要去考虑暂时我们不需要用到的顶点着色的部分。

//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();
    }
}

按下CTRL+S保存和编译这些代码。没有错误提示。如果有错误提示,那么你在确认一下你真的拷贝了所有的代码,你的代码视图里看到的内容和上面这张图上现实的是一样的。


Next: Manipulating Colors
TOC: Of Effects and Shaders

anonymous user login

Shoutbox

~6d ago

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

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

~2mth ago

joreg: vvvv gamma 5.0 is out! Please read all about it in the release notes: https://visualprogramming.net/blog/2023/vvvv-gamma-5.0-release

~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

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