Monday, 30 September 2013

Vertex Texture Fetch always return 0

Vertex Texture Fetch always return 0

I'm developing a shader based terrain. Use VTF to fetch the height data in
vertex shader. My problem is when I sample heightmap in vertex shader the
returned value always is zero.
Texture2D texture;
SamplerState sampleType;
float height = texture.SampleLevel(sampleType, float4(input.tex, 0, 0), 0);
The texture loaded from BMP file (256x256x24bit) with
D3DX11CreateShaderResourceViewFromFile(device, heightmap, NULL, NULL,
&texture) function and passed to vertex shader with
deviceContext->PSSetShaderResources(0, 1, &texture). Feature level is
D3D_FEATURE_LEVEL_10_0 and shader profile is vs_4_0.

No comments:

Post a Comment