antialiasing, hdr and a geforce 8800

Started by
15 comments, last by ava 17 years, 1 month ago
It's not that much more complicated..

Here's your pseudo d3d code (all targets listed here have same dimensions !):

// Init

CreateDevice(backbuffer and frontbuffer both called targetA, multisampletype_none, absolutely no automatic depth stencil !).

CreateDepthStencilBuffer(targetZ, Z24X8/Z24S8, multisampletype_2x_4x_8x, quality level 0-7); // <- no Z16 please

CreateRendertarget(targetB, A16B16G16R16F, multisampletype_2x_4x_8x, quality level 0-7 (they must match above !)) // <- this is not a texture !

CreateTexture(textureC, Rendertarget, pool_default, A16B16G16R16F, multisampletype_none); // <- important, see below

// first frame

BeginScene();

SetRenderTarget(targetB);
SetDepthStencilSurface(targetZ);
Clear(both);
RenderScene(); // <- hdr scene as you do usually

StretchRect(From targetB to texture C); // <- no rectangle, matching dimensions please

SetRenderTarget(targetA);
SetDepthStencilSurface(NULL); // <- important

Clear(color); // optional since you're stomping it just below

DrawFullScreenquad(with texture C); // tone mapping pass with a dedicated shader. This should be more complicated if you have bloom or other effects obviously.

RenderInterface(); <- don't tonemap or multisample your interface.

EndScene();

Present();

// [...] now we draw the same frame again and again and again.

// After we're done we release everything.

That's it. Not that complicated, isn't it ?

LeGreg
ps: there are other topics, like what tonemapping formula to use, why there is more aliasing in the hdr version and the like. but let's keep it simple for now..
Advertisement
And for your pleasure, HL2 version :

CreateDevice(with AA, with automatic depth stencil);
// frame
RenderScene(); // <- do automatic scaling at the end of the shader (color = color * tonemappingconstant).
DrawSomeBloom();
Present();

This doesn't work if you've got to accumulate passes at high quality (limited multipass lighting), and you loose hdr texture for the bloom (cheap bloom instead) etc. But it works for their game at least.

LeGreg
@gjoel

So is it possible in OpenGL to use FSAA & HDR together on an GeForce 7xxx (and 6xxx) series card?

Or is that extention only supported by a 8xxx.
Someone who uses a, euhm..., delta!?
Quote:Original post by delta user
@gjoel

So is it possible in OpenGL to use FSAA & HDR together on an GeForce 7xxx (and 6xxx) series card?

Or is that extention only supported by a 8xxx.

My Geforce 7 supports GL_EXT_FBO_multisample, but I can't use a fp16-format together with it. Maybe some high precision integer format can be used, but I haven't tried that. It must be possible, there is a screensaver by Nvidia featuring HDR and antialiasing...

--
LeGreg: which tone mapping operator do you recommend?
Quote:Original post by wolf
LeGreg: which tone mapping operator do you recommend?


I doubt there is a definitive answer on that. Depends on your scene, on the cost of tonemapping you want etc.

The one frequently used in published games is a simple color = color * scalingconstant. That will avoid the frame being too dark or too bright, but will only allow limited dynamic range on the same frame (unless the constant is recomputed for each pixel of the image), and it will allow for luminance saturation. It has a linear response (minus srgb) on the relevant part of the tonemapping curve contrary to other types (that means color tones are preserved, and filtering works as advertised as long as no pixel is overbright).

The microsoft sdk sample advertises another one :
color = color * scalingconstant / ( 1 + color * scalingconstant)
This comes from a research paper and is derived from a photographic-like tonemapping. "better" dynamic range, no luminance saturation (unless explicitely allowing it by scaling on top of the formula above), non linear response (it's a rational curve) so color will look unsaturated and filtering won't work as well as advertised.

Gah.. it's probably too big a topic to be discussed in this thread (simple question -> simple answer :) ).

LeGreg
@LeGreg: Thanks man! I followed the steps you described and it works perfectly!
Alex Vanden AbeeleGraphics ProgrammerLarian Studioshttp://www.larian.com

This topic is closed to new replies.

Advertisement