Hi all!
I think I have the same question.
here's my code in the .c file
BMAP* normalMap = "NormalMap.jpg";
BMAP* diffuseMap = "DiffuseMap.jpg";
MATERIAL* m_Normal ={
skin1 = diffuseMap;
skin2 = normalMap;
skin3 = normalMap;
effect="bump.fx";
}
And here's the shader (it's the default A7 bump.fx shader, but edited. I changed the entSkin's into mtlSkin's so I can specify it through the material definition)
// Lambert bump mapping
// (c) oP group 2008 Version 2.1
#include <bump_vs>
#include <phong>
//texture entSkin1; // texture
//texture entSkin2; // normal map or lightmap
//texture entSkin3; // normal map on blocks
texture mtlSkin1;
texture mtlSkin2;
texture mtlSkin3;
sampler sBaseTex = sampler_state { Texture = <mtlSkin1>; MipFilter = Linear; };
sampler sSkin2 = sampler_state { Texture = <mtlSkin2>; MipFilter = Linear; };
sampler sSkin3 = sampler_state { Texture = <mtlSkin3>; MipFilter = Linear; };
float3 DoDiffuse(bumpOut In,float3 Normal)
{
float3 Diffuse = In.Diffuse1 * saturate(dot(normalize(In.Light1.xyz),Normal));
Diffuse += In.Diffuse2 * saturate(dot(normalize(In.Light2.xyz),Normal));
Diffuse += In.Diffuse3 * saturate(dot(normalize(In.Light3.xyz),Normal));
return Diffuse * vecDiffuse.xyz;
}
float4 diffuseBump_PS(bumpOut In): COLOR
{
float4 Base = tex2D(sBaseTex,In.Tex12.xy);
float3 Normalmap = tex2D(sSkin2,In.Tex12.xy)*2-1;
float3 Diffuse = DoDiffuse(In,Normalmap);
return Base * DoColor(Diffuse,In.Ambient);
}
float4 diffuseBumpLM_PS(bumpOut In): COLOR
{
float4 Base = tex2D(sBaseTex,In.Tex12.xy);
float4 Lightmap = tex2D(sSkin2,In.Tex12.zw);
float3 Normalmap = tex2D(sSkin3,In.Tex12.xy)*2-1;
float3 Diffuse = DoDiffuse(In,Normalmap);
return Base * DoLightmap(Diffuse,Lightmap,In.Ambient);
}
technique bump
{
pass one
{
VertexShader = compile vs_2_0 bump_VS();
PixelShader = compile ps_2_0 diffuseBump_PS();
}
}
technique bump_lm
{
pass one
{
VertexShader = compile vs_2_0 bump_VS();
PixelShader = compile ps_2_0 diffuseBumpLM_PS();
}
}
technique fallback { pass one { } }
In WED I have assigned the m_Normal material to a level block.
Now when I run it, I get this error:
#DEFAULT - normal or height map missing
where #DEFAULT is the default texture applied to the level block
When I look at the level block with the m_Normal material, it looks like crap. Also, I don't get this error when I apply the material to an entity.
Can anybody help me?