Commit Graph

710 Commits

Author SHA1 Message Date
Mathias Agopian
c8e822b402 use mipmaps when doing importance sampling 2018-09-24 16:15:49 -07:00
Mathias Agopian
3bf0d6a4ab document artifacts due to giving up mipmaps (#299)
* document artifacts due to giving up mipmaps

- also talk about lod remapping
- try to avoid to confuse alpha with roughness

* fix typos
2018-09-24 16:14:52 -07:00
Ben Doherty
eed424530d Fix race condition in FilamentPanel (#287) 2018-09-24 13:52:36 -07:00
Mathias Agopian
22f7599e73 Try to clarify the sections about cubemaps (#296)
* Try to clarify the sections about cubemaps

* fix typos and spelling

* don’t mention filament’s APIs by name
2018-09-24 12:54:22 -07:00
Romain Guy
57d4a5d47b Update projects for Android Studio 3.2 (#298) 2018-09-24 11:25:44 -07:00
Philip Rideout
c454a835d1 Web: allow arbitrary file extensions for KTX files.
Sometimes you want your KTX file to end in an extension other than
".ktx".  For example, GitHub Pages applies gzip encoding to bmp files
but not to ktx files (which I think is consistent with nginx defaults).

This change makes it so that a deploy script can rename the files and
apply a simple string transformation to the HTML.
2018-09-21 15:55:00 -07:00
Mathias Agopian
50d8240e67 improve equirectangular conversion
We use a better calculation of the number of
samples needed for a given texel.
2018-09-21 15:11:39 -07:00
Philip Rideout
c6ac562ca9 Rotate WebGL samples IBL by 180.
This is being done simply to maintain the rough alignment between
the light source and the env map. See 09830cd for more information.
2018-09-21 13:13:48 -07:00
Philip Rideout
99a01499d4 Remove vestigial "flip" stuff. 2018-09-21 12:56:29 -07:00
Philip Rideout
d3ad33a8f3 Fix recent cmgen KTX regression.
This fixes a KTX sizing bug that I introduced while incorporating code
review feedback.
2018-09-21 12:23:40 -07:00
Philip Rideout
665ff2cd8f Refactor filaweb::Asset. 2018-09-21 11:54:03 -07:00
prideout
63f2fe4ebc Use KTX for envmaps in WebGL demos.
For each envmap/skybox pair, this reduces the number of downloads
from 61 files to 3 files.
2018-09-21 11:54:03 -07:00
prideout
b396b85818 Refactor filaweb to prep for KTX envmaps. 2018-09-21 11:54:03 -07:00
Pixelflinger
9187b31279 fix debug environment labels
- front and back labels where inverted:
  +z is the front of the cube and -z is its back
  when looking at the cube from the outside
  with a camera pointing towards -z (and the cube
  in front of it). This is the GL definition.

- make the synthetic uvXXX debug environment 
  colors match those of the debug environment
  (except for -Z/back which is magenta instead
  of black).

- add some documentation about skybox and cube map.
2018-09-21 11:50:29 -07:00
Pixelflinger
09830cd126 Improvements to CMGEN handling of cubemaps
- cmgen now creates reflections maps for all input
assets by default instead of just for equirectangular 
images.

- equirectangular decode doesn't mirror -- that's
done by the mirroring code now.

- mirroring can be turned of with --no-mirror

- option --mirror is gone

- faster mirroring code (do it before generating
  mipmaps)

- added labels to faces of debug.png environment

- added a debug equirectangular image in third_party
(creative commons license)
2018-09-21 11:50:29 -07:00
Pixelflinger
1396cc751c fix constness of CubemapUtils::process 2018-09-21 11:49:56 -07:00
Philip Rideout
2e97539a30 Create exportKtxFaces function, use a switch-case. 2018-09-21 11:25:59 -07:00
Philip Rideout
0a464724c8 Fix inconsistent cube face order.
- KTX / OpenGL are PX,NX,PY,NZ,PZ,NZ.
- Cubemap::Face is NX,PX,NY,PY,NZ,PZ.

I considered changing the Cubemap::Face enum, but applying ^1 upon
export seems less intrusive.
2018-09-21 11:25:59 -07:00
prideout
3c59ed2c4b Fix bad size in KTX reader. 2018-09-21 10:45:51 -07:00
Philip Rideout
46b99b7565 KtxBundle now uses contiguous memory for blobs.
This will make uploading KTX cubemaps to the GPU easier and more
efficient.
2018-09-20 17:39:43 -07:00
Romain Guy
5559d71fdc Update samples to Kotlin 1.2.70 (#280) 2018-09-20 15:51:31 -07:00
Philip Rideout
68be31afaf The cmgen tool can now generate KTX files.
For each envmap/skybox pair, this will reduce the number of downloads
from 61 files to 3 files.

Note that we are still using sh.txt for coefficients, I'll see if it
would be easy to embed that in the KTX metadata.

Also, I will add KTX support to roughness-prefilter soon.
2018-09-20 15:50:21 -07:00
Ben Doherty
596c94f6f0 Tungsten: normal mapping capabilities (#274)
* Ability to add code prior to prepareMaterial

* Add normal input on shading node

* Add constant float node

* Add multiply and subtract nodes

* Split math nodes out into MathNodes.kt
2018-09-20 11:09:15 -07:00
Philip Rideout
d3e7103ee5 Fix three bugs that caused bad normals with Suzanne.
(1) Suzanne's normal map is actually linear but we were telling GL that
it is SRGB, so the shader was not reading (0.5,0.5,1.0) from a perfectly
flat normal map.

(2) --linear in mipgen was not honored when consuming PNG files.

(3) The build was not passing --linear to mipgen for the normal map.
2018-09-20 10:01:43 -07:00
Romain Guy
234dbaf00b Clarify IBL evaluation steps 2018-09-19 18:50:48 -07:00
Romain Guy
23c9f8609f Update README 2018-09-19 18:41:46 -07:00
Philip Rideout
44b4cee4b1 Minor filaweb cleanup. 2018-09-19 17:18:44 -07:00
Philip Rideout
695543154b Fix filaweb bug with detecting PNG vs KTX.
To determine PNG vs KTX, we were looking at the file extension of the
asset name rather than the actual file path (which is a URL).

Also, le singe était trop sombre, so I added a call to setIntensity.
2018-09-19 17:17:17 -07:00
Mathias Agopian
4c822533da MATERIAL BREAKAGE: Allow any froxel layout in the shader. sceneform-1.6pr1 2018-09-19 15:26:17 -07:00
Mathias Agopian
aa7c62c0f4 MATERIAL BREAKAGE: enable non-square froxels option 2018-09-19 15:25:56 -07:00
Philip Rideout
f392ba629d Suzanne demo now uses KTX for some textures.
In Chrome, this reduces texture load time from 620 ms to 150 ms because
it removes the PNG decoding work for the surface textures. We are still
using PNG for the envmap, I'll fix that soon.

Many web servers, including GitHub Pages, automatically use gzip
encoding for these files. Over the wire these files actually are not
much bigger than the PNG, even though they contain miplevels.

Stay tuned for compressed textures, which should make this better.
2018-09-19 13:59:05 -07:00
Ben Doherty
f965b02b1b Fix, normal must be set prior to prepareMaterial (#273) 2018-09-19 13:37:24 -07:00
Philip Rideout
01590fde91 Combine some ColorTransform funcs with a template.
Tested this with "./build -u" and mipgen.
2018-09-19 12:28:50 -07:00
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