Coder Social home page Coder Social logo

normalmap's Introduction

normalmap

Command line utility to convert height maps to DU-DV normal maps.

Platforms

Windows binary is provided.

Should compile and run on most modern compilers (GCC Clang, and MSVS). CMake build script is provided.

Usage

normalmap.exe infile outfile

The height will be taken from the red channel of the source image. RGBA PNGs are tested and recommended but any image type supported by stb_image should work.

The output will be an unfiltered, 8-bit unsigned du/dv map, which can be used as a normal map in rendering applications. The heightmap sampler is a 2x2 box.

The underlying normal map generation code is inherited from The GIMP and is considerably more flexible.

The following settings are provided by command line arguments:

  • -f Sampler filter
    • None default
    • Sobel 3x3, 5x5
    • Prewitt 3x3, 5x5,
    • Generic 3x3, 5x5, 7x7, 9x9
  • -s Scale default = 2.0
  • -h Height source:
    • Luminance
    • Unbias RGB
    • Red default, Green or Blue channel
    • Alpha channel: height, height inverted
  • -w Wrap output

Run the program without any arguments for details on how to use them.

In this version, you must update main.c and rebuild to change the other following settings:

  • Output type:
    • du/dv 8-bit signed default, 8-bit unsigned, 16-bit signed, 16-bit unsigned
    • true "normalized" normal

Note that the effect of du/dv output being unnormalized is that normal vectors constructed by sampling the map will require normalization in your shader or image loader, which means in turn that the effect of the scale parameter above is less pronounced than it would be otherwise.

normalmap's People

Contributors

tatrabbit avatar justinbowes 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.