Commit Graph
109 Commits
Author SHA1 Message Date
Ben Doherty f4da2ef8ec Add support for spot light shadows (#2209) 2020-03-10 17:53:25 -07:00
Ben Doherty 3a2a40c76a Add additional shadow info to lights uniform (#2200) 2020-03-04 11:58:51 -08:00
Ben Doherty 6c3fa13e41 Changes to frameUniforms for spot shadows (#2201) 2020-03-04 11:58:31 -08:00
Ben Doherty 94b1ad52fa Add new Shadows uniform buffer (#2194) 2020-03-03 14:25:03 -08:00
Ben Doherty 62cef096e1 Refactor computeVisibilityMasks logic, visibility bits (#2179) 2020-02-27 16:28:47 -08:00
Benjamin Doherty 547f8917b4 Update comment 2020-02-26 15:58:16 -08:00
Benjamin Doherty 9e6ea9454f Refactor depth variant 2020-02-26 15:58:16 -08:00
Mathias Agopian 60b664d3b9 rework refraction filtering/blurring to improve performance
We now use a fixed-size kernel (right now 17), for each mip-level.
And we workout the mapping from roughness to such mip.

This improves performance by reducing significantly the number of taps
per mip, however, we don't control how much blur is actually applied
at each level. This gives a mip-chain that is proportional to
'roughness'.

It's now easier to tune quality vs. speed by tweaking the kernel's width
as well as how we map 'sigma' to a the kernel width.
2020-02-03 11:45:17 -08:00
Mathias Agopian f290742f1b Screen-space refraction
With this PR screen-space refraction is functional.

Caveats:

The blur passes for supporting rough refractive materials is quite
heavy and increases with the resolution.

SSR uses a gaussian approximation for the brdf and therefore doesn’t
match perfectly cubemap-based refraction and IBL.

The use of MSAA with screen-space effects, while working, is going
to incur a large cost, especially on tilers.
2020-01-29 10:17:08 -08:00
Mathias Agopian cc9a1d446c added the concept of micro thickness for thin objects
When dealing with thin objects we really have two thicknesses to 
consider, the thickness in the direction of the normal, which 
corresponds to the value used for solid objects, and the thickness of
the object's walls, which generally is a constant.

Reusing thickness in the later case is problematic for assets that have
a thickness map, but are rendered hollow.

In the future we can even imagine handling double-sided hollow objects
by using the thickness information -- e.g. a hollow cube.
2019-12-08 22:18:18 -08:00
Mathias Agopian cbb5d2b423 fix typos and rename refraction to refractionMode 2019-12-08 22:18:18 -08:00
Mathias Agopian 4790cb5009 Allow materials to override the IOR
Normally the IOR is deduced from the reflectance, but now we allow to
specify the IOR instead or in addition to the reflectance.
In the later case, it's possible to create physically impossible
materials, but this can be useful for artistic reasons.
2019-12-08 22:18:18 -08:00
Mathias Agopian f94aa731ed Add plumbing for refraction type (solid or thin) 2019-12-08 22:18:18 -08:00
Pixelflinger 0371a805ed basic refraction 2019-12-08 22:18:18 -08:00
Pixelflinger 57b48e0719 address reviewers comments
- get rid of "thin layer thickness" property
- make absorption a vec3
2019-12-08 22:18:18 -08:00
Mathias Agopian eb767abc55 Add material properties needed for refraction 2019-12-08 22:18:18 -08:00
Mathias Agopian 001a4c46db Added a property chunk to materials
Materials can now reflect which property is in use.
2019-12-03 17:51:44 -08:00
Philip Rideout 655b7dc13c Emit warning for too many morph targets.
Motivated by #1852.
2019-11-06 15:39:38 -08:00
Ben Doherty d849231caf Remove old post-process shader pipeline (#1631) 2019-09-13 09:29:28 -07:00
Ben Doherty 57e7280ac9 Remove post-process uniform / sampler blocks (#1624) 2019-09-11 16:57:48 -07:00
Ben Doherty fde23c89e2 Use post-process material domain for FXAA (#1621) 2019-09-11 09:35:40 -07:00
Philip Rideout 0bd9515b3d Add getWorldOffset() shader API, enhance docs.
This allows advanced shader authors like myself to get coordinates
in the API level world space.

Fixes #1485.
2019-08-09 08:28:28 -07:00
Philip Rideout 90c17ccbad Filament now supports GPU vertex morphing.
This works by aliasing CUSTOM0 - CUSTOM7 to morphing attributes, and by
extending our existing skinning variant.

This PR was tested against some upcoming changes to gltfio.

Issue #1149, #1417
2019-07-26 17:53:46 -04:00
Philip Rideout 90792e7032 Fix upper limit on vertex attributes.
This combines two constants into one, and changes it into a value that
is actually correct.  :)

Technically the movement of the CUSTOM attributes will change the layout
qualifier and therefore merits a materials version bump, however custom
attributes were only recently introduced so this seems unnecessary.

Did some quick testing with 3 samples: gltf_viewer, lucy_bloom, and
point_sprites.
2019-07-18 17:10:16 -07:00
Philip Rideout 5281f2a511 Enumerate all 8 custom vertex attribs. 2019-07-11 09:00:10 -07:00
Philip Rideout c2c546d671 Add support for custom vertex attributes.
This is a prep step for the upcoming morph feature and does not require
a bump to our material version number.

Stay tuned for a new sample app that demonstrates this feature.
2019-07-11 09:00:10 -07:00
Ben Doherty 725c978545 Remove yOffset uniform (#1382) 2019-07-10 15:30:00 -07:00
Ben Doherty fb16516480 Post-process materials: add post-process variant enum, split writeChunks function (#1365) 2019-07-01 12:57:41 -10:00
Mathias Agopian d955e733bf remove RGBM support for skybox and ibl cubemap 2019-06-20 14:36:37 -07:00
Ben Doherty cdb2b47e0f Add material domains boilerplate (#1305) 2019-06-20 08:53:36 -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 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
Mathias Agopian 062ec48ee6 Implement basic SSAO 2019-05-07 18:35:19 -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
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
Mathias Agopian 6374c9ab59 Expose the depth buffer to the postprocess pass 2019-04-01 10:57:32 -07:00
Philip Rideout c92700ce28 Simplification due to sampler bindings starting at 0. 2019-03-28 07:29:14 -07:00
Philip Rideout 7a106be627 MATERIAL BREAK: VulkanBinder now binds 2 descriptor sets at a time.
This allows us to start Vulkan sampler bindings at zero, similar
to uniforms. Further cleanup will be implemented in a subsequent pull
request.
2019-03-27 13:11:24 -07:00
Philip Rideout 0076de25fa Configurability fixups per code review. 2019-03-27 09:24:44 -07:00
Philip Rideout 5090fe6395 Allow configurable attribute and binding counts.
This fixes two issues related to the Vulkan backend, one being a build
issue and the other being a run-time issue:

(1) Compile-Time Issue

To prevent accidental introduction of padding into hashed structures,
the Vulkan backend was static-asserting the size of the hash input. I
think it's fine to simply use a pragma pack instead.

(2) Run-Time Issue

SibGenerator was erroneuously using BindingPoints::COUNT instead of
UNIFORM_BINDING_COUNT for determining the first sampler binding index.
(Hopefully this logic will go away after some upcoming Vulkan cleanup.)
Since SibGenerator does not include Program, this moves the uniform and
sampler counts into EngineEnums, which might be a good place anyway
since they are ideally "config" constants.
2019-03-27 09:24:44 -07:00
Mathias Agopian b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Mathias Agopian 639d05374b update layering: libbackend is now at the bottom
We now have:

backend -> filabridge -> filaflat -> filament
                      -> filamat

Instead of backend depending on filabridge.
2019-03-26 11:47:47 -07:00
Mathias Agopian 4bec201717 naming convention NUM_FOOS -> FOO_COUNT 2019-03-25 17:55:19 -07:00
Mathias Agopian 8ec3b62715 libbackend header cleanup
This is mostly about moving constant from EngineEnums.h to
the backend, either in Program.h or DriverEnums.h

The goal is that libbackend doesn't depend on EngineEnums.h
2019-03-25 17:55:19 -07:00
Mathias Agopian 1f183def46 move more public stuff out of Driver:: into DriverEnums.h
These data structures are part of the public API of libbackend.
2019-03-25 09:51:41 -07:00
Mathias Agopian 2b5f6cafa6 Separate src/driver into its own library
In this first step, we just "blindly" move everything under src/driver
to a new library libbackend.a. And all headers are moved under
private/backend.

Note that "driver" is renamed "backend", but namespaces are unchanged for now.

Later we'll have to untangle the actual private headers from public
ones and ideally not have any private headers.
2019-03-22 09:45:51 -07:00
Mathias Agopian 0ce6c8d8d0 rework scissor/viewport API a bit in the backend
- the IGNORE_VIEWPORT flag is gone. It wasn't actually needed and what
  it was doing was ambiguous.

- removed the backend viewport() API which wasn't actually needed.

- beginRenderPass() now ALWAYS sets the viewport and scissor but 
  doesn't necessarily clears honoring the scissor (based on the
  IGNORE_SCISSOR flag).

- the GLES backend now just sets the scissor when it needs it, as opposed
  to always trying to keep it set. we now rely on state tracking to
  de-dup the gl calls.
2019-03-20 11:37:21 -07:00
Romain Guy 2e22a26ca5 Fix filamat build (#1005)
Filamat public headers were including a private header. This PR fixes
this problem. It also forces filamat to always be compiled to avoid
breaking filamat without noticing. The flag `-l` is not available
anymore in build.sh as a result.
2019-03-18 18:40:48 -07:00