Commit Graph

385 Commits

Author SHA1 Message Date
Mathias Agopian
741b1a412d experimental: add octahedron output support
Octahedron output support for cmgen. use —type=octahedron.

This is still fairly experimental.
2018-10-01 11:49:29 -07:00
François Guthmann
4177eb14ed Removed typo (#322)
The word 'from' was repeated twice unnecessarily.
2018-10-01 11:19:02 -07:00
Romain Guy
4ddfd52ad8 Fix warnings with recent Android NDK 2018-09-29 15:11:05 -07:00
Philip Rideout
33e0e34aa4 Remove STB dependency from astcenc.
We give the encoder raw RGB data, so there's no reason to use its STB
functionality. This shrinks the lib footprint by a small amount.
2018-09-28 16:33:41 -07:00
Philip Rideout
395b3a398d Fix mipgen windows build. 2018-09-28 16:33:41 -07:00
Philip Rideout
b25e693f6b Add stb to mipgen license list. 2018-09-28 16:33:41 -07:00
Philip Rideout
6ed331d74c Add compression to mipgen and change bitrate to block size.
The compression API now takes block size instead of bit rate. Otherwise
it is quite possible for the encoder to generate a block size that is
not one of the valid block sizes that graphics API's can actually
consume.
2018-09-28 16:33:41 -07:00
Pixelflinger
fae92f2750 Equirectangular export support
this adds a new --type (-t) parameter that is
used to specify cmgen’s output.

faces: outputs cube maps separate faces (default
       and current behavior)
equirect: outputs an equirectangular image
ktx: outputs a ktx file


--format=ktx now implies —type=ktx
2018-09-28 14:37:48 -07:00
Philip Rideout
17cfd55d3c Introduce compression API to imageio.
This wraps ARM's open source encoder with a reasonable interface.
2018-09-28 09:42:09 -07:00
Philip Rideout
ec31a55094 Add astcenc from ARM to third_party.
This was designed as a standalone tool rather than a library, so we are
renaming their "main" function to "standalone_main", which is described
in the tnt README.

We'll also be adding a wrapper to our imageio library.
2018-09-28 09:42:09 -07:00
Mathias Agopian
13e70f7afa fix typos that caused bilinear filtering in corners to be wrong 2018-09-27 21:45:21 -07:00
Mathias Agopian
cb34ab217b fix typo that could cause a crash 2018-09-27 20:11:27 -07:00
Mathias Agopian
4764eefafc improve cubemap bilinear sampling
We now handle all face corners correctly and
follow the OpenGL recommandation of averaging the
corners of all 3 adjacent faces.
2018-09-27 20:11:27 -07:00
Mathias Agopian
86b8a97389 clamp .st when reading shadow map to avoid overflow
because the shadow map can be “focused”, its
texture coordinates can end-up very large, which
in turn can cause overflows in the calculation of
the PCF positions. Unfortunately some GPUs
abort in that situation, which causes artifacts.


Fix Bug 111455153
sceneform-1.6pr2
2018-09-26 18:52:32 -07:00
Philip Rideout
462f55e2b4 Add KTX support to roughness-prefilter. 2018-09-25 15:56:12 -07:00
Mathias Agopian
09a753760c better cross conversion. Fix #283. (#302)
- internal cross storage is now always horizontal
  and seamless.

- source cross images are now always converted to
  internal format, conversion includes rescaling
  and sampling if scaling down.

- vertical cross is supported again

- fixes #283

- replace hardcoded constants
2018-09-25 15:40:19 -07:00
prideout
6f2455e7e3 Simplify KTX metadata. 2018-09-25 15:37:49 -07:00
Philip Rideout
6f09389d2f web / cmgen: use KTX metadata for sh coefficients. 2018-09-25 15:37:49 -07:00
prideout
1ca4fcadce Fix / simplify roughness-prefilter.
This tool was producing bad output for the monkey roughness map because
the monkey map has an (unnecessary) alpha channel, and the tool was
assuming that the source image has 3 channels.

This fixes that particular case and changes the tool so that it
operates on single-channel data instead of 3-channel data.
2018-09-25 14:54:31 -07:00
prideout
c55333b7b5 Add WebGL mention, remove duplicated links. 2018-09-25 13:40:58 -07:00
Ben Doherty
804c974819 Fix, Vulkan samples not compiling on Windows (#306) 2018-09-25 13:28:32 -07:00
prideout
be04ea843c Fix test by add missing code to recent commit. 2018-09-25 12:54:00 -07:00
Philip Rideout
fc7b5872a0 Add metadata support to KtxBundle.
The KTX spec allows for arbitrary key-value pairs, we are interested in
using this to stash spherical harmonics coefficients.
2018-09-25 11:53:48 -07:00
Ben Doherty
1360e8f558 Tungsten: Use blurry skybox for mesh preview (#301)
* Use blurry skybox texture for Tungsten preview

* Fix build error with GraphCompilerTest
2018-09-24 18:16:20 -07:00
Ben Doherty
13cb47eead Fix incorrect SPIR-V instructions (#297)
* Add shaders to a program and link

* Remove glslang scope

* Add call to link for preprocessor-only optimization

* Add comment
2018-09-24 16:34:50 -07:00
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