microsoftxiao

记忆 流逝

导航

最简单的VS和PS着色器

//2005 HLSL Learn
//最简单的着色效果
string XFile = "teapot.x";   // model

// transforms  世界矩阵和投影矩阵
float4x4 WorldView  : WORLDVIEW;
float4x4 Projection : PROJECTION;

//输出结构
struct VSGLOW_OUTPUT
{
    float4 pos : POSITION;
};

//入口函数

// draws a transparent hull of the unskinned object.
VSGLOW_OUTPUT VSGlow
    (
    float4 Position : POSITION
    )
{
    VSGLOW_OUTPUT Out = (VSGLOW_OUTPUT)0;

   //取世界
   float4 w = mul(Position,WorldView);
   //投影
   Out.pos = mul(w,Projection);
  
    return Out;   
}

float4 PS() : COLOR
{
   return float4(0.5, 0.075, 0.075, 1.0);
}

执行着色器

technique TGlowAndTexture
{
    pass PGlow
    {  
        // glow shader
        VertexShader = compile vs_1_1 VSGlow();
        //PixelShader  = NULL;
      PixelShader = compile ps_1_1 PS();
    }
}

posted on 2006-03-23 15:17  龙巢NET刀  阅读(596)  评论(0)    收藏  举报