Commit Graph

755 Commits

Author SHA1 Message Date
Philip Rideout
55d0063ced Fix "no texture bound" warnings in WebGL. 2020-03-31 15:20:18 -07:00
Philip Rideout
e43466d2bc Enable Draco for WebGL and iOS. 2020-03-30 15:58:55 -07:00
Philip Rideout
abe70caeae Bump material version to prep for release. 2020-03-30 15:58:35 -07:00
Romain Guy
92b2dd835d Add support for bent normals (#2303)
* Add support for bent normals

Bent normals can be enabled via the bentNormal property of a material.
When specular occlusion is enabled, bent normals improve the quality
of the computation.

* Save a couple of multiplications in bent specular AO
2020-03-29 17:00:03 -07:00
Philip Rideout
a922e914b4 Enable Draco for Android. 2020-03-27 16:32:44 -07:00
Philip Rideout
241f08bd74 Draco: do not add files to the build root. 2020-03-27 13:59:41 -07:00
Ben Doherty
b8f8067a87 Support lights in gltfio (#2288) 2020-03-27 13:56:28 -07:00
Romain Guy
ffa62d4236 Check for CMake version before setting the policy 2020-03-27 11:50:21 -07:00
Romain Guy
40aad197da Fixes various issues (#2292)
* Fixes various issues

- Fix gltf_baker crash
- Fix Python3 discovery on macOS
- Fix TBB CMake warning
- Fix bent normals baking

* Find Python 3 on Windows
2020-03-26 22:53:44 -07:00
Kai Chieh Liu (KJ) 劉凱傑
124fd2c978 Fix NameComponentManager dependency and Android build (#2291) 2020-03-26 20:02:03 -07:00
Philip Rideout
0d32c58e41 gltfio: add support for Draco (desktop only)
This needs a bit more testing before merging, but I wanted to put up the
PR for review. I will look into supporting Android after we land this.

Fixes #1932.
2020-03-26 19:52:26 -07:00
Pixelflinger
cb356606d9 fog improvements
- handle heightFalloff=0 (i.e. fog doesn't depend on height) correctly,
  previously, a divide-by-zero on the cpu side would get in the way.
  The fix is to clamp heightFalloff to a small-enough value, and to
  make sure that this is handled correctly in the shader.

- default fog distance is 0 instead of 1m

- inScatteringSize parameter should be allowed to be large in samples
2020-03-26 16:01:56 -07:00
Kai Chieh Liu (KJ) 劉凱傑
4c23f7a436 Fix cmakelist to install subdir properly (#2283) 2020-03-25 18:20:24 -07:00
Pixelflinger
b4f5a4a0a0 Fog improvements
- optimized the fog computations
- fixed issues with the skybox
- added the option of getting the fog color modulated by the IBL envmap
2020-03-24 22:29:25 -07:00
Romain Guy
0b7de0ec65 Turn off contact shadows by default in gltf viewer (#2277) 2020-03-24 16:44:48 -07:00
Romain Guy
87ac282014 Export missing headers for NameComponentManager (#2276) 2020-03-24 16:32:48 -07:00
Romain Guy
8a84c7f0a3 Install all public headers from libutils 2020-03-24 15:46:23 -07:00
Romain Guy
45df197bd6 Expose libutils APIs that should have been public (#2269)
* Expose libutils APIs that should have been public

* Don't make JobSystem public for now
2020-03-24 09:57:04 -07:00
Philip Rideout
1ecb83bf73 gltfio: Big internal refactoring / simplification.
This replaces the "bindings" structures with simple types that re-use
data structures from cgltf.

This also moves some trivial work from ResourceLoader to AssetLoader,
which simplifies the communication between these two classes.

Motivated by #1932.
2020-03-24 09:22:20 -07:00
Pixelflinger
756074d8bd don't generate fog code in post-process materials 2020-03-23 15:04:42 -07:00
Pixelflinger
2caa09bebd Fix IBL mip calculation
The max mip (i.e. mip at roughness 1) was off by one.
2020-03-23 15:04:24 -07:00
Mathias Agopian
0c6d96c407 Add support for basic fog (#2256)
* Add support for basic fog

* address reviewers comments
2020-03-19 18:01:07 -07:00
Ben Doherty
7103f4f0b3 Share material dictionaries between GLSL / MSL (#2252) 2020-03-19 11:16:01 -07:00
Mathias Agopian
d54ceff7a3 Add support for screen-space contact shadows (#2245)
* Add support for screen-space contact shadows

This CL adds support and always enables it.
toggles and setting in the next CL (same PR).

* Plumb settings for screen-space contact shadows

screen-space contact shadows is handled like a shadow option,
parameters (including on/off) are set in the LightManager, using
the existing ShadowOptions API.

Additionally there is a per-renderable toggle.

Both toggles are off by default.

* Allow contact shadows when shadowing is auto-disabled


Shadowing can be auto-disabled when for instance there are no
shadow casters in the scene. We still allow contact shadows in
that case.

This would allow for instance, to make the vegetation on a terrain
not shadow-casting, and still get some shadowing there by using
contact shadows instead.

* apply micro-shadowing after contact shadows

also, don't compute contact shadows when we know we're fully shadowed.
2020-03-16 22:39:24 -07:00
Ben Doherty
acc36e8d9b Deprecating Clang on Windows in CMakeLists (#2243) 2020-03-13 12:33:02 -07:00
Pixelflinger
4a5ce16322 Trivially make LinearAllocator 16 bytes instead of 24 2020-03-11 17:04:08 -07:00
Pixelflinger
a9a9061f96 update GLSLPostProcessor optimization passes to latest
deactivate "mergeReturnPass" because it triggers a segfault with
AMD drivers on MacOS.
2020-03-11 11:11:28 -07:00
Ben Doherty
f4da2ef8ec Add support for spot light shadows (#2209) 2020-03-10 17:53:25 -07:00
Pixelflinger
8fb65a19b4 fix utils::ctz() when builtins are not available
Our fallback 64-bits ctz() was completely wrong. 
The unit tests were wrong too.
2020-03-10 15:41:43 -07:00
Ben Doherty
a2c6c34739 Update SPIRV-Tools to 2020.1 / SPIRV-Cross to 65aa0c3 (#2121) 2020-03-10 15:32:41 -07:00
Romain Guy
a2818037b3 matinfo can print dictionaries, shrink Metal dictionary (#2230)
This change adds new commands to matinfo to print dictionaries.
This feature is useful to debug dictionaries, and I just used
it to identify that using a shared dictionary would save ~12 KiB
in the Android build. The macOS build (GLSL + Metal) would go
down to 71 KiB from 136 KiB.

The SPIRV to Metal conversion leaves leading spaces and some
comments. This change also runs the shrinker on optimized Metal
shaders to further reduce the size of shaders.
2020-03-10 11:42:19 -07:00
Pixelflinger
0cbf6f8d76 disable spinlocks on ARMv7
we've had issues with some devices running in arm mode, where they
would throw spurious SIGILL on the WFE instruction used in spin locks.
Since on Android Mutexes are very efficient, we just use that instead.

This might fix #2197
2020-03-07 13:54:58 -08:00
Mathias Agopian
4842b1ca13 rework stream operators for libmath
libmath itself doesn't expose any stream operators anymore. However,
libutils is able to automatically print libmath types into its
io::ostream -- however matrices are not formatted nicely.

Added a new optional library, libmathio, that provides std::ostream
operators for all libmath types. libmathio does a better job at
formating matrices.

Also removed apply() and map() from libmath because there were not used
anywhere and they forced us to depend on <functional> in public headers.
2020-03-05 22:50:49 -08:00
Ben Doherty
0990550f45 Fix, mathfwd does not work correctly with MSVC (#2214) 2020-03-05 17:46:21 -08:00
Philip Rideout
f81e819901 gltfio: simplify API, privatize bindings.
The binding list can be internalized, clients should instead use
`getResourceUris` and `ResourceLoader` to load external resources.
2020-03-04 16:30:12 -08:00
Ben Doherty
81a2d70251 Use array texture for shadow maps (#2199) 2020-03-04 11:59:25 -08: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
Romain Guy
00629bac48 Add camera controls to gltf_viewer (#2188)
Exposure: shutter speed, aperture and ISO
Focal length

The shadow plane can now be toggled  at runtime.
2020-02-28 23:46:17 -08:00
Romain Guy
81e7f619eb Try to fix compilation error on Android (#2187)
* Try to fix compilation error on Android

* Try with a newer NDK...
2020-02-28 13:10:16 -08:00
Ben Doherty
62cef096e1 Refactor computeVisibilityMasks logic, visibility bits (#2179) 2020-02-27 16:28:47 -08:00
Mathias Agopian
b71357a955 Allocators shouldn't crash when allocation fails
The allocator debug code didn't check that allocations where
successful before filling buffers.
2020-02-27 14:15:11 -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
Romain Guy
4ec5fac95c Add support for KHR_materials_clearcoat to gltfio (#2169) 2020-02-26 10:11:34 -08:00
Ben Doherty
62810d8c87 Rework array texture support (#2136) 2020-02-19 10:52:12 -08:00
Philip Rideout
ca81d48432 gltfio-lite: add BLEND material
This increases the size to 538K.
2020-02-18 11:55:47 -08:00
Philip Rideout
b9c857130a Introduce gltfio-lite.
This is 466 KB insted of the usual 850 KB. It assumes that users do not
need spec-gloss, non-lit, or a special transparency mode.

(uncompressed SO size on arm64)

We can add a new maven project for this next week.
2020-02-18 11:55:47 -08:00
Philip Rideout
54d9d870ee gltfio size reduction 3/3: compile gltfio directly
This takes libgltfio-jni.so from 882 KB to 850 KB
2020-02-14 14:56:38 -08:00