HLSL Lighting: Wits' End
--
Jeff S.
/////////
/// MyEffect.fx
/////////
#include <sas\sas.fxh>
int GlobalParameter : SasGlobal
<
int3 SasVersion = {1, 1, 0};
string SasEffectDescription = "HLSL Hands-On Workshop: Completed solution";
string SasEffectCompany = "Microsoft Corporation";
bool SasUiVisible = false;
>;
float Time <string SasBindAddress = "Sas.Time.Now"; bool SasUiVisible = false;>;
float4x4 World <string SasBindAddress = "Sas.Skeleton.MeshToJointToWorld[0]"; bool SasUiVisible = false;>;
float4x4 View <string SasBindAddress = "Sas.Camera.WorldToView"; bool SasUiVisible = false;>;
float4x4 Projection <string SasBindAddress = "Sas.Camera.Projection"; bool SasUiVisible = false;>;
SasDirectionalLight DirectionalLight <string SasBindAddress = "Sas.DirectionalLight[0]"; bool SasUiVisible = false;>;
struct VS_OUTPUT {
float4 position : POSITION;
float4 color : COLOR;
};
VS_OUTPUT Vertex_Shader_Transform(in float4 vPosition : POSITION, in float4 vColor : COLOR)
{
VS_OUTPUT output;
// Transform the vertex into projection space.
output.position = mul( vPosition, mul(View, Projection ));
output.color = vColor; // color pass-thru
return output;
}
float4 Pixel_Shader(in float4 diffuseColor : COLOR) : COLOR
{
return diffuseColor;
}
technique OnlyTechnique {
pass P0 {
AlphaBlendEnable = FALSE;
AmbientMaterialSource = MATERIAL;
DiffuseMaterialSource = MATERIAL;
EmissiveMaterialSource = MATERIAL;
MaterialAmbient = float4(0.1,0.1,0.1,1.0);
MaterialDiffuse = float4(0.5,0.2,0.7,1.0);
MaterialPower = 3.0;
MaterialEmissive = float4(1,1,1,1);
MaterialSpecular = float4(1,1,1,1);
Lighting = TRUE;
LightEnable[0] = TRUE;
LightAmbient[0] = float4(1,1,1,1);
LightDiffuse[0] = float4(1,1,1,1);
LightSpecular[0] = float4(1,1,1,1);
LightType[0] = DIRECTIONAL;
LightDirection[0] = float3(0,-1,0); // facing down
VertexShader = compile vs_2_0 Vertex_Shader_Transform();
//PixelShader = compile ps_2_0 Pixel_Shader(); // I need to convince myself that I can get device lighting to work before I tackle pixel-shaded lighting.
}
}

