Commit Graph
350 Commits
Author SHA1 Message Date
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
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