Git Product home page Git Product logo

heightmap2obj's Introduction

heightmap2obj

A small and simple C++ CLI tool that converts greyscale heightmaps to 3D OBJ models. Uses lodepng and obj.

Usage

./hmap2obj <pngpath> <width> <height> <objpath> <extentX> <extentZ> <maxY>

  • pngpath - Absolute path to the input png file.
  • width - Width of the input png file in pixels.
  • height - Height of the input png file in pixels.
  • objpath - Absolute path to the output obj file.
  • extentX - Resulting model extent on the X-axis.
  • extentZ - Resulting model extent on the Z-axis.
  • maxY - White pixels will be mapped to this Y value. All other pixels will be mapped to a value between [0; maxY] according to their greyscale value. A black pixel will always map to Y = 0.

Adding Cmake files for easier usage

Cmake files have been added to compile and use this library

Usage instructions

mkdir build
cd build
cmake ..
make

A shell script file run.sh has also been included with a sample code. To use it:

sh run.sh 

The run.sh file looks like this:

./build/hmap2obj/hmap2obj \
./example_screenshots/input.png \
1081 \
1081 \
./output.obj \
2 \
2 \
10

Further you can use an online viewer to view the generated obj file.

Example

Input PNG

Height map of the Grand Canyon

Output OBJ (opened in Blender)

3D model of the Grand Canyon

heightmap2obj's People

Contributors

asprasan avatar emberflare avatar msoechting 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.