# [XNA] enable dithering in XNA

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

## Recommended Posts

Hi, Please, which would be the equivalent to: g_pD3DDevice->SetRenderState( D3DRS_DITHERENABLE, TRUE ); // Direct3D 9 in XNA? Thanks in advance

##### Share on other sites
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 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 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.

##### Share on other sites

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?

##### 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 on other sites
Quote:
 Original post by sirobMake 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.

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
18
5. 5

• 9
• 33
• 13
• 13
• 10
• ### Forum Statistics

• Total Topics
632582
• Total Posts
3007213

×