Commit Graph

49 Commits

Author SHA1 Message Date
Alexey Pelykh
45054eece9 gltfio: support material extras 2022-01-25 10:04:10 -08:00
Ben Doherty
00d9c6921d Add initial glossy screen-space reflections (#4946) 2022-01-12 13:59:11 -08:00
Romain Guy
b2fef7988e Use twoPassesTwoSides when doubleSided is true in gltfio (#4635)
This should help Filament properly support more glTF assets with
transparency, and should make Filament behave more like other
renderers such as three.js.
2021-09-17 14:52:47 -07:00
Philip Rideout
6b249bde4b Enable debug info in materials in debug builds.
This lets you see highly readable GLSL when transpiling the generated
SPIRV back to GLSL, with the original variable names preserved.

For now this is only useful when using `matinfo`, but it will soon be
useful in `matdbg` too.
2021-07-16 10:32:42 -07:00
Romain Guy
4f28734042 Add support for KHR_materials_volume (#4291)
* Add support for KHR_materials_volume

* Add ubershader support for KHR_materials_volume

* Update readmes

* User highp on anything that affects UVs

* Add missing precision qualifiers

* Fix transmission
2021-07-09 20:50:27 -07:00
Philip Rideout
4289c03ce5 gltfio: fix precision in KHR_texture_transform (#4290)
* gltfio: fix precision in KHR_texture_transform

Fixes #4253.

* Update to the new order of parameters

Co-authored-by: Romain Guy <romainguy@curious-creature.com>
2021-07-09 17:55:10 -07:00
Philip Rideout
eb0c346969 gltfio: remove hacky RTTI from MaterialProvider.
We want anybody to write their own class that descends from
MaterialProvider, so it doesn't make sense to have an enum of
concrete types.
2021-06-24 15:24:13 -07:00
Romain Guy
94ff2ea6b1 Add support for KHR_materials_specular to glTF (#4046)
* Add support for KHR_materials_specular to glTF

* Add support for IOR to ubershaders

* Update release notes

* Remove unused variable, fix comment
2021-05-27 17:33:24 -07:00
Romain Guy
4567b01c1d Multi-thread shaders generation when compiling materials (#3464)
* Stop using members as globals between methods

* Multi-thread shaders generation with JobSystem

* Pass JobSystem to MaterialBuilder::build()

* Fix MeshAssimp to use the new API

* Allow the Java API to pass a job system via Engine

* Update docs

* Apply suggestions from code review

Co-authored-by: Philip Rideout <philiprideout@gmail.com>
2021-01-29 09:30:37 -08:00
Philip Rideout
cec5f3e988 gltfio: disable shader optimizations by default
Note that ubershaders (which are always used on Android and WebGL) are
still optimized by default.
2021-01-27 11:40:51 -08:00
Romain Guy
eb70fd5dee Sample the proper channel for sheenRoughness 2020-12-12 18:05:02 -08:00
Romain Guy
2895530e09 Add support for sheenColor and sheenRoughness (#3358)
* Add support for sheenColor and sheenRoughness

This work is necessary to support the glTF extension KHR_materials_sheen.
This change effectively adds the specular lobe from the cloth material
model to the base material model. The cloth model remains useful for
its extra subsurface color feature but also because it's cheaper.

* Add support for KHR_materials_sheen to gltfio

* Update documentation

* Document default shading values
2020-12-12 11:07:40 -08:00
Romain Guy
9830925a96 Disable clear coat layer IOR change in glTF files (#3104)
The glTF spec doesn't call for this and there are extensions
to deal with this manually.
2020-09-21 20:40:35 -07:00
Philip Rideout
3ca0a8cd8d Transmission should use FADE. (#2908)
Fixed #2907.
2020-08-03 10:51:26 -07:00
Philip Rideout
2c18d7f576 Revert "Transmission should use FADE."
This reverts commit 379f92417f.
2020-08-03 10:45:46 -07:00
Philip Rideout
379f92417f Transmission should use FADE.
Fixed #2907
2020-08-03 10:44:15 -07:00
Philip Rideout
8f3f30e9cd gltfio: fix depth writes for transmissive materials.
This fixes the depth fighting in the column of red spheres in the test
model while in filamat mode. Thanks Romain for catching this.

It also makes filamat mode more consistent with ubershader mode.
2020-07-29 11:55:21 -07:00
Philip Rideout
3862b44ef4 gltfio: Add support for KHR_materials_transmission.
This chooses type=THIN, mode=SCREENSPACE, and blending=TRANSPARENT.

Due to sampler overload, we print a friendly error message and enable a
fallback if the user tries to simultaneously enable ubershader mode, the
clearcoat extension, and the transmission extension.
2020-07-22 08:40:55 -07:00
Pixelflinger
710f83dcf5 Enable specular anti-aliasing in gltfio 2020-07-19 22:14:51 -07:00
Philip Rideout
5c64ed5125 gltfio: use highp for UV coords.
Fixes #2500.
2020-06-17 17:27:53 -07:00
Philip Rideout
adccf9f432 gltfio: remove details namespace 2020-06-01 09:19:18 -07:00
Philip Rideout
072d17d64f gltfio: use the new material name feature.
To see proof that this works, use gltf_viewer with -u and examine the
node hierarchy. You will now see the correct material names instead of
the ubershader names.
2020-05-08 11:24:38 -07:00
Romain Guy
038cecd8e2 Fix emissive 2020-04-17 18:46:16 -07:00
Romain Guy
ddef5ec3c4 Change how emissive works (#2415)
Emissive was previously defined in exposure compensation stops, which
was confusing to many. It is now a value in nits, with the alpha
channel controlling how much the camera exposure affects the emissive.
At 0, the emissive value is just added to the final pixel color, at
1 the emissive value is multiplied by the exposure just like with
regular lights.

The intensity of the emissive property can be computed from an
exposure value (EV) easily with the following formula:

emissive.rgb = emissive.rgb * pow(2.0, EV - 3.0);

This formula is available as Exposure::luminance(float) already
in Filament.
2020-04-17 17:42:21 -07:00
Romain Guy
bf0dc32ee3 Change specularAmbientOcclusion from boolean to enum (#2352)
The user can now choose amongst 3 specular AO methods:
- None, specAO is off
- Simple, specAO is inferred from roughness and diffuse AO
- Bent normals, specAO is computed accurately from cone intersections

The last method is more expensive but produces the best results.

This change also fixes a few issues:
- Rename materialRefraction() and materialRefractionType() for
  consistency
- Fixes user time in shaders
2020-04-07 09:19:48 -07:00
Romain Guy
4ec5fac95c Add support for KHR_materials_clearcoat to gltfio (#2169) 2020-02-26 10:11:34 -08:00
Philip Rideout
237e0ee367 Revert "Revert "gltfio: enable specular AO to "fix" #1870""
This reverts commit f9230856af.
2019-12-18 13:56:13 -08:00
Philip Rideout
f9230856af Revert "gltfio: enable specular AO to "fix" #1870"
This reverts commit 9bf9c3a439.
2019-12-18 13:17:52 -08:00
Philip Rideout
9bf9c3a439 gltfio: enable specular AO to "fix" #1870 2019-12-18 13:07:05 -08:00
Philip Rideout
88bcd133f2 filamat: add Backend-to-TargetApi utility. 2019-09-11 08:38:47 -07:00
Romain Guy
6f30ff31c8 Fix warnings 2019-08-23 11:55:06 -07:00
Ben Doherty
6ba20f29d4 Fix normal mapping with skinning or morphing in Metal (#1530) 2019-08-16 17:24:01 -07:00
prideout
485711f7c6 gltfio now uses FADE when the asset is BLEND.
Fixes #1461
2019-07-31 12:36:11 -07:00
Philip Rideout
1f72b3ac24 gltfio: improve robustness for missing attributes.
The bistro model has some UV-free primitives associated with textured
materials. This caused Filament to emit warnings like:

[entity=445, primitive @ 0] missing required attributes (0xb), declared=0x3

We now catch these in gltfio, which enables a friendlier warning so that
the artist can go make a fix:

Missing UV0 data in Bistro_Research_Exterior_Paris_Building_01_paris_building_01_bottom_4669
2019-06-12 11:22:18 -07:00
Philip Rideout
a900851abc gltfio: add optional diagnostic shading. 2019-06-03 17:30:56 -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
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
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
Philip Rideout
06850cf934 Add Engine::getBackend, fix gltf_viewer + Vulkan. 2019-03-14 10:55:08 -07:00
Philip Rideout
0102489748 gltfio: add UbershaderLoader, an implemention of MaterialProvider. 2019-03-12 15:29:17 -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
6e7c705c92 AssetLoader fixups after code review. 2019-03-01 08:36:27 -08:00
Philip Rideout
38facc9038 AssetLoader cleanup per code review. 2019-03-01 07:27:03 -08:00
Philip Rideout
c7848efd86 Introduce the gltfio library.
This is our new mobile-friendly and web-friendly library for loading
glTF assets. It is still a work in progress, but already capable of
loading many conformance models, including those with animation,
skinning, and a couple of extensions (nonlit and texture transforms).

Next week we will add a sample app demonstrating its usage.
2019-03-01 07:27:03 -08:00