Commit Graph

964 Commits

Author SHA1 Message Date
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
Philip Rideout
e56ff75e1b Fix WebGL continuous builds. 2019-02-25 12:31:36 -08:00
Philip Rideout
147dafb4c1 Fix webgl on kokoro. 2019-02-25 12:02:47 -08:00
Ben Doherty
5f6f026648 Correct typo in Windows readme for Android
Fixes #882
2019-02-25 11:19:11 -08:00
Romain Guy
fdee8e2e5c Add missing call to surfaceChanged()
Fixes #842
2019-02-23 22:34:43 -08:00
Philip Rideout
e9430dd07f Do not use CMAKE_SOURCE_DIR.
This is one of those CMake gotchas, we should always use
CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to allow
Filament to exist as a subproject.

In particular, this was causing the following build error when trying to
build Filament as a nested project.

    combine-static-libs.sh: No such file or directory

Fixes #861.
2019-02-22 15:38:52 -08:00
Ben Doherty
538243295c Add TextureReshaper (#862) 2019-02-22 12:34:29 -08:00
Ben Doherty
fa3f34ea4b Update iOS samples README (#857) 2019-02-22 09:14:22 -08:00
Ben Doherty
3faef1f9cb Complete the MaterialBuilder JNI (#845) 2019-02-21 14:53:32 -08:00
Ben Doherty
d0bab0fa8a Add hello-pbr iOS demo (#851) 2019-02-21 12:57:29 -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
Ben Doherty
803c922ac1 Fix, can't set material parameters on default material instance (#854) 2019-02-21 10:30:01 -08:00
Ben Doherty
cc637870b6 Fix Vulkan swapchain size on Windows (#852) 2019-02-20 17:25:29 -08:00
Ben Doherty
5c57a18b35 Initialize MaterialBuilder in samples (#850) 2019-02-20 14:47:29 -08:00
Philip Rideout
d538e71959 Repair gltf_viewer by calling Material::init. 2019-02-20 14:39:30 -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
Philip Rideout
84eb9547f5 Tangent-related fixups in MeshAssimp.
Assimp's CalcTangentSpace deviates from de facto glTF 2.0 so we were
compensating for this with an unconditional fixup in MeshAssimp. However
the fixup should apply only when CalcTangentSpace is active, i.e. when
the model is missing tangents.

This makes it so that NormalTangentMirrorTest (has tangents) and
NormalTangentTest (needs tangents) both look reasonable.

I also noticed that MeshAssimp was inexplicably applying
aiProcess_CalcTangentSpace twice: once as a flag, and once as a
post-process. I removed the latter.

This will be fixed in the upcoming cgltf-based loader, which will
use our officially-sanctioned utility method in VertexBuffer.

See #528
2019-02-20 13:29:44 -08:00
Mathias Agopian
9b5060bb1d improve bindBufferRange() state tracking
we never rely (or should rely) on the fact that glBinderBufferRange()
also sets the generic binding, so we don't need to check for that when
calling glBindBufferRange().

This helps a little bit reducing the numbers of GL calls, especially
when several consecutive draw calls use the same material instance.
2019-02-20 12:34:45 -08:00
Ben Doherty
d22e2f2834 Fix wrong init method being called (#846) 2019-02-20 11:05:55 -08:00
Ben Doherty
52ebfb1665 Add Init and Shutdown methods to MaterialBuilder (#840) 2019-02-20 10:44:12 -08:00
Adrian Perez
07eda48196 Missing include 2019-02-20 09:41:18 -08:00
Romain Guy
b2f19a1879 Remove incorrect approximations 2019-02-19 18:41:31 -08:00
Mathias Agopian
39b9d30d1a Minor RenderStream cleanups 2019-02-19 18:31:43 -08:00
Mathias Agopian
45beccc68b Fix build when DEBUG_RENDER_STREAM is enabled 2019-02-19 18:31:43 -08:00
Mathias Agopian
45e7580dc6 rename synchronous driver calls
synchronous driver calls are split in 2 calls, respectively:
fooS() and fooR() instead of fooSynchronous() and foo().

This is a tiny step towards decoupling drivers from the
renderstream, which is a pipedream of mine.
2019-02-19 18:31:43 -08:00
Romain Guy
6f9df5bfab Update incorrect equations of importance sampling 2019-02-19 17:59:39 -08:00
Philip Rideout
91ce2f412b Bump MATERIAL_VERSION. 2019-02-19 15:54:58 -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
Ben Doherty
de4abe3295 Replace MoltenVK with Metal for iOS sample (#825) 2019-02-19 12:25:24 -08:00
Philip Rideout
b6ccdc0529 Update stb and add tnt/README.
Fixes #832.
2019-02-19 12:18:29 -08:00
Mathias Agopian
28c8f6818e glGenerateMipmap honors base/max level sceneform-1.7pr6 2019-02-15 17:12:56 -08:00
Mathias Agopian
8f42e1a812 fix linux debug build
It looks like out static libc++abi that we use on linux needs
pthread, even if the exe doesn't use it. 
Adding libutils to this test fixes the build on my local linux machine.

The real fix is probably something else, bug I don't quite
understand these shenanigans.
2019-02-15 16:47:28 -08:00
Mathias Agopian
803229bcdc fix another out-of-bounds access 2019-02-15 16:39:48 -08:00
Mathias Agopian
c64dae95fa set textures max level properly
the texture's max level wasn't set properly when uploading
data for level 0 (it was for other levels).

this would cause uninitialized levels to be accessed by the GPU.
2019-02-15 16:19:22 -08:00
Philip Rideout
630b14d273 DriverAPI: add generateMipmaps and canGenerateMipmaps.
Fixes #808.  See also comments in #749.
2019-02-15 16:16:20 -08:00
Ben Doherty
08a71bf2f0 Install requirements for linking against filameshio (#818) 2019-02-15 12:08:28 -08:00
Ben Doherty
2e917fc8d0 Build all run-time variants on Windows for CI release and continuous (#816) 2019-02-15 12:08:08 -08:00
Philip Rideout
26ce90483a MeshAssimp: fix glTF material hash function.
I noticed this while working on the new lighter weight loader.
2019-02-15 10:32:33 -08:00
Romain Guy
5b7ad2511e Rename specularIrradiance function in shaders 2019-02-15 10:10:55 +00:00
Romain Guy
42acac02c0 Update documentation
Add titles and use energy preservation vs conservation to describe
two different concepts.
2019-02-15 09:26:52 +00:00
Ben Doherty
d0247f7867 Fix build errors in Metal driver (#823) 2019-02-14 21:31:05 -08:00
Philip Rideout
529f65d63c Introduce addEntities method to Scene.
This is an efficient method that allows clients to add a slew of
entities to the scene. This is particularly useful for the upcoming
gltfio library, which is agnostic of the Scene and exposes a flat
list of entities.
2019-02-14 20:55:21 -08:00
Philip Rideout
3b373e5d05 Fix nans in math::slerp. 2019-02-14 20:54:56 -08:00
Mathias Agopian
6fbecef857 fix out-of-bound access 2019-02-14 18:10:46 -08:00
Mathias Agopian
e98b413eb5 don't default initialize driver::Viewport/RenderPassFlags
instead we initialize them to zero in RenderPassParams.
2019-02-14 18:08:40 -08:00
Mathias Agopian
147e4d2189 Flags must be zero by default 2019-02-14 18:08:40 -08:00
Mathias Agopian
26468d9532 Split RenderPassParams into multiple structs
We split out Viewport and RenderPassFlags.
2019-02-14 18:08:40 -08:00
Mathias Agopian
6bcceefb04 always use the static version of libc++abi
This is make it a lot easier to distributes binaries like cmgen or
matc.
2019-02-14 18:05:54 -08:00
Mathias Agopian
8a850ff908 improve readme for building on linux 2019-02-14 18:05:12 -08:00
Ben Doherty
7099682204 Metal driver implementation (#795) 2019-02-14 16:04:28 -08:00