`
yellowcxx
  • 浏览: 2563 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

HLSL Shading for 3dsMax 01 - Hello world

阅读更多
Purpose:
Create a HLSL Shader that just use a solid ambient color to shading the model in 3dsMax.

Solution:
1.Create a teapot in 3dsMax



2.Hit shotcut key 'm' to active Material Editor and choice DirectX Shader





3.Load our HLSL Shader file





4.Assign to teapot as a material



5.Adjust the AmbientColor we can see that the color of teapot change as well



Shader source:

float4x4 matViewProjection : WorldViewProjection;

float4 AmbientColor : AMBIENT
<
   string UIName = "AmbientColor";
> = float4( 1.00, 0.79, 0.68, 1.00 );

struct VS_INPUT 
{
	float4 Position : POSITION0;
};

struct VS_OUTPUT 
{
	float4 Position : POSITION0;
};

VS_OUTPUT vs_main( VS_INPUT Input )
{
	VS_OUTPUT Output;
	Output.Position = mul( Input.Position, matViewProjection );
   
	return Output ;
}

float4 ps_main() : COLOR0
{   
	return AmbientColor;
}

technique HelloWorld
{
   pass one
   {
      VertexShader = compile vs_2_0 vs_main();
      PixelShader = compile ps_2_0 ps_main();
   }
}

  • 大小: 212.4 KB
  • 大小: 130.1 KB
  • 大小: 5.9 KB
  • 大小: 210.4 KB
  • 大小: 36.4 KB
  • 大小: 36.6 KB
  • 大小: 168.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics