I am having trouble trying to get an object to render when I am using tex2dlod in my vertex shader.
A few things before I start, my graphics card supports Shader Model 3.0 and I am compiling using SM3.0. I have my CullMode set to None and FillMode set to Wireframe.
I am rendering some geometry from a triangle strip which works fine with the following code:
VS_OUTPUT WaterVS(VS_INPUT IN)
{
VS_OUTPUT OUT = (VS_OUTPUT)0;
float3 WorldPosition = mul( float4(IN.Position, 1.0f), WorldMatrix );
OUT.Position = mul( float4(WorldPosition, 1.0f), ViewProjMatrix );
return OUT;
}
However I introduced a vertex texture to read in data and offset the y position of the vertex on the GPU, I have done this before using another application and it has worked fine although I can't quite figure out whats going wrong, when I add the following code, the geometry just disappears... all I am doing is offsetting the y by a small amount between 0 - 1 depending on the heightmap value. I have simplified the shader down to just reading in texture coords now.
VS_OUTPUT WaterVS(VS_INPUT IN)
{
VS_OUTPUT OUT = (VS_OUTPUT)0;
//Offset y coord based on heightmap data
IN.Position.y = tex2Dlod(TexS, float4(IN.TexCoord0, 0,0)).r;
float3 WorldPosition = mul( float4(IN.Position, 1.0f), WorldMatrix );
OUT.Position = mul( float4(WorldPosition, 1.0f), ViewProjMatrix );
return OUT;
}
technique Water
{
pass P0
{
CullMode = None;
FillMode = Wireframe;
VertexShader = compile vs_3_0 WaterVS();
PixelShader = compile ps_3_0 WaterPS();
}
}
Now here's the strange part, when I run it through PIX, it shows the geometry as rendering on the view port, I also debugged the shader and sensible values are passed on. Like I said above if I remove the tex2Dlod call and replace it with a static value e.g IN.Position.y = 1.0f, it renders fine.
As you can see PIX shows the geometry on the viewport, but in the app I see nothing
After doing some troublshooting I can't think of any obvious place's to look to solve the issue, any ideas/help appreciated.