Jump to content
  • Advertisement
Sign in to follow this  
Constantin

Offscreen anti-aliasing (what am I doing wrong?)

This topic is 3880 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

I want to render anti-aliased scene to a HDC (from a HBITMAP). I create a device with non-lockable backbuffer with D3DMULTISAMPLE_NONMASKABLE and quality 7 (what does quality mean?). I render with setrenderstate D3DRS_MULTISAMPLEANTIALIAS set to TRUE. I stretchrect to a rendertarget of the same size (also non-lockable) with no multisampling. The docs call this stage downsampling (what does it mean?) I could have made the rendertarget lockable and blitted to the HDC but in Vista blitting from a render target is slow, so I have the following step. I GetRenderTargetData to an offscreen surface. I blit the surface to the HDC. The result looks the same as before (no anti-aliasing). Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
>> I want to render anti-aliased scene to a HDC (from a HBITMAP).

I mean to say here that the HDC is a created from a HBITMAP.
I want to render a directx scene to a HBITMAP.


Share this post


Link to post
Share on other sites
Tried the AntiAlias.exe sample. Doesn't seem to make much of
a difference any which multisample type and quality I choose.

Share this post


Link to post
Share on other sites
The meaning of the quality setting depends on the GPU you're running on. For example the Nvidia G80 GPU's have several kinds of multisample modes that use 4 samples, but you'll see them being called 8x, 8xQ, CSAA, etc. The number of samples is the important part: make sure you use D3DMULTISAMPLE_2_SAMPLES or D3DMULTISAMPLE_4_SAMPLES, don't worry about the quality unless you know what settings they correspond to.

As for the "downsampling", this actually called resolving. You see a multisampled buffer is much bigger than a normal buffer, since it needs "extra" memory to hold the additional samples that are stored. So for example if you have an A8R8G8B8 (4 bytes) buffer with 4x multi-sampling, the buffer will store 4 sub-samples per pixel for 16 bytes per pixel. The resolving part comes in when you have to display that buffer or use it as a texture, you need to get rid of those sub-samples by filtering them (averaging them together). After a resolve, the buffer is the same size as a non-multi-samples buffer.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!