Commit Graph
54 Commits
Author SHA1 Message Date
Philip Rideout fdfb8862eb gltf_baker: allow tmin adjustment. 2019-06-03 13:03:14 -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
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 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
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
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
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
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 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
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
Philip Rideout c6e2086e67 gltfio: add JavaScript bindings. (#1092) 2019-04-11 20:05:32 -07:00
Philip Rideout 77237fd3fa Rename specular-glossiness parameters to their canonical names. (#1086)
* Rename specular-glossiness parameters to their canonical names.

* Remove roughness from MaterialInputs for specular-glossiness.
2019-04-10 07:10:27 -07:00
Philip Rideout 3629a8154c gltfio: support specular-glossiness (#1084)
Fixes #1068
2019-04-09 13:36:47 -07:00
Philip Rideout bd20d005ce gltfio: split out a core library for WebGL and Android (#1080) 2019-04-08 12:43:30 -07:00
Philip Rideout dcc17b9b7e Allow dynamic doubleSided and materialThreshold. (#1072)
* MaterialInstance now has setMaskThreshold for convenience.

* Materials now support dynamic doubleSided property.

This does not change the format of material packages because they
already have both getDoubleSided() and getDoubleSidedSet().

The only way in which this change could impact existing applications is
that materials that explicity set doubleSided to "false" will now
respect the material's culling mode, rather than forcing it to NONE.

Fixes gltf_viewer with littlest_tokyo in ubershader mode.

Fixes #963.

* JNI for dynamic material properties.

* Add underscore prefix to internal material params.

* Remove un-needed mat info field.
2019-04-08 11:43:01 -07:00
Philip Rideout 10251821c6 filagui: Introduce widget for manipulating vectors.
This is our first ImGui extension, it draws a draggable 3D arrow for
manipulating a unit vector. This is especially useful for tweaking the
light direction.
2019-04-04 10:59:38 -07:00
Philip Rideout ccc9606ffc gltfio: allow folder paths and disable auto-scale 2019-04-03 10:18:05 -07:00
Romain Guy 7b87662db0 Don't flip the normals (#1060)
* Don't flip the normals

* Fix the ubershader as well
2019-04-01 12:04:27 -07:00
Mathias Agopian b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Romain Guy 7d31d1a384 Use LINEAR/LINEAR_MIPMAP_LINEAR as the default sampling methods (#1028)
If the glTF file defines bits of the sampler but not the min/mag filters,
gltfio otherwise uses NEAREST. And it looks bad.
2019-03-21 17:52:40 -07:00
Philip Rideout df9791faaf gltf_viewer: add stats and view controls. 2019-03-14 12:18:56 -07:00
Philip Rideout 06850cf934 Add Engine::getBackend, fix gltf_viewer + Vulkan. 2019-03-14 10:55:08 -07:00
Philip Rideout e3e7073f74 gltf_viewer: add support for drag-and-drop.
You can now drop gltf or glb files into the app.

Note that we will soon be migrating from SDL to GLFW, which also
has support for drag-and-drop.
2019-03-14 10:06:44 -07:00
Philip Rideout 7bc6b3c818 Replace gltf_viewer and introduce gltfio::SimpleViewer.
The new gltf_viewer app has an optional zero-arguments mode whereby it
loads a resgen-embedded binary model, which is useful for quick
sanity testing. If you don't specify an IBL, it loads a compressed
version of the pillars IBL.
2019-03-13 16:21:58 -07:00
Philip Rideout 0102489748 gltfio: add UbershaderLoader, an implemention of MaterialProvider. 2019-03-12 15:29:17 -07:00
Philip Rideout 39c63146e0 gltfio: add ubershader template.
We will need 6 pre-compiled materials (lit vs nonlit and the 3 blend
modes). This uses CMake's "configure_file" functionality to generate 6
mat files, then invokes matc on each one. They are then combined using
resgen.
2019-03-12 08:16:55 -07:00
Philip Rideout 8628c43fbf gltfio: material generator cleanup. 2019-03-10 15:11:58 -07:00
Philip Rideout af9b3a99e0 gltfio: introduce MaterialProvider interface.
This prepares for an alternate "sans filamat" implementation of
MaterialProvider, which will be especially useful for web.
2019-03-10 11:59:47 -07:00
Philip Rideout 7a2924738c gltfio: transparency fixups
- rename gltfio::AlphaMode to use glTF nomenclature
- keep depth writes enabled for transparent renderables
2019-03-09 18:58:04 -08:00
Philip Rideout c98ac44827 gltfio: fix UV set issue seen in littlest_tokyo 2019-03-08 11:31:22 -08:00
Philip Rideout b14759a0a4 gltfio: add wireframe functionality.
This makes it easy to draw a transformed box around each renderable for
diagnostic purposes. The API is similar to Animator in that it is
exposed through FilamentAsset but is created lazily and is implementated
outside of FilamentAsset.
2019-03-07 15:03:43 -08:00
Philip Rideout 1ccf2d6a08 gltfio: fix up and enhance AABB functionality.
gltfio computes two types of bounding boxes: one for renderables (used
for frustum culling) and one for the overall asset (used for
positioning the camera or asset).

Both of these are based on the min+max attributes in the glTF file, but
the asset-level box was incorrect because only two corners of the
transformed AABB were considered.

This CL also adds optional computation of bounding boxes that crawls
through the vertex positions. This is useful when diagnosing potential
issues with the asset's min+max info.

These enhancements are motivated by a culling issue seen with the voxel
Cathedral on sketchfab.
2019-03-07 14:11:21 -08:00
Philip Rideout 6c75c6436e Add support for glb files.
Tested with DamagedHelmet.glb
2019-03-02 00:02:40 -08:00