background preloader

Samples

Facebook Twitter

HDR Tone Mapping C++ DirectCompute Sample. The sample shows how to calculate average luminance of an image using parallel reduction, and then apply it to tone mapping.

HDR Tone Mapping C++ DirectCompute Sample

Additionally, blur and bloom effects can be calculated both on compute and pixel shaders (for comparison) and then rendered. It also demonstrates how to setup and run image post-processing on a compute shader, it modifies a skybox texture by applying to it bloom and blur and toning it. It is based on SDK application by the same name. The program requires Windows 8 and DirectX 11. The application computes luminance of a skybox texture, which in technical terms is a luminous flux incident on a surface per unit area or a measurement of perceived brightness, before applying it to the final rendered output. Mathematically the algorithm is termed as convolution, or an integral that expresses the amount of overlap of one function as it is shifted over another one. In this example, each pixel in shared memory is loaded only once from input image using texture read.

DX11 DirectCompute Buddhabrot & Nebulabrot Renderer. Introduction I wrote a DX11 DirectCompute implementation of the famous Buddhabrot fractal. The implementation is an extension of my earlier Mandelbrot fractal DX11 DirectCompute program ( ). I also use my Rheinhard tonemapping code ( ) to bring the HDR Buddhabrot color values into the LDR framebuffer’s [0,1] range. It’s good that I used code from my old demos because I found and fixed bugs in my tonemapping code and also realized I had forgotten to upload the source and binary for my DX11 Mandelbrot demo to CodePlex (doh!). Regular Buddhabrot renderings result in monotone achromatic images because the same single value is written to each RGB channel. As usual, a CodePlex link for my Buddhabrot program’s source code and binary are provided near the end of the article.

Relevant Links 1) Web page by the Buddhabrot’s discoverer Melinda Green. DX11 DirectCompute Buddhabrot Demo - Beyond3D Forum. I had a look at the source and did a few things to optimize performance for a 5870, going from about 80 fps to 140 fps or so.

DX11 DirectCompute Buddhabrot Demo - Beyond3D Forum

The first thing I did was to try to improve the performance of the Iterate() function by changing the way the dynamic loop is done in BuddhabrotCS.hlsl: Original code: Code: for( int nIteration=0; nIteration<nMaxIteration; ++nIteration ) { float zRe2 = zRe*zRe; float zIm2 = zIm*zIm; /// check whether absolute value of z has gotten bigger than 2 if( zRe2 + zIm2 > 4.0 ) { return nIteration; } // calculate next z(n) zIm = 2.0*zRe*zIm + cIm; zRe = zRe2 - zIm2 + cRe; } // complex number did not escape to infinity return nMaxIteration; New code: // Doing the loop this way improves performance for an equivalent result int nIteration=0; float zRe2 = zRe*zRe; float zIm2 = zIm*zIm; while (nIteration<nMaxIteration && (zRe2 + zIm2 <= 4.0) ) { // calculate next z(n) zIm = 2.0*zRe*zIm + cIm; zRe = zRe2 - zIm2 + cRe; zRe2 = zRe*zRe; zIm2 = zIm*zIm; nIteration++; } return nIteration;

XDSP.H: Digital Signal Processing helper functions - Games for Windows and the DirectX SDK. DirectCompute Fluid Simulation. DirectCompute Basic Win32 Samples in C++ for Visual Studio 2012. HLSL shader compiler sample (Windows 8.1) in C++ for Visual Studio 2013.