Sign in to follow this  

linear filtering problem

This topic is 4733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i have another question, i have a terrain with a road but the road is blurred to much in the distance or in certain places. see image below: (it's my first 3d project, i know it still needs a lot of work :( ) I tried using anisotropic filtering but that was a disaster for my framerate. Is there something else i can do? Should i make my texture bigger, i'm not an artist, so the quality of the textures i use is not very good (mostly things i find for free on the net) Thanks in advance

Share this post


Link to post
Share on other sites
Hi,

It seems to be a mip mapping problem, you could disable it for the road, but then you'll get all kind of aliasing in the distance. Have you tried playing with the D3DSAMP_MIPMAPLODBIAS sampler state when rendering the road? It will give you better control over mip map selection. I've never really used it so I don't know the performance impact or what value to set it to (I know it's a float, try using +/- 1.0f to see how it goes).

Share this post


Link to post
Share on other sites
thanks for your reply, but changing the lodbias didn't do the trick :(

This is what i now have


// road tex
_device->SetTexture( RoadTexDesc.RegisterIndex, _road);
_device->SetSamplerState(RoadTexDesc.RegisterIndex, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
_device->SetSamplerState(RoadTexDesc.RegisterIndex, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
_device->SetSamplerState(RoadTexDesc.RegisterIndex, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);



should i change anything about these values?

Share this post


Link to post
Share on other sites
Those states are correct.

Hmmm.. You can try to sharpen the low resolution mip map levels if you generate them by yourself, but I'm not sure how much of a difference it will make, if any..

Or there could be a way to change or split the road texture so that you'll minimize the mip mapping artefacts. Can you post the texture?

Share this post


Link to post
Share on other sites
Quote:
Original post by XerXis
Hi, i have another question, i have a terrain with a road but the road is blurred to much in the distance or in certain places. see image below:

(it's my first 3d project, i know it still needs a lot of work :( )

I tried using anisotropic filtering but that was a disaster for my framerate. Is there something else i can do? Should i make my texture bigger, i'm not an artist, so the quality of the textures i use is not very good (mostly things i find for free on the net)

Thanks in advance


Much of this depends on the quality of your mip levels. How are you computing them? Be sure the mip levels are computed in linear space (instead of gamma space that it is currently in), and use a nice minimization filter to get best results (maybe a window sync).

Share this post


Link to post
Share on other sites
It could be because the texture is rectangular and stretched over a good distance. You can see the generated mip map levels with the DirectX Texture Tool by loading the texture and making it generate the mip map chain. Then with Page Up/Down you can browse the levels. You'll notice that the white lines are pretty strong even in the smaller mip levels, so you can see why you get those huge blurry white spots on the road when those small levels are stretched over a few pixels.

Here is a part of your original texture, now 256x256:



It may be worth trying to use this one instead (as-is on the left side, mirorred on the right side), but you'll have to change the road model a bit. Unfortunately, I'm not 100% sure if this is going to be any better.

Also, it is usually preferable to use power of 2 textures since most devices are not officially supporting non-power of 2 textures. If you loaded the texture with D3DX, it was probably resized internally.

Share this post


Link to post
Share on other sites
thanks, i didn't know you could see the mipmap chain with texture tool, i'll try your advice tomorrow. now it's time to go out and celebrate new year :)

so a happy new year to all of you :)

Share this post


Link to post
Share on other sites
well, changing my texture from a rectangular rather small texture to a bigger square texture solved the problem (at least it's not that blurred any more) without changing the filters, actually, it makes a lot of sense ;)

Share this post


Link to post
Share on other sites

This topic is 4733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this