Skip to main content
gamedev.net
🔒 Locked

Using MipMaps

Started by spong3bob 1 reply 650+ views
Original Post
spong3bob
spong3bob
Hi! i want to use mipmaps for my terrain, but i think i always forget something as thex dont work.. D3DXCreateTextureFromFileEx( renderer->Device, Dateiname, D3DX_DEFAULT, D3DX_DEFAULT, levels, 0, D3DFMT_UNKNOWN, Pool, D3DX_FILTER_POINT, D3DX_FILTER_POINT, 0, NULL, NULL, &t); Thats the way im loading my texture (a 1024x1024 grayscale png used as a heightmap) levels usually is 4 und the pool is Managed. then im using the texture in my vertex shader: float zf_zd = tex2Dlod(ElevationSampler, float4(uv, 0, CurLevel)); But it just doesnt user the level i want it to use... (always level0 i think) did i do something wrong, or did i forget to do something (before i draw my primives i just set the texture and set the values of the constant tables)
Namethatnobodyelsetook
Namethatnobodyelsetook
If you do just a tex2D it will automatically use (and blend between) mipmaps for optimal speed and quality. Ensure you setup a mipfilter in your sampler states, usually set to linear.
spong3bob
spong3bob
i dont want it automatically because i got several levels in my terrain rendering algo, and to avoid that the terrain heights always switch (the result is a waveing animtion while moving) i want to use another mipmap-level in each level.

I now got it like that:

Device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); //(also tried it with POINT)
Device->SetTexture(D3DVERTEXTEXTURESAMPLER0,heightmapTextur);


but it still doesnt work..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.