This adds some new functions to libimage for computing distance fields
and coordinate fields. This runs on the CPU but uses an efficient
algorithm. This will initially be leveraged by the baking pipeline to
dilate charts, but could be useful in other applications.
Background: with the Vulkan backend, RGB8 textures do
not work (at least not on my hadrware). This makes me unable to run some
examples, because they use normal maps in RGB8 format.
It appears that the following commit addresses the problem by adding a
special command line option to mipgen:
8dda07bf2c
However, processing normal maps with this option does not work: certain
assertions in the image library fail.
This PR changes these functions in the image library to handle 4-channel
images instead of failing.
When using GAUSSIAN_NORMALS, image::resampleImage automatically unitizes
its output. This means that clients (e.g. mipgen) need to ensure that
the source image is in [-1,+1] rather than [0,+1].
* Overhaul the image library, Phase I.
The preps for our upcoming mipgen command line tool by adding filtering
capabilities and unit tests for a new LinearImage class, which will
subsume Image (deprecated).
Filament's new image library is composed of three components:
- LinearImage....simple 3D tensor of floats
- ImageOps.......free functions for simple transforms
- ImageSampler...high quality filtering
The old Image class was a simple untyped data blob and is now
deprecated. The new LinearImage class is always float32, and always
stores pixels in packed scanline order. This makes it easier to
implement image-based algorithms because they can be agnostic of the
underlying format.
Remaining refactorings:
- Phase II will migrate imageio to LinearImage
- Phase III will migrate all downstream tools to LinearImage
- Phase IV will remove old the Image class
* Image library code review feedback.