I made a custom shader and its not working. is any thing wrong with it. i used AMD Render Monkey. when i add it to a wall segment and i run the game the segment dissapers. (*i have full shaders turned on
//**************************************************************//
// Effect File exported by RenderMonkey 1.6
//
// - Although many improvements were made to RenderMonkey FX
// file export, there are still situations that may cause
// compilation problems once the file is exported, such as
// occasional naming conflicts for methods, since FX format
// does not support any notions of name spaces. You need to
// try to create workspaces in such a way as to minimize
// potential naming conflicts on export.
//
// - Note that to minimize resulting name collisions in the FX
// file, RenderMonkey will mangle names for passes, shaders
// and function names as necessary to reduce name conflicts.
//**************************************************************//
//--------------------------------------------------------------//
// Textured Bump
//--------------------------------------------------------------//
//--------------------------------------------------------------//
// Pass 0
//--------------------------------------------------------------//
string Textured_Bump_Pass_0_Model : ModelData = "..\\..\\..\\Program Files (x86)\\AMD\\RenderMonkey 1.82\\Examples\\Media\\Models\\Sphere.3ds";
float3 fvLightPosition
<
string UIName = "fvLightPosition";
string UIWidget = "Numeric";
bool UIVisible = true;
float UIMin = -100.00;
float UIMax = 100.00;
> = float3( -100.00, 100.00, -100.00 );
float3 fvEyePosition
<
string UIName = "fvEyePosition";
string UIWidget = "Numeric";
bool UIVisible = false;
float UIMin = -100.00;
float UIMax = 100.00;
> = float3( 0.00, 0.00, -100.00 );
float4x4 matView : View;
float4x4 matViewProjection : ViewProjection;
struct VS_INPUT
{
float4 Position : POSITION0;
float2 Texcoord : TEXCOORD0;
float3 Normal : NORMAL0;
float3 Binormal : BINORMAL0;
float3 Tangent : TANGENT0;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
float2 Texcoord : TEXCOORD0;
float3 ViewDirection : TEXCOORD1;
float3 LightDirection: TEXCOORD2;
};
VS_OUTPUT Textured_Bump_Pass_0_Vertex_Shader_vs_main( VS_INPUT Input )
{
VS_OUTPUT Output;
Output.Position = mul( Input.Position, matViewProjection );
Output.Texcoord = Input.Texcoord;
float3 fvObjectPosition = mul( Input.Position, matView );
float3 fvViewDirection = fvEyePosition - fvObjectPosition;
float3 fvLightDirection = fvLightPosition - fvObjectPosition;
float3 fvNormal = mul( Input.Normal, matView );
float3 fvBinormal = mul( Input.Binormal, matView );
float3 fvTangent = mul( Input.Tangent, matView );
Output.ViewDirection.x = dot( fvTangent, fvViewDirection );
Output.ViewDirection.y = dot( fvBinormal, fvViewDirection );
Output.ViewDirection.z = dot( fvNormal, fvViewDirection );
Output.LightDirection.x = dot( fvTangent, fvLightDirection );
Output.LightDirection.y = dot( fvBinormal, fvLightDirection );
Output.LightDirection.z = dot( fvNormal, fvLightDirection );
return( Output );
}
float4 fvAmbient
<
string UIName = "fvAmbient";
string UIWidget = "Color";
bool UIVisible = true;
> = float4( 0.27, 0.27, 0.27, 1.00 );
float4 fvSpecular
<
string UIName = "fvSpecular";
string UIWidget = "Color";
bool UIVisible = true;
> = float4( 0.87, 0.87, 0.87, 1.00 );
float4 fvDiffuse
<
string UIName = "fvDiffuse";
string UIWidget = "Color";
bool UIVisible = true;
> = float4( 0.84, 0.84, 0.84, 1.00 );
float fSpecularPower
<
string UIName = "fSpecularPower";
string UIWidget = "Numeric";
bool UIVisible = true;
float UIMin = 1.00;
float UIMax = 100.00;
> = float( 25.00 );
texture base_Tex
<
string ResourceName = ".\\textures\\BrickLargeDirty0006_7_S-BUMP.jpg";
>;
sampler2D baseMap = sampler_state
{
Texture = (base_Tex);
ADDRESSU = WRAP;
ADDRESSV = WRAP;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
};
texture bump_Tex
<
string ResourceName = ".\\textures\\NormalMap_GrainMerge.jpg";
>;
sampler2D bumpMap = sampler_state
{
Texture = (bump_Tex);
ADDRESSU = WRAP;
ADDRESSV = WRAP;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
};
struct PS_INPUT
{
float2 Texcoord : TEXCOORD0;
float3 ViewDirection : TEXCOORD1;
float3 LightDirection: TEXCOORD2;
};
float4 Textured_Bump_Pass_0_Pixel_Shader_ps_main( PS_INPUT Input ) : COLOR0
{
float3 fvLightDirection = normalize( Input.LightDirection );
float3 fvNormal = normalize( ( tex2D( bumpMap, Input.Texcoord ).xyz * 2.0f ) - 1.0f );
float fNDotL = dot( fvNormal, fvLightDirection );
float3 fvReflection = normalize( ( ( 2.0f * fvNormal ) * ( fNDotL ) ) - fvLightDirection );
float3 fvViewDirection = normalize( Input.ViewDirection );
float fRDotV = max( 0.0f, dot( fvReflection, fvViewDirection ) );
float4 fvBaseColor = tex2D( baseMap, Input.Texcoord );
float4 fvTotalAmbient = fvAmbient * fvBaseColor;
float4 fvTotalDiffuse = fvDiffuse * fNDotL * fvBaseColor;
float4 fvTotalSpecular = fvSpecular * pow( fRDotV, fSpecularPower );
return( saturate( fvTotalAmbient + fvTotalDiffuse + fvTotalSpecular ) );
}
//--------------------------------------------------------------//
// Technique Section for Textured Bump
//--------------------------------------------------------------//
technique Textured_Bump
{
pass Pass_0
{
VertexShader = compile vs_2_0 Textured_Bump_Pass_0_Vertex_Shader_vs_main();
PixelShader = compile ps_2_0 Textured_Bump_Pass_0_Pixel_Shader_ps_main();
}
}

coming soon