项目作者: serhiy

项目描述 :
Utility for manipulating the textures.
高级语言: Java
项目地址: git://github.com/serhiy/texture-manipulation.git
创建时间: 2016-07-24T21:34:14Z
项目社区:https://github.com/serhiy/texture-manipulation

开源协议:MIT License

下载


Java Texture Manipulation Utilities

Disclaimer:

This work is essentially a port of the existing C code: https://sourceforge.net/p/ssbumpgenerator/svn/HEAD/tree/Normal2DuDv/, so I might not be fully available to answer the questions about the algorithms and constants used in the implementation.

Building

The project requires Maven to be built from sources. To build the JAR for your code, you can execute the following command in the root of the texture-manipulation project:

  1. mvn package

You can add this project as Maven dependency using jitpack:

  1. <dependency>
  2. <groupId>com.github.serhiy</groupId>
  3. <artifactId>texture-manipulation</artifactId>
  4. <version>0.0.1</version>
  5. </dependency>
  6. <repositories>
  7. <repository>
  8. <id>jitpack.io</id>
  9. <url>https://jitpack.io</url>
  10. </repository>
  11. </repositories>

Examples:

  • Convert image to height map:

    1. BufferedImage image = ImageIO.read("<input image path>");
    2. BufferedImage heightMap = ImageToHeightMap.convert(image);
    3. ImageIO.write(heightMap, "PNG", "<output image path>");
  • Convert height map to normal map:

    1. BufferedImage image = ImageIO.read("<input image path>"); // should be height map
    2. BufferedImage normalMap = HeightMapToNormalMap.convert(image, 5.0f);
    3. ImageIO.write(normalMap, "PNG", "<output image path>");
  • Convert normal map to DuDv map:

    1. BufferedImage image = ImageIO.read("<input image path>"); // should be normal map
    2. BufferedImage dudvMap = NormalMapToDuDvMap.convert(image);
    3. ImageIO.write(dudvMap, "PNG", "<output image path>");