GithubHelp home page GithubHelp logo

ptexutils's Introduction

===================================================================
ptexutils - Utilities to assist in the use of Ptex in production
===================================================================

This is the initial release of ptexutils, a set of small tools that are
intended to help in the adoption of Ptex (Per-Face Texturing).


Build Instructions
------------------

To build using CMake, just do:

    make

Under the hood the Makefile creates a temporary build directory and runs cmake
there, e.g.:

    mkdir -p build/foo &&
    cd build/foo &&
    cmake ../.. &&
    make

The provided top-level Makefile respects the "prefix" and "DESTDIR" variables.
This allows you to build ptexutils with prefix=/usr into a temporary staging
directory:

    make DESTDIR=/tmp/ptexutils prefix=/usr install


Using ptxtransfer
-----------------

The ptxtransfer utility is designed to transfer texel data when
a model has changed. The change may include mesh topology, but the
position and shape of the old and new versions should align roughly.
The executable attempts to copy face textures for a single Ptex file.

To run from the command line, do:

ptxtransfer [options] <old.ptx> <new.ptx>

Both of the provided Ptex files must include geometry meta data for the
transfer to succeed. The 'new' file does not need to contain useful
texture information, this file is only used for the geometry data.
The resolution, data type and channel format of the output will be
automatically configured to match the input, though the resolution may
not match exactly. The texture data in 'new.ptx' will be populated and
that file overwritten.

A maximum number of threads can be specified with an option, e.g.
"-t 4" will utilize four threads.

The transfer uses a two step algorithm. First, faces are matched using
position between the old and new meshes. Any matches found can be copied
directly, with possible flips and rotates applied to account for changes
in the vertex ordering. Such copies will preserve the texture quality
perfectly. Then, unmatched faces in the target mesh will completed using
a texel-by-texel point cloud lookup. The distance limits for these searches
can be adjusted using command line flags ("-m" and "-d"), detailed in the
"-h" help text. Increasing the distances may help if the shape change in
the old and new models is comparatively large.


Using ptxview
-------------

The ptxview utility is for viewing the contents of a single Ptex file.
If the file contains geometry meta data, the textures can be visualized
in 3D, otherwise a 2D layout of the faces will be shown.

To run from the command line, do:

ptxview [options] filename.ptx

A particular face ID can be specified with "-face <n>", and the 3D
display mode can be disabled with a "-flat" option.

Individual Ptex faces can be isolated by a left-click, with 'Esc'
or 'Up Arrow' returning to the default view. Right-clicking will
produce a pop-up menu with display options. Other controls include:

Navigation:
        Alt-Button 1:     rotate scene (3D mode only)
        Alt-Button 2:     pan scene
        Alt-Buttons 1&2:  zoom scene

Hot Keys:
        Right Arrow:      view next face
        Left Arrow:       view previous face
        Page Up:          advance 100 faces
        Page Down:        go back 100 faces
        Home:             view first face
        Page Down:        view last face
        r:                reset view
        f:                center data on screen
        q:                quit


Using ptxconvert
----------------

The ptxconvert utility can be used to convert image data to or from
the Ptex format, including environment cube maps (Penv). General
multi-face Ptex files are not supported, as this tool is intended for
regular image conversion.

To convert a single-face Ptex file to a JPEG image:

ptxconvert in.ptx out.jpg

To convert a TIFF (must be power-of-two dimensions) to Ptex, with
periodic border modes in u and v:

ptxconvert in.tif out.ptx -mode periodic

To convert six cube-map images into a Ptex environment map:

ptxconvert -envcube px.tif nx.tif py.tif ny.tif pz.tif nz.tif out.penv


Future Work
-----------

More utilities are planned to be added a later date.

The ptxtransfer code may be reworked into a library to assist with
integration into other tools. The ptxtransfer code currently uses
texel positions corresponding with a polygonal mesh - subdivision
surface support could be added to minimize distortion for textures
painted on such models.


- Dan Teece, Walt Disney Animation Studios

ptexutils's People

Contributors

davvid avatar dteece avatar gracien-app avatar sopvop avatar tangzhongsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ptexutils's Issues

Suggestions for future of ptexutils

I have finally spent some time and cleaned up my small ptex-tools project.

Currently there are two tools, one for merging ptex textures into one, to make dealing with
cases when you have multiple meshes with same material a bit easier. And tool for reversing winding order in ptex texture, helps when you need to render both alembic cache with renderman procedural and rms exported geometry.

I think it would be nice to merge these tools into ptexutils.

Exposing ptexutils tools not only as executables, but also as a library
and possibly python module (as ptex-tools does).

Merging future tools (besides viewer, it adds GL dependency) into single executable, with interface like git has. That would make using statically linked ptex library less painful. Statically linked executables are somewhat easier to deploy by just dropping into shared NFS folder. And yes, ptex-tools does that ;)

converting std::string to Ptex::v2_3::String problems

Have troubles with compiling ptexutils for Windows, MSVC 2017
Compiled all dependencies with vcpkg. All project have the same errors in converting std::string to Ptex::v2_3::String

Error C2664 'Ptex::v2_3::PtexTexture *Ptex::v2_3::PtexTexture::open(const char *,Ptex::v2_3::String &,bool)': cannot convert argument 2 from 'std::string' to 'Ptex::v2_3::String &' ptxconvert C:\src\ptexutils\src\ptxconvert.cpp 321 Error C2664 'Ptex::v2_3::PtexWriter *Ptex::v2_3::PtexWriter::open(const char *,Ptex::v2_3::MeshType,Ptex::v2_3::DataType,int,int,int,Ptex::v2_3::String &,bool)': cannot convert argument 7 from 'std::string' to 'Ptex::v2_3::String &' ptxconvert C:\src\ptexutils\src\ptxconvert.cpp 349 Error C2664 'bool Ptex::v2_3::PtexWriter::close(Ptex::v2_3::String &)': cannot convert argument 1 from 'std::string' to 'Ptex::v2_3::String &' ptxconvert C:\src\ptexutils\src\ptxconvert.cpp 375 Error C2664 'Ptex::v2_3::PtexTexture *Ptex::v2_3::PtexTexture::open(const char *,Ptex::v2_3::String &,bool)': cannot convert argument 2 from 'std::string' to 'Ptex::v2_3::String &' ptxconvert C:\src\ptexutils\src\ptxconvert.cpp 391 Error C2664 'Ptex::v2_3::PtexWriter *Ptex::v2_3::PtexWriter::open(const char *,Ptex::v2_3::MeshType,Ptex::v2_3::DataType,int,int,int,Ptex::v2_3::String &,bool)': cannot convert argument 7 from 'std::string' to 'Ptex::v2_3::String &' ptxconvert C:\src\ptexutils\src\ptxconvert.cpp 460 Error C2664 'bool Ptex::v2_3::PtexWriter::close(Ptex::v2_3::String &)': cannot convert argument 1 from 'std::string' to 'Ptex::v2_3::String &' ptxconvert C:\src\ptexutils\src\ptxconvert.cpp 470

Do somebody have any suggests, what it could be?

FindPtex.cmake does not work with version >= 2.1.0

With the shift to storing the API version in PtexVersion.h, the section where it checks for API version in (https://github.com/wdas/ptexutils/blob/56b32c1e853fbe750e826b3b9e2e61863b5755aa/cmake/FindPTex.cmake) will fail because it only checks in Ptexture.h, and will come up with an empty string (the actual error comes when trying to perform the subsequence REGEX MATCHALL on an empty string). It should probably check both headers to support backwards compatibility.

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.