Missing Documentation: tex2Dlod()
Today, I tried to use tex2Dlod() to generate the full mip chain of a texture. HLSL function, tex2Dlod() takes float4 as texture coordinate and the 4th component is supposed to specify which mip level it should sample.
So my question was "what value should I pass if i want the 2nd highest mip." I had two educated guesses:
texcoord = float4(u, v, 0, 1);
texccord = float4(u, v, 0, 1 / number of total mip levels)
Unfortunately, I was not able to find any documentation on this: MSDN doesn't explain it and I couldn't find it on Google either. (my Google God status is being challenged here. :-) OMG! )
My co-worker Doctor Barrero did a quick test on Render Monkey, and the answer is 1.(the first choice, or passing simply 1 as the 4th component). Also you can deduce the same answer from D3D Sampler State, D3DSAMP_MAXMIPLEVEL, which is documented as:
D3DSAMP_MAXMIPLEVEL: level-of-detail index of largest map to use. Values range from 0 to (n - 1) where 0 is the largest. The default value is zero.
By the way, this works same both on DirectX and OpenGL.