GithubHelp home page GithubHelp logo

airguanz / d3d11-smaa Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 3.0 3.26 MB

My DirectX 11 MLAA & SMAA implementation

CMake 0.17% PowerShell 0.01% C++ 83.11% C# 1.31% HLSL 2.21% Batchfile 0.25% POV-Ray SDL 5.82% Pawn 2.72% Assembly 2.27% Pascal 1.98% PHP 0.15%
graphics real-time antialiasing

d3d11-smaa's Introduction

D3D11-SMAA is a header-only implementation of MLAA and SMAA for DirectX 11.

pic

Getting Started

Simply include ./include/agz/smaa/mlaa.h or ./include/agz/smaa/smaa.h in your project.

Building Example

Run following cmds in project directory:

mkdir build
cd build
cmake ..

The algorithm implementation in mlaa.h and smaa.h is C++11 compatible. However, the example project and its dependencies require a compiler with C++17 support and Win10 SDK. Thus, Visual Studio 2017/2019 is recommended for building the example.

Usage

  1. Create a SMAA/MLAA instance with D3D device/deviceContext and algorithm parameters:

    // for MLAA:
    auto mlaa = std::make_unique<agz::mlaa::MLAA>(
                	device, deviceContext,
                	targetSize.x, targetSize.y,
                	agz::mlaa::EdgeDetectionMode::Lum,
                	edgeThreshold, maxSearchDistanceLen);
    
    // or for SMAA:
    auto smaa = std::make_unique<agz::smaa::SMAA>(
                	device, deviceContext,
                	targetSize.x, targetSize.y,
                	agz::smaa::EdgeDetectionMode::Lum,
                	edgeThreshold, edgeLocalContrastFactor,
                	maxSearchDistanceLen, cornerAreaFactor);
  2. In each frame:

    bind and clear render target for edge detection
    smaa/* or mlaa */.detectEdge(inputImage/* or depthTexture */)
        
    bind and clear render target for blending weight computation
    smaa/* or mlaa */.computeBlendingWeight(edgeTexture)
        
    bind and clear render target for final result
    smaa/* or mlaa */.blend(weightTexture, inputImage)

The meanings of algorithm parameters and requirements of render targets are explained in mlaa.h and smaa.h. However, reading the original paper is still highly recommended.

TODO

  • Diagonal pattern handling

Reference

http://www.iryoku.com/mlaa/

http://www.iryoku.com/smaa/

d3d11-smaa's People

Contributors

airguanz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.