home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2006 April
/
Gamestar_83_2006-04_dvd.iso
/
Dema
/
demowot_english.exe
/
InfDX
/
x
/
notused
/
deferred-directional2-pixel.hlsl
< prev
next >
Wrap
Text File
|
2005-03-22
|
2KB
|
63 lines
struct VS_OUTPUT
{
float2 UV : TEXCOORD0;
#if TDX_SHADERFLAG_SPECULAR
float4 FustrumPos : TEXCOORD1;
#endif
};
struct ViewSpaceDir
{
float4 Direction;
float4 Color;
};
ViewSpaceDir TDX_CONST_VIEWDIR;
float4x4 TDX_CONST_INVVIEW;
float4 TDX_CONST_LIGHTCONTRIB;
sampler sampler_normal : register(s0); // normal
sampler sampler_position : register(s1); // position
float4 main(VS_OUTPUT In) : COLOR
{
float4 FinalColor;
// normalvector
float4 Normal=tex2D(sampler_normal, In.UV)*2-1;
float DotProduct = dot(TDX_CONST_VIEWDIR.Direction.xyz, Normal.xyz);
FinalColor=saturate(DotProduct)*TDX_CONST_VIEWDIR.Color;
/*#if TDX_SHADERFLAG_SPECULAR
// extracting view space position
float4 Depth=tex2D(sampler_position, In.UV);
float3 ViewSpacePos=(In.FustrumPos/In.FustrumPos.w)*Depth.r;
float3 Reflected=normalize(reflect(ViewSpacePos, Normal.xyz));
float Specular=pow(saturate(dot(Reflected,TDX_CONST_VIEWDIR.Direction.xyz)),Normal.w*100);
FinalColor+=TDX_CONST_VIEWDIR.Color*Specular*Albedo.a;
#endif*/
#if 0
float4 CubeLightDiffuse=texCUBE(sampler_sky, mul((float3)Normal,TDX_CONST_INVVIEW));
FinalColor=CubeLightDiffuse;
#if TDX_SHADERFLAG_SPECULAR
// extracting view space position
float4 Depth=tex2D(sampler_position, In.UV);
float3 ViewSpacePos=(In.FustrumPos/In.FustrumPos.w)*Depth.r;
float3 ReflectionVector=reflect(ViewSpacePos, (float3)Normal);
float4 CubeLightSpecular=texCUBE(sampler_sky, mul(ReflectionVector,TDX_CONST_INVVIEW));
FinalColor=CubeLightSpecular;
#endif
#endif
// FinalColor.a=dot((float3)FinalColor.rgb,(float3)TDX_CONST_LIGHTCONTRIB);
// FinalColor.rgb*=Albedo;
return FinalColor*0.25;
}