Commit Graph

327 Commits

Author SHA1 Message Date
Philip Rideout
14e1bbdf3d Add --linear to mipgen. 2018-09-19 12:28:50 -07:00
Ben Doherty
29e891a7b1 Tungsten: add IBL to the preview panel (#254)
* Move preview-specific files into new package

* Add venice_sunset resource

* Load IBL from resources

* Generate IBL at build time
2018-09-19 11:16:58 -07:00
Ben Doherty
2218c51306 Add color space option to texture chooser (#266) 2018-09-19 11:02:28 -07:00
Mathias Agopian
670d9986f3 fix typo and improve language in important sampling doc (#271) 2018-09-19 10:44:26 -07:00
Mathias Agopian
a14ceb5dca better explanation of the Jacobian used in importance sampling 2018-09-18 22:57:54 -07:00
Mathias Agopian
c1d8cc0d7a fix normals of the shadow plane.
They ended-up pointing down.
2018-09-18 19:08:50 -07:00
Mathias Agopian
0f5e501dda Add images illustrating IBL prefiltering errors. (#268) 2018-09-18 19:08:21 -07:00
Romain Guy
0d37989157 Make the procedural UV grid HDR (#265) 2018-09-18 18:28:56 -07:00
Philip Rideout
fd8b1851a9 Add --grayscale option to mipgen.
By using single-component images instead of RGB, we are greatly reducing
the size of KTX files for roughness, metallic, and ambient occlusion.
2018-09-18 16:46:38 -07:00
Philip Rideout
60c4822884 Fix mipgen issue where mip 0 was missing from KTX.
The libimage API does not include the original image in the returned mip
array, which might make sense when generating individual files, but for
a KTX bundle, we want to include level 0.
2018-09-18 15:13:35 -07:00
Mathias Agopian
df0594872e rewrite IBL prefiltering documentation 2018-09-18 14:45:47 -07:00
Mathias Agopian
cb88609015 fix @romainguy comments and improve equations 2018-09-18 14:45:47 -07:00
Mathias Agopian
d3e6fa1005 WIP: better explication of the “split-sum”
DO NOT MERGE
2018-09-18 14:45:47 -07:00
prideout
52ee8e570d mipgen can now generate KTX files.
I tested the validity of the resulting KTX files by using macOS Preview,
which can read some types of KTX files. (!)

This CL also adds mipgen to the WebGL build, although its outputs are
not yet used by the sample apps.
2018-09-18 12:42:47 -07:00
Romain Guy
e4c9fd2ac1 Fix documentation typos 2018-09-18 10:33:40 -07:00
Mathias Agopian
944cce7935 Assume V=1 when prefiltering the environement
It looks like assuming V=1 during prefiltering
yields to better results. This is quite subtle.
2018-09-18 01:40:55 -07:00
Mathias Agopian
d1df978638 save this png as 3 channels, so we can prefilter it. 2018-09-18 01:40:38 -07:00
Mathias Agopian
094453dad8 clarify the LOD -> linear_roughness remapping
This remapping can be confused with roughness, because

linear_roughness = roughness*roughness and 
lod = sqrt(linear_roughness)

so the value of lod is roughness, but conceptually
it’s not.
2018-09-17 20:18:57 -07:00
Mathias Agopian
66d97bc9c0 Fix importance sampling for OpenGLES targets 2018-09-17 19:41:05 -07:00
Ben Doherty
cc77160cb4 Tungsten: fix a couple view-related bugs (#255)
* Fix bug when dragging non-selected node

* Fix bug when dragging nodes
2018-09-17 16:16:15 -06:00
prideout
cc6ee64e05 Add "strip alpha" feature to mipgen.
Sometimes the source image might have a useless 1-bit alpha channel
which our image-processing pipeline expands into a proper alpha channel.
This consumes memory and breaks an assertion in our encoder.

I ran into this while testing mipgen with the Suzanne textures.
2018-09-17 15:08:09 -07:00
prideout
3f751f3850 cmgen and mipgen should return an error code upon failure.
These tools can be used in an asset pipeline; build scripts should not
be required to parse stdout in order to determine success.
2018-09-17 14:51:29 -07:00
prideout
ee47255c83 Improve the build instructions for WebAssembly and Linux.
Fixes #249
2018-09-17 11:14:15 -07:00
Romain Guy
4ca4df0f6c Inlude missing headers (#252) 2018-09-17 09:31:10 -07:00
Mathias Agopian
71fed25775 When prefiltering the IBL we were wrongly assuming
f90=0, which is nonsensical.

We now assume f0=f90=1, meaning the fresnel term
always evaluates to 1.

Thankfully this didn’t impact the prefilter too much.


IBLs MUST BE REGENERATED
2018-09-16 17:40:11 -07:00
Romain Guy
a785bab26c Use the fast approximation on mobile instead of desktop 2018-09-14 23:11:45 -07:00
Philip Rideout
21906a1096 Simplify KtxBundle by using unique_ptr. 2018-09-14 16:55:05 -07:00
Philip Rideout
e4b60e47cb Introduce KtxBundle to libimage and add unit test.
KtxBundle is basically an in-memory representation of a KTX file.
Our primary motivation for introducing this class is to have a
structured container for block-compressed textures.

Note that this class is defined in libimage rather than libimageio.
There are several reasons for this:

1. The texel data in a KtxBundle is not meant to be decoded by the CPU.
2. It has no dependendencies on any libraries (stb_image tinyexr etc).
3. We wish to use it with WebGL, which needs to avoid using imageio.
2018-09-14 16:55:05 -07:00
Romain Guy
c1793b09bc Use slightly optimized Schlick on mobile 2018-09-14 09:50:18 -07:00
Romain Guy
96d3846571 Fix Schlick Fresnel when f90 < 1 2018-09-14 09:44:34 -07:00
Romain Guy
41d70cb30a Fix anisotropy BRDF on mobile (#245)
mediump computations are not enough for certain roughness values.
2018-09-13 18:31:08 -07:00
Ben Doherty
3e6f1a2c39 Tungsten: add orbit cam manipulator (#244)
* Add orbit cam to Tungsten

* Add kotlin-math library

* Flip mouse wheel event sign if coming from a physical wheel
2018-09-13 17:30:33 -07:00
Mathias Agopian
ea91002412 improve cmgen comments about IBL (#243)
* better comments on calculating the DFG lookup tables

* add comments about computing the “LD” term

* add comments about computing IBL diffuse pre-integration

* be clearer about the determinant of the jacobian
2018-09-13 15:12:45 -07:00
Ben Doherty
a2b304def9 Update comment in Variant.h (#242)
Update comment so the labels match the description
2018-09-13 11:11:52 -07:00
Philip Rideout
4694a9a160 Invoke find_library for Vulkan only on macOS. 2018-09-13 08:07:55 -07:00
Philip Rideout
0ff40948dc Allow macOS developers to optionally use an SDK version of Vulkan.
This looks for VULKAN_SDK at build time, and if present it tells
Filament to use the `libvulkan.1.dylib` that's located there. Otherwise
it falls back to our old loading strategy, which uses a bundled version
of MoltenVK that allows us to avoid requiring installation of the
LunarG SDK.

I tried this out an it works for me...

Closes issue #238.
2018-09-13 08:07:55 -07:00
Ben Doherty
6ab36e9365 Fix, flip components not working (#239) 2018-09-12 17:29:40 -07:00
Romain Guy
735d7fedf7 Cleanup comments 2018-09-12 13:49:31 -07:00
Mathias Agopian
01a4f563e7 more important sampling fixes
- compute dot(n,l) correctly
- don’t rely on the provided tangent space for
  now because some meshes have a broken TBN
2018-09-12 13:30:34 -07:00
Mathias Agopian
cd058d36f3 use LoH instead of VoH (they’re equal) 2018-09-12 13:30:34 -07:00
Mathias Agopian
fd8c2b1874 compute the clear coat layer with importance sampling 2018-09-12 13:30:34 -07:00
Mathias Agopian
b0f6cf037d address more comments
- pass the tangent space to the importance sampling
- reorder parameters
2018-09-12 13:30:34 -07:00
Pixelflinger
b9bcf41e74 fix most romain@ comments 2018-09-12 13:30:34 -07:00
Mathias Agopian
5f1bdb0677 importance sampling option for IBL
This will be useful for testing and can be
enabled at compile time by setting
IBL_INTEGRATION to IBL_INTEGRATION_IMPORTANCE_SAMPLING
in *both* indirectLight.cpp and light_indirect.fs

BUGS: clearcoat and subsurface won’t
work well when this is enabled since the prefiltered
cubemap is not available and, we don’t evaluate
those lobes with importance sampling (yet).
Additionally, anisotropy can’t work with our
prefiltered importance sampling, so it still uses
the emulation by bending the normal.
2018-09-12 13:30:34 -07:00
Philip Rideout
12d3b06622 High-to-Low includes, per our style guidelines. 2018-09-12 10:43:41 -07:00
Ben Doherty
d0be29fb34 Tungsten: introduce texture sample node (#230)
* Tungsten: introduce texture sample node

* Add uv input to texture sample node

* Only flip components if specified in reverse order
2018-09-12 10:37:03 -07:00
Philip Rideout
ef134f5304 Users can now spin the model in web sandbox. 2018-09-11 13:58:38 -07:00
Philip Rideout
31a3044d51 Fix minor HTML build issue. 2018-09-11 13:57:09 -07:00
Philip Rideout
f84d74378f Ignore non-primary touch events. 2018-09-11 13:25:05 -07:00
Philip Rideout
750b15830f Add new demo for WebGL called "sandbox".
This adds a new demo that leverages ImGui. It looks very similar to the
existing material_sandbox demo we have for desktop, with a few
differences:

    1. Does not use FilamentApp.
    2. Does not draw a shadow plane.
    3. Does not use a TrueType font in ImGui. (improves load time)
    4. Does not allow the user to spin the model. (will fix soon)

We now have a triumvirate of web demos with a progression in complexity:

    1. triangle
    2. suzanne
    3. sandbox

This is a sufficient set of WebGL samples for now, at least until we
finish creating a proper JavaScript API.

This CL factors out some of the common code with the native sandbox
demo, but keeps the UI definition separate since the web demo has some
minor differences (e.g., there is no shadow plane yet).

Note that using viewport units for height was wrong; it caused a bad
aspect ratio on Android while the URL bar was visible. This is explained
in an article:

https://developers.google.com/web/updates/2016/12/url-bar-resizing
2018-09-11 13:25:05 -07:00