@Ramon156
Quote: "SET EFFECT CONSTANT float 1,"N",100"
can you remind me how to transfer float3?
like
SET EFFECT CONSTANT float 1,"N",{100,25,53}
@Gunslinger
matrix WorldVP:WorldViewProjection;
float3 Highlight={0.25,0.25,0.25}; // you must tweak this variable from DB, using "set effect constant float command"
float3 LightD={-100,100,-100}; // light position
float3 LightC={1,0.7,0.9}; // light color
texture TextureTX <string Name="";>;
sampler2D Texture = sampler_state
{ texture = <TextureTX>; };
struct input
{ float4 Pos:POSITION;
float2 UV:TEXCOORD;
float3 Normal:NORMAL;
};
struct output
{ float4 Pos:POSITION;
float2 Tex:TEXCOORD0;
float3 Light:COLOR0;
};
output VS(input IN)
{ output OUT;
OUT.Pos=mul(IN.Pos,WorldVP);
OUT.Tex=IN.UV;
OUT.Light=dot(normalize(LightD),IN.Normal)*LightC;
return OUT; }
float4 PS(output IN) : COLOR
{ float4 Texture=tex2D(Texture,IN.Tex);
return float4(Texture.rgb*IN.Light+Highlight,Texture.a);
// return float4(Texture.rgb*IN.Light*Highlight,Texture.a); // <--- OR USE THIS
}
technique HL
{ pass p0 { vertexShader = compile vs_2_0 VS(); pixelShader = compile ps_2_0 PS(); } }