Commit Graph

437 Commits

Author SHA1 Message Date
Philip Rideout
fdfb8862eb gltf_baker: allow tmin adjustment. 2019-06-03 13:03:14 -07:00
Philip Rideout
8df3253955 Resurrect the denoiser.
This follows the convention of providing our own CMake files in the tnt
folder(s) and successfully builds with the -i option (install).
2019-06-03 10:39:56 -07:00
Philip Rideout
78ec315b69 Overhaul the gltf_baker UI.
As per the design doc, this makes the app somewhat usable by eliminating
hardcoded filenames, the hidden state machine, etc.
2019-06-03 08:32:48 -07:00
Philip Rideout
97b5d43bd5 AssetPipeline: renormalize after baking transforms. 2019-05-30 16:03:13 -07:00
Romain Guy
e1b773958f Add screen and multiply blending modes (#1241)
* Add screen and multiply blending modes

This change also fixes a sorting issue: different sorting modes
were sorted in different buckets which is incorrect. We want
to sort only by distance.

* Update release notes and Java API

* Fix build error
2019-05-30 10:17:16 -07:00
Jack Diver
1b45f253eb Removed unnecessary nullptr guard from MeshReader::MaterialRegistry destructor. 2019-05-30 09:54:37 -07:00
nitronoid
7a2b5125ed Moved back to [] syntax, works for exisitng string keys now. 2019-05-30 09:54:37 -07:00
nitronoid
da39dbcb57 Fixed move constructors for MeshReader::MaterialRegistry 2019-05-30 09:54:37 -07:00
Philip Rideout
bafa62cdec Repair the install target, disable denoise.
This rolls back denoise functionality to repair install builds.
Will investigate a proper fix by authoring a tnt/CMakeLists.
2019-05-29 15:41:34 -07:00
Ben Doherty
89c4647c3c Expose gltfio library so it can be used by third_parties (#1230) 2019-05-28 14:50:38 -07:00
Philip Rideout
cc89b6ad1e PathTracer now applies OpenImageDenoise. 2019-05-28 11:43:50 -07:00
Philip Rideout
761b407159 AssetPipeline now has replaceOcclusion function.
This preserve original materials and substitutes the occlusion texture
with the generated AO.
2019-05-24 14:59:10 -07:00
Philip Rideout
8f1d4ffa4d gltf_baker now parameterizes in a background thread. 2019-05-23 22:06:43 -07:00
Mathias Agopian
1716f9e7cd fix our ostream << hex << char
Even when hex modifier is used, 'char' should be printed as characters,
this is particularly relevant with 0.
e.g. out << (char)0, should write a nul terminator, not "0".
2019-05-23 21:46:28 -07:00
Romain Guy
0a5c068cb6 Switch specular AA to Tokuyoshi and Kaplanyan (#1218)
This replaces the previous "curvature to roughness" method. Both are related
and rely on the screen space variance of geometric normals but this new
solution offers more control (the screen space variance and the clamping
threshold can be controlled).
2019-05-23 12:56:26 -07:00
Philip Rideout
d7778e29b0 Light maps are now dilated to remove seams. 2019-05-22 12:33:07 -07:00
Philip Rideout
5a5b6720b0 Add distance field generator to libimage.
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.
2019-05-21 20:21:41 -07:00
Ben Doherty
399f7c24ac Fix flaky sstream test (#1205) 2019-05-20 13:09:03 -06:00
Romain Guy
0347fb0441 Add new material properties: specular/multiBounceAmbientOcclusion (#1198) 2019-05-18 14:30:08 -07:00
Philip Rideout
24a77023bd Add AssetPipeline::bakeAllOutputs for diagnostic purposes. 2019-05-17 10:01:26 -07:00
Philip Rideout
07be9d1721 PathTracer: add bent normals and diagnostic targets. 2019-05-17 10:01:26 -07:00
Philip Rideout
9a72831a33 AssetPipeline can now preview baked texture. 2019-05-16 15:53:20 -07:00
Philip Rideout
59f929c7d3 Fix "already freed" bug in gltf_baker. 2019-05-16 15:53:20 -07:00
Philip Rideout
c112b3ce40 Introduce AssetPipeline::SCALE_TO_UNIT to boost bake quality. 2019-05-15 16:44:33 -07:00
Philip Rideout
affc947ce0 gltf_baker: improve error reporting. 2019-05-15 16:44:33 -07:00
Philip Rideout
cbfb364c41 Introduce libs/rays and implement AO baking.
The AO baking procedure consists of the following steps:

1. Flatten the glTF hierarchy.
2. Generate a single 2D parameterization for the entire scene.
3. Embree Pass 1: Create G-Buffer using the above UVs as vert positions.
4. Embree Pass 2: Cast rays from the positions embedded in the G-Buffer.

The `gltf_baker` tool is not ready for general use but already
produces reasonable results for certain well-formed models.
2019-05-15 13:10:56 -07:00
Philip Rideout
c84c60112e Implement the bake button, uses a "UV camera" to cast primary rays. 2019-05-15 13:10:56 -07:00
Romain Guy
bdd3e343ba Add multi-bounce AO based on GTAO (#1180) 2019-05-14 08:58:49 -07:00
Philip Rideout
cd364b029c gltf_baker: fix needless reload for rendering. 2019-05-13 18:55:56 -07:00
Philip Rideout
3e1ed97187 Add QUIET to find_package with embree, etc. 2019-05-13 18:55:37 -07:00
Ben Doherty
daddc25de8 Remove std::sstream from filamat (#1176) 2019-05-13 13:56:15 -07:00
Philip Rideout
4237ff42c9 PathTracer now generates ambient occlusion.
For now this uses the geometric normals provided by embree rather than
the smooth normals that ship with the model, I will fix this next.
2019-05-13 10:25:12 -07:00
Philip Rideout
3291fb6a1b Introduce gltf_baker tool. 2019-05-13 10:25:12 -07:00
Philip Rideout
f5b47dc95e PathTracer should not exceed MAX_JOB_COUNT. 2019-05-10 14:40:17 -07:00
Philip Rideout
80f6f18e54 Introduce gltfio::PathTracer and baking API.
AssetPipeline now has a path tracer and optionally uses embree. For now,
the path tracer only sends out visibility rays and generates a simple
hit-or-miss monochrome bitmap. It splits the render target into tiles
and invokes a JobSystem task for each tile.

Filament developers can optionally install embree using homebrew or a
debian package. This avoids bloating third_party and increasing our
build time. If embree is not installed, a friendly run-time error will
occur when attempting to invoke the rendering functionality in
AssetPipeline.

The AO code is not yet implemented, but this PR sets up the
infrastructure, API, and camera rays.
2019-05-10 08:04:09 -07:00
Adrian Perez
3987da830c Fix -Wconversion issue in public header (#1172) 2019-05-09 17:00:34 -07:00
Mathias Agopian
cbae6120e1 Ambient Occlusion APIs are more descriptive
Use “AmbientOcclusion” instead of SSAO in all APIs.
2019-05-09 16:36:18 -07:00
Mathias Agopian
011daa952e Add API for controlling SSAO 2019-05-09 16:36:18 -07:00
Philip Rideout
cb98b75400 Implement AssetPipeline::parameterize() using xatlas. (#1167)
This feature consumes a flattened glTF asset and produces a glTF asset
with new topology and an additional set of UV coordinates suitable for
baking light maps.

I verified with a couple glTF models that the generated assets are
visually equivalent to the source assets, even though the topology and
scene hierarchy is different.

The actual light baking is not yet implemented, but this is a major step
towards that goal.
2019-05-09 14:09:27 -07:00
Ben Doherty
9a87b05570 Add new filamat_lite target to filamat (#1168) 2019-05-08 14:04:00 -07:00
Mathias Agopian
062ec48ee6 Implement basic SSAO 2019-05-07 18:35:19 -07:00
Philip Rideout
2e391b01fe Introduce AssetPipeline for performing glTF manipulations. (#1163)
* Introduce AssetPipeline for performing glTF manipulations.

AssetPipeline offers a place for doing things like scene flattening,
transform baking, and optimization of glTF assets. These types of scene
manipulations will allow us to tackle lightmap baking in the upcoming
atlasgen tool.

This initial PR includes support for scene flattening, which is fairly
non-trivial. Support for parameterization via xatlas will be added in a
subsequent PR.

In a glTF asset, a single mesh can be referenced by several nodes, and
each reference can have a unique transform. AssetPipeline can flatten
the asset such that each instanced mesh has its own vertex data, and the
node transform gets baked into the vertex data.

Recall that gltfio is composed of two libraries: the core library (no
filamat) and the full library. This adds to the size of the full library
but leaves the core library as is.

* Fix various Windows build issues.
2019-05-03 09:49:04 -07:00
Philip Rideout
57fffab7b6 Improve SurfaceOrientation robustness when using UVs. (#1161)
Fix #1158
2019-05-03 08:18:13 -07:00
Romain Guy
97850c62c7 Cleanup of filamat (#1157)
* Cleanup of filamat

* Add missing include
2019-04-30 16:39:22 -07:00
Philip Rideout
b9879cf23b Repair Vulkan: addBlob should return an index. (#1156) 2019-04-30 14:08:39 -07:00
Romain Guy
f6767b59f5 Remove use after moves (#1155)
* Remove use after moves

* Remove unnecessary dependency
2019-04-30 13:18:49 -07:00
Philip Rideout
59f1fb8956 gltfio: fix file path bug. (#1151)
The cgltf "base path" that gets passed to cgltf_load_buffers should
actually be the path to original glTF file, otherwise bin filepaths
are resolved incorrectly.
2019-04-29 22:42:17 -07:00
Mathias Agopian
a781fb6f2b support compilers that don't have attribute(packed)
this fixes #1140
2019-04-24 22:08:14 -07:00
Philip Rideout
7cf121b5c2 Fix intermittent JavaScript bug in gltfio. (#1132)
* gltfio + web: do not call loadResource twice.

* Fix intermittent JavaScript bug in gltfio.
2019-04-23 11:30:22 -07:00
Philip Rideout
657473ae2e gltfio: remove alpha cutoff from MaterialKey. (#1127)
Harmless cleanup. The cutoff value is a uniform and therefore does not
need to be a part of the material configuration structure.
2019-04-22 16:06:36 -07:00