Commit Graph

173 Commits

Author SHA1 Message Date
Romain Guy
f02fe33070 Reformat comments 2019-03-07 14:53:33 -08:00
sebavan
906097625e Add Charlie importance sampling to cmgen.exe (#936) 2019-03-06 15:43:07 -08:00
Mathias Agopian
4abe017bc5 cleanup MaterialChunkType.h 2019-03-05 17:54:37 -08:00
Mathias Agopian
0f6f53d501 MaterialChunk doesn't expose the Unflattener in its API
this makes the API more robust, because now it's not possible
to mess up the call to getShader(), by construction.
2019-03-05 17:54:37 -08:00
Mathias Agopian
084fd95489 Factorize all the various getShader() methods
This removes a lot of code and complexity. MaterialParser now has 
a single, generic getShader() method.
2019-03-05 17:54:37 -08:00
Mathias Agopian
ff53515295 Merge [Spirv|Text]DictionaryReadder into DictionaryReader 2019-03-05 17:54:37 -08:00
Mathias Agopian
f2ba48f4a7 Program::shader() now only takes a void* + size
Program::shader() was taking a string before which didn't make sense
for spirv.  Now it's just a blob, in the case of GL/Metal, the blob
must be a null terminated c-string, and the size must include the
terminating null character.

This fixes an out-of-bound access in ShaderBuilder::getShader() (which
doesn't exist anymore), because it was creating a CString passing
a size that included the null terminating char, which is not was CString
expects. CString can now assert() in that case.


driver::Program now uses a std::vector<> for storage, which we should
fix at some point (b/c it's a public header). CString was not suited to
store binary blobs.
2019-03-04 19:00:26 -08:00
Romain Guy
9558f0d6ca Use uniform sampling for cloth DFG (#921) 2019-03-02 14:10:38 -08:00
Mathias Agopian
3297c9bc78 More headers clean-up
- EngineEnums.h is not a private headers as it contained mostly private
stuff

- MaterialEnums.h is still public, but now only contains public stuff.
Private parts were moved to MaterialEnums.h or MaterialBuilder.h

- And finally SamplerBinderMap is moved under private/ as well, since
it's certainly not a public API.

With this change, the public headers of filabridge become more reasonable
and limited.
2019-03-02 00:21:09 -08:00
Mathias Agopian
71762cf55e remove dependency on [Sampler|Uniform]InterfaceBlock.h
it just wasn't needed.
2019-03-01 08:43:01 -08:00
Mathias Agopian
a6a4055a0a don't fully qualify filament namespaces 2019-03-01 08:43:01 -08:00
Mathias Agopian
8d484dd762 break dependency of filaflat on filabridge
filaflat only had on header dependency on filabridge (DriverEnums.h)
and only needed two small enum types.
In fact, I don't think it was right for filaflat to assume any 
particular value for these fields -- this is the responsibility of the
callers.
2019-03-01 08:43:01 -08:00
Mathias Agopian
42875b7809 break dependency of matinfo on MaterialParser 2019-02-28 12:29:56 -08:00
Mathias Agopian
16cef02441 break Unflattener dependency on ChunkCountainer.h 2019-02-28 12:29:56 -08:00
Mathias Agopian
d07222fc3c cleanup: break dependency filamat->filaflat dependency 2019-02-28 12:29:56 -08:00
Mathias Agopian
0dd8414844 minor cleanup, try to remove some uneeded dependencies
this is in praparation for much larger changes
2019-02-28 12:29:56 -08:00
Romain Guy
705c1969b2 Add clearCoatIorChange property to materials (#890)
This property can be used to control the darkening of the base layer
due to a change in index of refraction when going through the clear
coat layer.
2019-02-27 10:30:46 -08:00
Romain Guy
4738e93b83 Replace Cloth DFG approximation with DFG LUT
By removing the Fresnel term (often ommitted from fabric/cloth BRDFs)
we can store the DG term for the cloth BRDF in the 3rd channel of the
existing DFG LUT.
2019-02-21 11:44:52 -08:00
Mathias Agopian
c1c84f6400 minor code and comments cleanups in dfg computations
also added uniform hemisphere sampling function for reference.
2019-02-20 13:52:57 -08:00
Ben Doherty
52ebfb1665 Add Init and Shutdown methods to MaterialBuilder (#840) 2019-02-20 10:44:12 -08:00
Romain Guy
b2f19a1879 Remove incorrect approximations 2019-02-19 18:41:31 -08:00
Philip Rideout
e60744a6e4 Introduce MATERIAL_VERSION and panic.
Material archives already contain two version chunks (post process and
normal) but the renderer was ignoring these. The change makes it so that
matc writes a new MaterialEnums value into these chunks, and the engine
panics when receiving a material version that it does not expect.

This also adds a --version option to matc. No changes were necessary
to matinfo because it already prints out these values.

Fixes #796.
2019-02-19 15:54:58 -08:00
prideout
5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
Adrian Perez
694d5a397e Typo fixes 2019-02-01 11:26:58 -08:00
Ben Doherty
7be3994c96 Add Metal shading language compilation to matc (#752) 2019-01-29 12:44:58 -07:00
Tim van Scherpenzeel
44bfac85e9 added quiet flag 2019-01-29 11:04:58 -08:00
cubeleo
6956154d62 mipgen: Disambiguated string with std:: prefix. (#741) 2019-01-25 09:02:11 -08:00
Romain Guy
f3752a42c8 Document UV flipping behavior and add control attribute (#720)
Materials can disbale this behavior by setting flipUV: false
in the header section of the material definition.

Fixes #672
2019-01-17 11:12:16 -08:00
Philip Rideout
2f35f26148 VertexBuffer builder normalized now accepts "false". 2019-01-17 06:09:17 -08:00
Romain Guy
cebc83e8fa Fix the Android filamesh file loader (#709)
* Fix the Android filamesh file loader

The loader was not updated to support the SNORM16 format now sometimes
used to encode UV sets in filamesh files.

Fixes #708

* Update android/samples/image-based-lighting/app/src/main/java/com/google/android/filament/ibl/MeshLoader.kt
2019-01-15 16:11:34 -08:00
Romain Guy
f8ebc047e0 Fix the build 2019-01-14 15:31:17 -08:00
Romain Guy
00f6fa24f7 Code cleanup 2019-01-14 14:57:23 -08:00
Romain Guy
0394aeb23b Add specular anti-aliasing properties to materials (#697)
* Add specular anti-aliasing properties to materials

curvatureToRoughness
limitOverInterpolation

These techiques were supposed to be enabled by default on
desktop but it turns out they were broken. They must now
be enabled manually on each material instead (and work on
mobile).

* Update docs/Materials.md.html
2019-01-14 12:25:51 -08:00
Philip Rideout
f876171239 filamesh tool now generates dummy UV's if necessary.
filamesh requires UV's but some glTF test models, like CesiumMilkTruck,
do not provide UV's on nonlit parts (e.g. the truck windows). This makes
it so that these assets can be converted to filamesh somewhat more
gracefully.
2019-01-10 10:27:29 +05:30
Ben Doherty
60d304a83b Add glslminifier tool (#683) 2019-01-09 10:59:39 -08:00
Philip Rideout
422bf8631b Small assimp fixups for glTF => filamesh conversion.
This fixes some crashes when trying to convert CesiumMilkTruck.
2019-01-09 07:57:41 +05:30
Romain Guy
9ce88e6e23 Improve skygen (#679)
Bring back the normalization and gamma correction command line flags,
render the ground in the lower half of the image.
2019-01-08 07:19:50 -08:00
Mathias Agopian
d6de2bf426 get rid of JobSystem::reset()
It was only used to clear the master job, instead the master job is
cleared when waited on.
2018-12-14 14:48:33 -08:00
Romain Guy
d135108763 Add mipgen.md to install directory 2018-12-12 09:09:01 -08:00
Romain Guy
a38c40cf11 Turn on shaders optimization by default (#614)
* Turn on shaders optimization by default

Release builds of Filament only work well with optimize shaders,
turning optimizations on by default will help avoid mismatches.

This change also adds -g to disable all optimizations, for debug
builds.

* Use -g on debug builds

* Use -g on debug builds

* Update tutorial_redball.md to remove matc's -O

* Update tutorial_suzanne.md to remove matc's -O

* Use -g in debug builds
2018-12-11 09:36:37 -08:00
Philip Rideout
8dda07bf2c mipgen: support generation of 4-band KTX files
This is useful because our Vulkan backend currently does not accept
3-band texture data. (although we intend to fix that soon)
2018-12-10 18:04:52 -08:00
Romain Guy
e41dd027ab Enable optimization passes on materials with external samplers (#605)
* Enable optimization passes on materials with external samplers

Because external samplers are not properly supported by SPIRV and
associated library (spirv-cross and spirv-tools) we currently disable
all optimizations when we encounter a material with external samplers.

This however causes issues on some misbehaved drivers (not running
the optimizations has a side effect which causes a crash). To enable
the optimization pass we simply rely on the Vulkan codegen target to
substitute samplerExternal with sampler2D. We then analyze the output
GLSL (post-optimization) and revert the relevants sampler2D declarations
to samplerExternal declarations.

This fixup only occurs after optimization and for mobile targets and
if external samplers were declared.

* Address review comments
2018-12-10 12:02:59 -08:00
magicwhale
2633edf2c4 Changed MeshAssimp to use snorm16 if uv values are in the range [-1, 1] (#592)
* grouped MeshAssimp arguments into struct

* added snormuv optimization to MeshAssimp and changed snormuv optimization range from [0, 1] to [-1, 1] in filamesh
2018-12-07 13:03:18 -08:00
Philip Rideout
6f601e6021 Update KTX files and allow glFormat = LUMINANCE 2018-12-06 10:33:49 -08:00
Sebastian Hartte
aaf2909194 Correctly set glTypeSize in the tools, and use sized formats for internalFormat 2018-12-06 10:33:49 -08:00
Philip Rideout
beaf751604 filamesh: Compress attributes individually.
This further reduces compressed suzanne from 333489 bytes to 272761.

Tested with vk_hellopbr and tutorial_suzanne.html

Issue #558
2018-12-05 17:15:52 -08:00
Philip Rideout
6c55b3b989 filamesh: Add support for COMPRESSION.
Note that the WebGL build uses filameshio, but Android does not. Our
Android samples therefore do not yet understand the compressed format.
For web, I measured the before / after:

```
BEFORE: filament.wasm = 505796, suzanne.filamesh = 521476
 AFTER: filament.wasm = 510915, suzanne.filamesh = 333489
```

Issue #558
2018-12-05 13:20:55 -08:00
Philip Rideout
b4b12914a1 Add bitcast to utils. 2018-12-04 17:56:37 -08:00
Philip Rideout
ff2da6e3b4 Add zeux/meshoptimizer to third_party.
This also adds it as a dependency to filameshio. This does not seem to
increase the size of the WebGL build even though filameshio is a
dependency, perhaps because we are not using it yet.
2018-12-04 16:36:56 -08:00
Philip Rideout
a7d6af8d22 filamesh: Add support for TEXCOORD_SNORM16. 2018-12-03 14:18:12 -08:00