Commit Graph

62 Commits

Author SHA1 Message Date
Jordan Rupprecht
1a04312986 Add missing #include <ios> (#9305)
This is needed to instantiate `std::streampos`. It currently relies on transitive header inclusion to get that, which is going away for libc++ in ebcf1bf2ec.
2025-10-09 10:24:00 -07:00
John Bampton
5fd84db447 docs: update ImageDecoder.h; fix spelling 2025-01-27 21:18:55 -08:00
Ben Doherty
cf91e42847 Switch ASSERT macros to new stream API (#7881) 2024-05-24 20:46:34 +00:00
Mathias Agopian
4503ad1e34 fix -ffast-math and -fno-finite-math-only
- remove -ffast-math in place where it didn't seem too useful
- added -fno-finite-math-only everywhere we use -ffast-math so that
  isinf/isnan work.
2023-03-30 16:15:42 -07:00
Johnathon Selstad
1e3ddd612e Organize Subprojects into Folders in the IDE (#5934)
* Begin Sorting SubProjects into Folders

* Add more subprojects to folders

* Add even more subprojects to folders

* Add further subprojects to folders

* Move the last two projects

* Move Resources to a Resources subfolder

* Remove spaces to be stylistically coherent

* Revert Improper CMake Modifications

* Revert erroneous line removals

* Only specify sdl2's folder on WIN32

* Add the shader subprojects to a Generated folder

* Move shaders to Filament/Shaders
2022-08-17 12:42:21 -07:00
Ben Doherty
6754885795 imageio: Remove unnecessary dependency (#5574) 2022-05-19 11:16:53 -07:00
Philip Rideout
db3186a65f Remove etc2comp and astcenc from the repo. 2022-05-02 11:29:19 -07:00
Philip Rideout
100986d8d9 Fix WebGL debug build (assert with 3-channel images) 2022-04-29 16:30:14 -07:00
Philip Rideout
d52a24b6e9 Incorporate feedback from code review. 2022-04-15 10:48:48 -07:00
Philip Rideout
9aeec3a759 Add Ktx2Reader and BasisEncoder and use them in samples.
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
2022-04-15 10:48:48 -07:00
Philip Rideout
df03fdf3d7 mipgen: fixups / clarification regarding sRGB.
The `g_linearized` variable was being used for two purposes: to denote
the linearity of the source format AND the linearity of the destination
format. This was confusing and is now split is `sourceIsLinear` and
`destIsLinear`.

This change has no effect on the the look of the suzanne demo.
2022-04-11 14:28:34 -07:00
Timo Röhling
62476d2f06 Fix compatibility with libstdc++ (#4763)
The codebase needs only a few additional standard #includes to compile
against libstdc++ on Linux; presumably those headers are implicitly
included with MSVC's and Clang's standard C++ library, but even if
libstdc++ compatibility is not a goal, it is advisable to have them
included directly.
2021-10-26 11:07:39 -07:00
Romain Guy
775090fdda Re-fix tests 2021-10-15 17:30:06 -07:00
Romain Guy
0915b86927 Fix tests 2021-10-15 16:23:45 -07:00
BStringhamVRSK
c10f7b01f4 Fixes normal map issues in mipgen and exposes a couple of SurfaceOrientation functions for Web
* mipgen: Linearized PNG bitmaps (such as normal maps) no longer perform gamma transform on read.

* mipgen: Using "-k normals" argument now works for all file types, not just KTX

* Web: Exposed SurfaceOrientation functions getQuatsHalf4() and getQuatsFloat()
2021-10-15 14:23:41 -07:00
Romain Guy
4080a0a5d5 Small cleanup and improvements in ColorGrading (#4320)
Saturation and vibrance were using the wrong luminance weights,
and this change switches EVILS to HK weighted luminance weights
to give better results.
2021-07-14 16:23:55 -07:00
Ben Doherty
64c5dc63ab Audit usage of UTILS_PUBLIC and fix bluegl linking warning (#3988) 2021-07-12 17:09:13 -07:00
Philip Rideout
c71c7c70d4 imageio: split HDRDecoder into its own file 2021-05-21 12:36:43 -07:00
Romain Guy
c66915209e Update our build to the latest and greatest (#3902)
The new requirements are as follow:
- CMake 3.19
- Ninja 1.10
- Android Studio 4.2
- Android NDK 22.1
- Gradle 7.0
- Kotlin 1.5
2021-05-06 10:13:10 -07:00
Philip Rideout
22312b2090 cmgen / mipgen: add opt-in for ASTC / ETC support.
Block compression is currently only used when we invoke mipgen for the
suzanne demo. This PR makes it easy to disable.

Block compression is still enabled in our CMake build, but other build
systems can simply omit BlockCompression.{h,cpp} from imageio (as well
as the two third_party libs) and it will "just work".
2020-09-23 11:17:27 -07:00
Romain Guy
3e6ee4ca5e Fix libimageio's HDR format decoder (#2653)
See https://cbloomrants.blogspot.com/2020/06/widespread-error-in-radiance-hdr-rgbe.html
2020-06-08 11:48:11 -07:00
Romain Guy
c28d9ddb9d Fix support of paletted images and alpha channel in imageio (#2420) 2020-04-18 16:32:05 -07:00
Ben Doherty
acc36e8d9b Deprecating Clang on Windows in CMakeLists (#2243) 2020-03-13 12:33:02 -07:00
Philip Rideout
898ed70aa0 Remove <iostream> from math headers.
This speeds up our build time by using <iosfwd> and un-inlining the
vector print functions.
2020-01-06 15:09:06 -08:00
Philip Rideout
6d0f8c9ead cmgen: add support for non-RLE HDR images.
The new conditional is cribbed from STB, which checks the first three
bytes.

Fixes #1937.
2019-12-06 08:45:12 -08:00
Gregory Popovitch
a34903aa33 Update CMake configuration to support building with MSVC 2019-09-23 10:15:34 -07:00
Romain Guy
b96b8eb787 Encode sRGB images as sRGB, not linear (#1646)
Fixes #1608
2019-09-16 10:51:17 -07:00
Romain Guy
826d52bca2 Fix Windows build and warnings 2019-06-27 09:18:31 -07:00
Mathias Agopian
2ded1c955f cmgen and filament now support RGB_10_11_11_REV
- RGB_11_11_10 is exported in a RGBA PNG file where the 4 channels are
  used as a uint32 storing a RGB_10_11_11_REV pixel.
  We use the .rgb32f extension, and those PNG files contain garbage 
  when seen in a PNG viewer.

- This is now the default for the -x option.

- compressed KTX files don't encode RGBM, which means they can't
  support HDR, unless an HDR compression scheme is used.
2019-06-20 14:36:37 -07:00
Mathias Agopian
99a501f0c3 fix s3tc compression with HDR input
HDR input where producing garbage pixels, instead we saturate.
2019-06-20 14:36:37 -07:00
Romain Guy
b1242163f7 Make CMake 3.10 the minimum version, add LTO option (#1316)
* Make CMake 3.10 the minimum version, add LTO option

* Install a newer CMake on Linux CI builds

* Update LLVM and Cmake on Windows CI

* Update build/windows/ci-common.bat

Co-Authored-By: Ben Doherty <benjdoherty15@gmail.com>

* Update formatting

* Apply suggestions from code review

* Update build/windows/ci-common.bat

* Update CMake

* Switch Android projects back to CMake 3.6
2019-06-19 12:53:03 -07:00
prideout
5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
Romain Guy
66d71be300 Fix HDR ImageDecoder for width < 8 or > 32767 2019-01-28 15:16:53 -08:00
Romain Guy
614a832be0 Code cleanup in ImageDecoder.cpp 2019-01-28 15:16:53 -08:00
Romain Guy
c1b7f2ac27 Property write small .hdr files (#750)
* Cleanup ImageEncoder code

* Properly write HDR files when width < 8 or > 32767

A little oddity in the original Radiance file format encoding.
2019-01-28 14:02:28 -08:00
Romain Guy
9ce88e6e23 Improve skygen (#679)
Bring back the normalization and gamma correction command line flags,
render the ground in the lower half of the image.
2019-01-08 07:19:50 -08:00
Adrian Perez
aa980682e6 Remove using std::string (#356) 2018-10-09 10:34:12 -07:00
Philip Rideout
5ac2c96cb5 Fix typo in ETC compression string. 2018-10-05 15:25:06 -07:00
Philip Rideout
da698f2e36 Add high level compression API to prep for cmgen integration. 2018-10-05 10:11:48 -07:00
Philip Rideout
eed2f72466 Implement TODO items for ASTC encoding.
These presets are copied over from the ARM standalone tool. I have not
tested them but they seem reasonable.
2018-10-04 14:29:18 -07:00
Philip Rideout
37a42ee854 Enable ETC for Suzanne normal map.
Due to an assertion in etc2comp, this unfortunately uses RGB8 instead of
RG11 but it still helps quite a bit (3.3 MB savings in the unzipped KTX
size).
2018-10-03 12:35:34 -07:00
Philip Rideout
cc61e4649b Add ETC support to mipgen / imageio / suzanne.
This shrinks file size as follows, although it seems to darken the
rendered result.

```
  1398209 Oct  2 16:22 ao.ktx
   699172 Oct  2 16:20 ao_etc.ktx
  1398209 Oct  2 16:22 metallic.ktx
   699172 Oct  2 16:19 metallic_etc.ktx
  1398209 Oct  2 16:22 roughness.ktx
   699172 Oct  2 16:20 roughness_etc.ktx
```
2018-10-02 21:57:22 -07:00
Philip Rideout
70a4c4f887 Add etc2comp to third_party. 2018-10-02 12:32:23 -07:00
Philip Rideout
3185d0f237 Add S3TC support to imageio and Suzanne.
At build time, mipgen now creates several compressed and non-compressed
variants for albedo.

For ASTC we use the ARM encoder, for S3TC we use the STB encoder. The
latter is somewhat limited so we may wish to investigate other libraries
in the future (e.g., AMD Compressenator).

At run time, we detect which of these variants to download, based on
available WebGL extensions. In practice, this means that desktop
browsers will use the S3TC variant and mobile browsers will use the ASTC
variant.

The makes unzipped albedo go from ~4 MB to 682 KB using S3TC.

Mobile support (ASTC and ETC2) is coming in a future PR, stay tuned.
2018-10-01 14:34:21 -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
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
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
Philip Rideout
4665805d81 Minor improvements to EXR decoding. (#177)
See also #176.

This closes #166.
2018-08-28 14:38:54 -07:00
Philip Rideout
aa518369b4 Move deprecated Image out of libs. (#125)
This moves the old Image class into cmgen because it is the only client
that still uses it. We can migrate cmgen to LinearImage in the future.
2018-08-23 10:19:02 -07:00