Hello, I was sondering if a shader like this ati one could be used in gamestudio, or if changes were nececarry
//------------------------------------------------------------------------------
// LightEffect.fx
//
// This file contains the shaders to render the light...it does not do light effects...
// it just renders teh light object.
//
// $Header$
//
// Marwan Y. Ansari - ATI Research, Inc. - 2003
//------------------------------------------------------------------------------
float4x4 world_view_matrix : WORLDVIEWMATRIX;
float4x4 world_view_proj_matrix : WORLDVIEWPROJECTION;
//=============================================================================
struct VS_INPUT
{
float4 position:POSITION;
float4 diffuse:COLOR;
float3 normal:NORMAL;
float4 tex0 :TEXCOORD0;
};
struct VS_OUTPUT
{
float4 position :POSITION;
float4 diffuse :COLOR;
float4 tex0 :TEXCOORD0;
};
struct PS_INPUT
{
float4 diffuse :COLOR;
float4 tex0 :TEXCOORD0;
};
//=============================================================================
VS_OUTPUT LightVertexShader( VS_INPUT In )
{
VS_OUTPUT Out = (VS_OUTPUT) 0;
float4 pos = In.position;
float3 normal;
float3 lightVector;
// transform position to screen space.
Out.position = mul( pos,world_view_proj_matrix );
// Just to visualize the light, shade the light as if there is another light
lightVector = mul( -pos, world_view_matrix);
normal = normalize(mul( In.normal,world_view_matrix));
Out.diffuse = (max( dot(normal,lightVector),0));
Out.tex0 = In.tex0;
return Out;
}
//=============================================================================
float4 DefaultPixelShader( PS_INPUT In ) : COLOR
{
float4 c= {.5,0,0,0};
c.xy = In.diffuse;
return c;
}
//=============================================================================
technique DefaultLightTech
{
pass P0
{
VertexShader = compile vs_2_0 LightVertexShader();
PixelShader = compile ps_2_0 DefaultPixelShader();
}
}
//===========================================================================================