Commit Graph
103 Commits
Author SHA1 Message Date
Romain Guy 14248621fe Workaround for a Mali driver bug (#1337)
Fixes #1320
2019-06-21 09:57:50 -07:00
Mathias Agopian d955e733bf remove RGBM support for skybox and ibl cubemap 2019-06-20 14:36:37 -07:00
Romain Guy 4fee4d8da2 Don't use clear coat roughness as base roughness if clear coat is 0 (#1323)
This change finds the max of the clear coat and base layer roughness
then lerps the base layer roughness according to the amount of clear
coat.
2019-06-19 15:22:09 -07:00
Romain GuyandBen Doherty b1242163f7 Make CMake 3.10 the minimum version, add LTO option (#1316)
* Make CMake 3.10 the minimum version, add LTO option

* Install a newer CMake on Linux CI builds

* Update LLVM and Cmake on Windows CI

* Update build/windows/ci-common.bat

Co-Authored-By: Ben Doherty <benjdoherty15@gmail.com>

* Update formatting

* Apply suggestions from code review

* Update build/windows/ci-common.bat

* Update CMake

* Switch Android projects back to CMake 3.6
2019-06-19 12:53:03 -07:00
Romain Guy 33a8c9da7e Don't enable specularAO and multiBounceAO by default on mobile (#1319) 2019-06-19 11:04:40 -07:00
Pixelflinger 37facf7f7b fix build breakage on OpenGL ES targets 2019-06-19 01:25:37 -07:00
Mathias Agopian 1d20973363 IBL cubemaps can now be any size.
⚠️ breaks materials

There used to be a constraint that ibl cubemap needed to be
256x256. This constraint is now relaxed. IBL cubemaps can be any size.

We also add 16 float4 of padding to the frameUniform, which brings
its size to 1 KiB, the idea is to prevent more breakages in the
future.
2019-06-18 18:39:06 -07:00
Romain Guy 7fadc438ec Add Filmic ALU tone mapping operator (#1286)
This change also cleans up tone mapping and transfer functions by
getting rid of unused code paths
2019-06-11 12:15:44 -07:00
Romain Guy f441e4ec4e Switch desktop to interleaved RGB noise (#1263)
This eliminates the flicker caused by triangle noise based dithering
when FXAA is turned on. This will require further investigation to
see if we can use triangle noise with FXAA without such artifacts.
2019-06-05 10:45:04 -07:00
Romain Guy 9d31b7c008 Formatting of shaders 2019-06-04 16:23:20 -07:00
Romain Guy 3ae91957be Reorder shader 2019-06-03 17:24:00 -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
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
Romain Guy 3d39f64c0d Move comment 2019-05-20 14:56:00 -07:00
Romain Guy 60bc860e76 Move IOR code to common_lighting 2019-05-20 14:54:44 -07:00
Romain Guy 2377287890 Fix curvatureToRoughnes 2019-05-20 14:50:44 -07:00
Romain Guy cabdc255f5 Shader code cleanup
roughness is now called perceptualRoughness and linearRoughness
is now called roughness. It better matches papers, etc.
2019-05-20 14:45:26 -07:00
Romain Guy 0347fb0441 Add new material properties: specular/multiBounceAmbientOcclusion (#1198) 2019-05-18 14:30:08 -07:00
Romain Guy f0aab6e46a Add micro-shadowing feature (#1188)
* Add micro-shadowing based on ambient occlusion

* Prevent crash when IBL is turned off

* Apply micro-shadows to baked AO only

* Remove debug code

* Add opacity control

* Fix opacity term

* Switch to micro-shadowing from Chan 2018
2019-05-16 12:24:16 -07:00
Romain Guy bdd3e343ba Add multi-bounce AO based on GTAO (#1180) 2019-05-14 08:58:49 -07:00
Mathias Agopian 062ec48ee6 Implement basic SSAO 2019-05-07 18:35:19 -07:00
Ben Doherty 1b41a73eb0 Fix incorrect depth comparisons with floating point depth formats (#1129) 2019-04-23 18:10:47 -07:00
Pixelflinger af7c3784d6 add support for polygon offset in shadow map parameters
Also use new default bias parameters that seem to work better with
more scenes.

Renamed SAMPLING_HARD to SAMPLING_PCF_HARD because the GPU still
performs 4-taps PCF.
2019-04-15 18:53:41 -07:00
Romain Guy 4349de5614 Better clamping for dot(N, V) (#1106)
* Better clamping for dot(N, V)

The previous clamping used abs(NoV) + EPS which could be much higher
than needed when NoV < -EPS.

* Move clampNoV()
2019-04-15 18:21:58 -07:00
Mathias Agopian 072c5ffd78 improve code readibility 2019-04-14 14:15:49 -07:00
Mathias Agopian ad62b1e4ed Bake the constant bias into the shadow-map
The constant bias can be baked in the shadow map,
which saves some cycles in the vertex shader.
2019-04-13 11:01:02 -07:00
Mathias Agopian 16374cb11e Fix the calculation of the shadow constant bias
The previous code worked only for directional lights and didn't handle
LISPSM correctly (the bias was scaled down).
We now apply the bias in world space, which works with all configurations.

Additionally the bias was always wrongly scaled by 2x.

The cost is 3 multiply-add.
2019-04-13 11:01:02 -07:00
Pixelflinger f6480921c0 don't approximate sin(x) by sin(x)^2
This is optimization is not worth it in the 
vertex shader, and the error is quite large
for some angles, resulting in harder to control
acne.
2019-04-13 11:01:02 -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
Romain Guy 724e9abf96 Tweak specularGlossiness 2019-04-09 13:45:07 -07:00
Philip Rideout 37cb9247fd Add new shading model to Filament for specularGlossiness. (#1083)
* Add new shading model to Filament for specularGlossiness.

This adds a shading model based on KHR_materials_pbrSpecularGlossiness.
The corollary gltfio change will be in an upcoming PR.

* Improve documentation for specular-glossiness
2019-04-09 13:22:16 -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 ab12d1d1bb Add postLightingColor property to materials (#1057)
* Add postLightingColor property to materials

This property can be used to modify the color computed in the lighting
passes of the materials. That color is blended with the computed color
according to the postLightingBlending option (add, transparent or opaque).

* Remove test

* Update docs

* Address code review comment

* Switch postLightingColor default blend mode to transparent
2019-03-29 10:02:07 -07:00
Philip Rideout 01e8154bc8 Rename CodeGenTargetApi to TargetLanguage.
This is just a cleanup and does not change any behavior. The old code
was a little strange because we'd generate code designed for OpenGL but
we'd pass VULKAN to the code generator. This was a little white lie that
really meant: "I will need SPIRV (for optimization purposes only)"
2019-03-27 10:17:02 -07:00
Mathias Agopian 07bb62490b Add an option to turn dithering on/off 2019-03-12 13:32:28 -07:00
Ben Doherty 1aa4eff190 Fix post processing issue for Metal (#906) 2019-03-01 12:46:53 -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
Pixelflinger 8a6de4cff1 Fix fxaa offset (#868)
vertex shader interpolants are interpolated at pixel centers by the GPU,
but we were doing our own "pixel-center" adjustment, so we ended-up with
"vertex_uv" at a pixel corner instead of center.

with this change, the vertex shader always compute vertex_uv in
fractional texels and the conversion to texture coordinates is done
in the fxaa code.

The half-pixel adjustment is removed.

This leads to sharper looking images because in addition to shifting
everything by 0.5 pixels, this was essentially applying a box-filter
to the whole picture -- kind of like taking 1 mip level down.
2019-02-25 13:22:14 -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
Romain Guy 5b7ad2511e Rename specularIrradiance function in shaders 2019-02-15 10:10:55 +00:00
Ben Doherty 7099682204 Metal driver implementation (#795) 2019-02-14 16:04:28 -08:00
Romain Guy 4327612159 Remove unnecessary function parameter
Our visibility terms don't make use of roughness, only of
roughness^2. This change simplifies the shaders, which will
help for specular AA.
2019-02-06 10:14:05 +09:00
Ben Doherty a827f4528a Install filamat and dependencies as single static library (#775) 2019-02-04 11:08:45 -08:00
Philip Rideout 69de626ead Rename built-in shader inputs to "inputs" instead of "variables".
In the public docs and materials API, Filament "variables" are custom
interpolants (outputs of VS, inputs of FS). However we internally used
"variables" to also refer to built-in VS inputs.

CodeGenerator had a generateVariable method and a generateVariables
method, which did something completely different. :)
2019-02-01 13:20:13 -08:00
Philip Rideout c3d957671d Work around FXAA issue with Vulkan Adreno drivers.
Fixes #732.
2019-01-24 11:48:02 -08:00
prideout 91c946cfbd Add workaround for depth invariance on NVIDIA.
Fixes #645.
2019-01-18 13:59:22 -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
Romain Guy 8029ad5cc3 Add missing getWorldFromClip() API (#692)
Fixes #671
2019-01-10 16:35:00 -08:00
Ben Doherty 045274bbdb Use glslminifier to minifiy shaders for Release builds (#690) 2019-01-10 10:23:23 -08:00
shartte cd2786a2ef Fixes #653: Skin normals/tangents before applying world space transform (#656) 2018-12-24 08:50:29 +01:00