Jump to content
  • Advertisement
Sign in to follow this  
adriano_usp

[XNA] enable dithering in XNA

This topic is 3665 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, Please, which would be the equivalent to: g_pD3DDevice->SetRenderState( D3DRS_DITHERENABLE, TRUE ); // Direct3D 9 in XNA? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
The XNA equivalent of IDirect3DDevice9::SetRenderState is the RenderState class, which you can access through a device's RenderState property. However I don't see a property corresponding to DITHERENABLE...it's possible it was removed because the Xbox 360 doesn't support it, or has weird semantics on modern hardware. You can try setting it using an EffectState, and see if that works.

Just curious, what are you using dithering for anyway?

Share this post


Link to post
Share on other sites

It doesn't seem to be an available render state in XNA indeed (at least I can't find it), but I can't help but wonder why you need it. I haven't had to use it myself and according to this info it only works on 16 bit surfaces anyway. From my limited understanding, by using 32 bit surfaces (like the typical SurfaceFormat.Color), you won't need the dithering anyway since these formats can support pretty much all colors you'd want, right?

Share this post


Link to post
Share on other sites
Quote:

Just curious, what are you using dithering for anyway?

I had used C++/Direct3D some years ago and now I would like to port some of my codes to XNA. I'm still starting in XNA, so I'm initially checking for XNA objects, methods and renderstates that are equivalent to those present in my codes.

I remember the dithering improved the visual quality of some textured 3D models. But perhaps it is not necessary in XNA.

Thanks for replying.

Share this post


Link to post
Share on other sites
Please, look at this image:

effects_xna.png

Setting mag, min and mipfilter as LINEAR wouldn't be enough to produce the BasicEffect rendering appearance?

For a moment I thought the linear texture filters had not been applied, but you can notice a small difference between the scenes 1 and 2 (see the contour of the bee).

Could anybody tell me what filters are need to produce the BasicEffect rendering appearance?

Thanks in advance

Share this post


Link to post
Share on other sites
Make sure you have MIP maps created for your textures, and the MIP filter is not set to POINT.

You could also try Anisotropic filtering.

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
Make sure you have MIP maps created for your textures, and the MIP filter is not set to POINT.

You could also try Anisotropic filtering.

Well, I'm using the following sampler in my effect file:

sampler textureSampler = sampler_state
{
Texture = <fx_Texture>;
magfilter = Linear;
minfilter = Linear;
mipfilter = Linear;
};

I already tried anisotropic filtering, but the result is still very different from the scene 3.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!