Commit Graph

1644 Commits

Author SHA1 Message Date
prideout
b16dc443ff Do not bind materials outside of a render pass. (affects GL) 2019-07-31 16:35:55 -07:00
Mathias Agopian
8798d367c5 fix some doxygen comments 2019-07-31 15:47:30 -07:00
prideout
c9921cac3d Vulkan: fix issue with mipmapped render targets.
VkFramebuffer requires its attachments to have only one miplevel each,
but our VulkanRenderTarget wrapper was sharing the VkImageView that
associated with the underlying texture object.

This fixes up VulkanRenderTarget so that it owns a unique VkImageView
that is pinned to a specific miplevel.
2019-07-31 15:18:04 -07:00
prideout
485711f7c6 gltfio now uses FADE when the asset is BLEND.
Fixes #1461
2019-07-31 12:36:11 -07:00
prideout
81df9dd705 Desktop samples should not link Embree.
We now build three gltfio libraries:

 - gltfio_core ....... lightweight library with ubershaders
 - gltfio ............ uses filamat to generate materials at runtime
 - gltfio_pipeline ... depends on path tracer functionality
2019-07-31 12:05:22 -07:00
@roxlu ☾
0faa391470 Copy GLXFBConfig from shared context. (#1456)
* Copy GLXFBConfig from shared context.

* Style fixes
2019-07-31 09:30:45 -07:00
prideout
cd59d6cd23 Fix VulkanDriver query for the DEPTH24 format.
This fixes one of the bugs seen with `gltf-bloom` on Android.

We already dynamically map Filament's DEPTH24 format to either
VK_FORMAT_D32_SFLOAT or VK_FORMAT_X8_D24_UNORM_PACK32, depending on
the platform. Therefore we should return `true` when asked if the
backend supports DEPTH24. Otherwise the client will not be able to
create a depth texture.
2019-07-30 14:32:37 -07:00
prideout
d46ba48293 Build tweaks for Android.
(1) Sometimes (but not always!) gltfio-android was failing to build due
to two missing ANativeWindow functions. Linking in "android" seems to
fix this, and is consistent with libfilament-jni.

(2) Improve our "build.sh -c" utility by clobbering some additional
Android build directories. This is especially useful after
adding "-Pextra_cmake_args=-DFILAMENT_SUPPORTS_VULKAN=ON", otherwise
Gradle will try to use a cached CMake configuration.
2019-07-30 10:53:17 -07:00
Romain Guy
7d84f97dc1 Add function to compute the Fresnel Lazanyi term 2019-07-30 10:38:42 -07:00
Philip Rideout
3263c46355 Add morphing support to gltfio.
Issue #1149, #1417
2019-07-30 10:20:50 -07:00
prideout
44c7d3ac34 Add workaround for Adreno Vulkan shader bug.
Fixes #1096.
2019-07-30 10:20:21 -07:00
prideout
7dad09dbc4 Fix VulkanRenderTarget attachment ref counts.
By design, VulkanRenderTarget has weak references to its attachments and
does not manage any hardware resources. Therefore, when we start
rendering to a particular render target, we need to inform
VulkanDisposer that the command buffer has acquired a reference to the
underlying textures. This prevents the possibility of the texture being
destroyed while still in use.

This fixes #1450 although we should also add a render target pool for
best performance.
2019-07-29 14:39:57 -07:00
prideout
401bc4b486 Fix warning. 2019-07-29 11:10:21 -07:00
Philip Rideout
2b1f9290a4 Fix skinning regression (uninitialized bytes in UBO).
Fix #1440.
2019-07-29 13:37:46 -04: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
Ben Doherty
f8f947addb Handle missing vertex attributes in Metal backend (#1442) 2019-07-26 14:44:34 -07:00
Romain Guy
85449a08fb Give specular-color the ability to compute f82 (or other angles) (#1443) 2019-07-26 08:56:24 -10:00
Ben Doherty
115ce0cb42 Delete empty file 2019-07-25 17:56:56 -07:00
Romain Guy
edc2b49196 Add Mathematica notebook for an improved Fresnel term 2019-07-25 16:28:31 -07:00
Ben Doherty
a47b5c21cf Update SPIRV-Cross (#1439) 2019-07-24 16:26:24 -07:00
Ben Doherty
ada148b819 Add OpenGL scheme to hello-ar (#1437) 2019-07-24 15:49:31 -07:00
Romain Guy
5d5d9af4df Remove trailing semi-colon 2019-07-23 21:20:56 -07:00
Mathias Agopian
064441732e Add support for RGBA buffer formats in Texture::generatePrefilterMipmap 2019-07-23 16:01:57 -07:00
Romain Guy
7b80b31365 Remove unused parameter 2019-07-23 10:04:18 -07:00
Ben Doherty
b439ddc5f4 Implement external images for iOS / OpenGL (#1391) 2019-07-23 09:52:24 -07:00
Ben Doherty
5b9351354a Ensure structs used as Metal state keys have no compiler-generated padding (#1433) 2019-07-23 09:49:00 -07:00
Pixelflinger
9bcf10cf44 fix thread count initialization
if hw thread count was 1, we'd end-up with 32 threads
2019-07-22 13:01:53 -07:00
Ben Doherty
ff72598b7d Update Material class to handle both surface and post-process materials (#1410) 2019-07-19 12:24:18 -07:00
Pixelflinger
79aeaf3250 added an option to turn of pre-filtering in cmgen
When processing very high dynamic range environments, the importance
sampling code falls appart, it becomes a user choice to decide if
prefilter importance sampling is better or worse than just regular
importance sampling -- both are usually bad.

--ibl-no-prefilter gives the user this choice.
2019-07-19 10:57:48 -07:00
Pixelflinger
261dafa924 Fix a possible infinite loop
In the case where we have 2 cores, we would spawn only one thread in
the thread pool. If that thread got to try to steal() from another
thread before the main thread was adopted, it would end-up always
trying to steal from itself and enter an infinite loop.

This seems to happen during windows builds.
2019-07-19 10:56:41 -07: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
Mathias Agopian
6e375b1bba Automatic SH windowing
Clamping is now disabled by default in cmgen, there is a new option
to enable it "--clamp". 

Automatic SH windowing is also enabled by default and can be controled
with the "--sh-window" option. Accepted parameters are "no" to disable
windowing, "auto" for automatic windowing or a number to specify the
cutoff band.

auto windowing only works for 1, 2, and 3 bands.
2019-07-18 17:04:14 -07:00
Mathias Agopian
4d7ab6547c cmgen: tonemap images instead of clamping
Currently we're arbitrarily clamping environments to 16384 because both
the pre-filtering and SH algorithms can't handle very larger dynamic 
ranges.  Instead of clamping, we now tonemap, which is a little bit better.
2019-07-18 17:04:14 -07:00
Mathias Agopian
58b7084c8b make libmath much more constexpr friendly
It turns out that most of libmath couldn't be used in constexpr
expression due to our use of union{}. The C++ standard requires that
all accesses to a union{} in a constexpr expression be the same
element.

Also because libm and cmath are not constexpr some functions such
as length() or normalize() can't be constexpr. The same is true for
anything needing things like sqrt, cos, sin, ceil, floor.

This change mainly does the following:
- replace all accesses to vector elements by operator[]
  (this ensure all of libmath uses the same union element)

- avoid use of std::min / std::max / std::abs

- avoid uninitialized variables, which can't be constexpr

- remove 'constexpr' keyword on functions that can never be

It is now possible to write things like:

    constexpr mat4f I = inverse(
            transpose(mat4f::translation(float3{ 1, 2, 3 }) 
                 * mat4f::scaling(4)));
2019-07-18 16:48:37 -07:00
Philip Rideout
d313fe13fb Add deps to gltfio-android when Vulkan is enabled.
Note that these are SHARED rather than STATIC dependencies.

Issue #1414.
2019-07-17 12:57:55 -07:00
Ben Doherty
4d41c9bde3 Update MaterialBuilder to handle post-process materials correctly (#1408) 2019-07-15 10:56:00 -07:00
Philip Rideout
6c4157767f Restore shadows to helmet web demo. 2019-07-15 09:43:01 -07:00
Ben Doherty
5cceda4155 Pass material domain, variant to ShaderGenerator (#1402) 2019-07-12 13:20:00 -07:00
Philip Rideout
8f45f4ec35 gltfio: Fix skinning offset.
Thanks @iamjinge for the fix.

Fixes #1405.
2019-07-12 09:34:52 -07:00
Mathias Agopian
f3e5b46bf9 highlight negative values in SH debug files 2019-07-11 22:45:49 -07:00
Mathias Agopian
497c544f33 fix sh generation when -d is used
When -d was used, the radiance and irradiance ended-up being
swapped in the final file.

Also rename g_coefficients to g_sh_coefficients.
2019-07-11 22:45:49 -07:00
Mathias Agopian
2e4a825fec clamp correctly when converting to RGB_11_11_10
This avoids artifacts with unclipped HDR environments.
2019-07-11 22:45:49 -07:00
Philip Rideout
244c83a77c gltfio JavaScript: add basePath argument to loadResources.
Fixes #1392
2019-07-11 17:52:02 -07:00
Philip Rideout
41e5bb4f78 Add demo for point sprites and custom attribs. 2019-07-11 14:59:16 -07:00
Philip Rideout
2265eca82d Update cgltf. 2019-07-11 14:52:48 -07:00
Ben Doherty
82c7e4d988 Add new post-process functions (#1400) 2019-07-11 14:06:26 -07:00
Philip Rideout
793198f96a Expose setSampleCount to JavaScript. 2019-07-11 12:18:32 -07:00
Philip Rideout
f139589423 Update WebGL demos and docs on site. 2019-07-11 12:04:43 -07:00
Mathias Agopian
f929b6cee7 New experimental filtering options to cmgen
--sh-window=band, -w band : this low-pass-filters the environment
such that bands above 'band' are zero. This can be used to reduce ringing
when the source environment has high frequencies

--noclamp : turns off clamping before processing the cube map


This is still work in progress.
2019-07-11 11:55:59 -07:00
Pixelflinger
4d6f8c281a fix IndirectLight::radiance()
The conversion factors from radiance to irradiance where wrong.

The bug above was found while refactoring the code to be clearer. Now
the method that computes the coefficients for the shader calls the
regular SH code and applies all the appropriate factors on that.

With this change the options "--sh-shader" and "-sh=3 -i" won't
produce the same result because --sh-shader includes the lambertian
diffuse. "--sh" now always produces actual SH coefficients.
2019-07-11 11:52:33 -07:00