简体   繁体   中英

Terrain Height Map - C++/Vertex Shader has different values

I have been working on a terrain and have had to come to a complete stop. I am programming in C++, DirectX9 and HLSL to create the terrain but I am also using height maps that are BMP format. I am loading the information in from the height map in both the C++ side as well as the shader side. On the C++ side, I am using D3DXCreateTextureFromFile and surfaces (D3DXSaveSurfaceToFile) to load the information, whereas on the shader side, I am using tex2Dlod to load my information for the terrain vertices. These two are getting different values from the height map. Upon further research, I found out that the tex2Dlod function utilizes mip maps (still don't understand those fully) to load the information.

Would anyone know a way on how to get the two numbers to match up? If you need more information (the numbers, pictures or whatever) just let me know!

Thanks!

First question is why do you stick with DX9 what is a reason ? I would understand at least DX10. Can u show me HLSL code ?

tex2Dlod is the texture sampling function which takes two params. 1. sampler2D 2. float4(texture coordinates).

Actualy tex2dlod is the function which does texture mip maping(detailing of textures) and texel offsetting. But fully i did not understand where is problem ? Could u be more specific ?

And by the way entire function only supported in shader model 3.0 at least.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM