Shader refuses to compile
by Matt Vitelli · in Torque Game Engine Advanced · 07/31/2007 (10:11 am) · 1 replies
I've encountered a strange problem when trying to compile this shader. Whenever I try to compile it I get an error stating:
GFXD3DShader::initPixShader - no compiled code produced; possibly missing file 'shaders/water/lava1P.hlsl'?
When in fact lava1P.hlsl is there. However, if I replace the code in lava1P.hlsl with the code from the water shader, it compiles fine. This seems completely illogical to me. Here is what my shaders and pathes look like.
GFXD3DShader::initPixShader - no compiled code produced; possibly missing file 'shaders/water/lava1P.hlsl'?
When in fact lava1P.hlsl is there. However, if I replace the code in lava1P.hlsl with the code from the water shader, it compiles fine. This seems completely illogical to me. Here is what my shaders and pathes look like.
new ShaderData( Lava )
{
DXVertexShaderFile = "shaders/water/lava1V.hlsl";
DXPixelShaderFile = "shaders/water/lava1P.hlsl";
pixVersion = 2.0;
};//-----------------------------------------------------------------------------
// Structures
//-----------------------------------------------------------------------------
#define IN_HLSL
#include "..\shdrConsts.h"
struct ConnectData
{
float4 texCoord : TEXCOORD0;
float3 lightVec : TEXCOORD1;
float2 texCoord2 : TEXCOORD2;
float2 fogCoord : TEXCOORD3;
float3 pos : TEXCOORD4;
float3 eyePos : TEXCOORD5;
};
struct Fragout
{
float4 col : COLOR0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform sampler2D diffMap : register(S0),
uniform sampler2D bumpMap : register(S1),
uniform sampler fogMap : register(S2),
uniform float4 specularColor : register(PC_MAT_SPECCOLOR),
uniform float specularPower : register(PC_MAT_SPECPOWER)
)
{
Fragout OUT;
float4 tex = tex2D(diffMap,IN.texCoord);
tex += tex2D(diffMap,IN.texCoord2);
tex /= 2;
float4 bumpNorm=tex2D(bumpMap,IN.texCoord);
bumpNorm.xyz=normalize(bumpNorm.xyz-0.5);
bumpNorm.y=-bumpNorm.y;
float3 l = normalize(IN.light);
bumpNorm += tex2D(bumpMap, IN.texCoord2);
float3 eyeVec = IN.pos - IN.eyePos;
eyeVec = -eyeVec;
eyeVec = normalize( eyeVec );
float diff=saturate(dot(l,bumpNorm.xyz));
// calc "diffuse" color
float4 diffuseColor = tex * diff;
// output combined color
OUT.col = diffuseColor;
float3 halfAng = normalize( eyeVec + IN.lightVec );
float specular = saturate( dot( bumpNorm, halfAng) );
specular = pow(specular, specularPower);
OUT.col += specularColor * specular;
// fog it
float4 fogColor = tex2D(fogMap, IN.fogCoord);
OUT.col = lerp( OUT.col, fogColor, fogColor.a );
return OUT;
}
Torque Owner Matt Vitelli
EDIT: After fixing said syntax error I found that it compiled properly in both builds.