Vertex Texture + MipMap

Started by
3 comments, last by Zaph-0 15 years, 9 months ago
Hi, I created a vertex texture with several mipmaps and filled them with the vertexdata. In the shader I try to access the data with: tex2Dlod(vertexmap, float4(0, 0, 0, level)); where level is the level of detail. I am sure the vertex textures are set up correctly because I can actually access level 0 of it in the shader and I can also lock them and read the data back for the higher levels in my program. The problem now is that I cannot access the higher levels with the shader but only level 0 is being accessed. I tried playing around with: d3ddevice->SetSamplerState(D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MIPMAPLODBIAS,-1); d3ddevice->SetSamplerState(D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MAXMIPLEVEL ,2); d3ddevice->SetSamplerState(D3DVERTEXTEXTURESAMPLER1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); d3ddevice->SetSamplerState(D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, D3DTEXF_NONE); d3ddevice->SetSamplerState(D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MAGFILTER, D3DTEXF_NONE); but that didn't get me anywhere. Do I have to set something else or what could be the problem ? [Edited by - Zaph-0 on July 10, 2008 4:06:19 AM]
Advertisement
I tested to put the different values in the same texture and can adress them there but I still cannot get access to a mipmap level > 0. The reason for the mipmap-approach was because I need several textures that always have half the resolution of the previous texture and mipmap fits that perfectly.

That is, if I can get it to work...

If there is anything anyone could say about it I would really appreciate it because I am really stuck here and digging through documentation and the net for hours has not brought me any closer...
tex2Dlod is supported in the pixel shader only.

http://msdn.microsoft.com/en-us/library/bb509680(VS.85).aspx
NextWar: The Quest for Earth available now for Windows Phone 7.

Actually its also (inofficially) supported in the vertexshader. I am using it to access the level 0 of a mipmap texture perfectly fine.

I just cannot access other levels.

Maybe that's a shortcoming of it...dunno...have to research it further...


Ok, after loooong researching, reading, trying and cursing I found the mistake:

d3ddevice->SetSamplerState(D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MIPFILTER, D3DTEXF_POINT);

the mipfilter cannot be D3DTEXF_NONE but has to be either D3DTEXF_POINT or D3DTEXF_LINEAR.

D3DTEXF_POINT results in using a single map while D3DTEXF_LINEAR allows using something like 0.5 as setting w of the vector to interpolate between map 0 and map 1.

I really feel like reinventing the wheel (where have all the coders gone ?) and hope that someone who is having the same problem can find the solution here...

^_^

This topic is closed to new replies.

Advertisement