Giter Site home page Giter Site logo

hextile-demo's Introduction

hextile-demo

Hex-Tiling Example

It is common in real-time graphics to use tiling textures to represent large surface area however repetition is noticeable as can be seen here on the left. Using hex-tiling allows us to hide the repetition but requires a solution to hide the seams between adjacent hex tiles. This sample is a demonstration of the paper Practical Real-Time Hex-Tiling which has been accepted for publication in JCGT and will appear there in the near future. The method is an adaptation of the original work by Eric Heitz and Fabrice Neyret as well as Thomas Deliot and Eric Heitz.

Hex-Tiling Mask

The original approach preserves contrast using a histogram–preserving method which requires a precomputation step to convert the source texture into a transform– and inverse transform texture which must both be sampled in the shader rather than the original source texture. Thus deep integration into the application is required for this to appear opaque to the author of the shader and material. In our adaptation we omit histogram–preservation and replace it with a novel blending method which allows us to sample the original source texture.

When running this demo be sure to try to rotate the hex tiles. You can toggle between 4 different parameters to tweak on the m key: tile rate, rotation, hex tile border contrast for color and hex tile border contrast for normal mapping. Press and hold the scroll wheel while moving the mouse to adjust the active parameter. Press the r key to reset all 4 parameters.

Hex-Tiling-Vid_Comp.mp4

Most of the hex-tiling specific utility functions are in the file hextiling.h however for those of you looking to use hex-tiling as planar/triplanar projection on large levels you should look at hextiling_rws.h which provides a special variant to maintain fractional precision as we move far away from the center of absolute world space.

An important observation when rotating hex tiles for normal maps is the average normal of the normal map must align "well" with the Z axis (0,0,1) or the tilt will appear very clearly in the lit result. Good alignment is achieved when the normal map corresponds to a tiling height map. Note that a tiling normal map does not necessarily correspond to a tiling height map. A basic example is a normal map of a tilted plane (ie. a flat color). This represents a tiling normal map but not a tiling height map.

In practice it is easy to end up with a normal map which does not represent a tiling height map since artists may use a combination of different art tools which offer no such guarantee. It is possible to fix a misaligned normal map by importing it into Knald at which point the integrator finds a best fit tiling height map. However, be sure to set the Slope Range in the integrator group to 80% or higher to ensure the tool allows slopes steeper than 45 degrees. The result can be exported as a corrected normal map.

hextile-demo's People

Contributors

mmikk 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.