Compare commits

..
Author SHA1 Message Date
Romain Guy b467bb0339 Update README 2018-08-24 12:37:11 -07:00
Ben Doherty 4954364d45 Rename Windows CI artifact to filament-windows.tgz (#138) 2018-08-24 10:44:36 -07:00
Ben Doherty 255b6a903c Fix Windows build (#137) 2018-08-24 10:35:21 -07:00
Romain Guy f9fbb6aef1 Add Windows badge 2018-08-24 10:26:35 -07:00
Romain Guy ac70617f12 Update spirv-tools (#136)
This completely gets rid of unnecessary highp qualifiers in optimized GLSL code.
2018-08-24 10:24:48 -07:00
Ben Doherty 32993ffda9 Kokoro support for Windows (#135) 2018-08-24 10:13:16 -07:00
Romain Guy 4585b8f896 Add clearCoatNormal property (#131)
* Add clear coat normal map support

This change allows to set a separate normal map for the clear coat layer of a material.

* Document the new clearCoatNormal property

* Fix typo
2018-08-24 08:56:44 -07:00
Mathias Agopian 7a14aadb28 sample clean-up and new sphere object (#134)
* Add missing method to query the type of a light

* IcoSphere now generates front facing triangles

* Add a fairly generic sphere object to use in samples

it provides an ico sphere with normal, and reuses
the same vertex/index buffer for each new instance.
Each instance can have its own material, size and
position.

currently it’s not possible to change the # of
subdivisions.

* FilamentApp now provides a “default” pbr material

this makes it easier to create renderables for
testing.

* clean-up lightbulb and add spheres for each light

lightbulb now has less hardcoded things and it
spawns a small sphere for each light.
2018-08-23 21:12:46 -07:00
Romain Guy 8f1d9bcd26 Remove Windows build status for now 2018-08-23 18:20:04 -07:00
Romain Guy 8dbc6b41e7 Add build status to README (#132) 2018-08-23 18:17:14 -07:00
Ben Doherty 6b435a0e8e Tungsten: rework model to be immutable (#127) 2018-08-23 16:35:07 -07:00
Romain Guy 711d8877bf Add comment explaining an odd choice 2018-08-23 14:19:21 -07:00
Philip Rideout 099738e545 Try to clean up asset folders for sample apps. (#128)
* Try to clean up asset folders for sample apps.

This removes the build step where we copy a subset of assets, and makes
it so that FilamentApp hands out a "root path" for assets. For now this
is determined based on the location of the executable. This allows
developers to launch samples from any CWD.

Closes #11

* Restore asset copy to build.
2018-08-23 12:46:45 -07:00
Philip Rideout 7fff7d715f Update VkMemAlloc and fix its usage. (#126)
This implements the following suggestions from Adam Sawicki:

(1) Update VkMemAlloc to dev branch.
(2) Use VMA_MEMORY_USAGE_CPU_ONLY in the stage pool.
(2) Add vmaFlush after every vmaUnmap.

We also considered removing Map / Unmap in favor of persistent mapping
via VMA_ALLOCATION_CREATE_MAPPED_BIT, but decided to be conservative
until we have a chance to rethink our UBO update strategy.

Closes #19
2018-08-23 10:20:12 -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
Mathias Agopian c0a3fc51a4 improve vectorization by massaging the code a bit 2018-08-23 10:16:29 -07:00
Mathias Agopian fc98c775c5 more work towards working light-trees
- improve API of computeLightTree() which should 
  now be functional.

- pre-calculate the range of each light in
  screen-space, so we don’t have to do so
  over and over again in computeLightTree().

- define the GPU-side “node” for the light-tree,
  this is a place-holder until we really implement it.
2018-08-23 10:16:29 -07:00
Romain Guy f8c87f8f81 Update screenshots 2018-08-22 16:29:32 -07:00
Romain Guy d237406ccd Clean up multiscatter and single scatter specular combination 2018-08-22 15:58:04 -07:00
Mathias Agopian 9a129dca1e improve BinaryTreeArray unit test
make sure we visit children before the parents.
2018-08-22 14:55:17 -07:00
Mathias Agopian 1f3dad48b6 Improve Binary Tree Array by getting rid of the recursion
We use a stack instead, it’s not terribly different
from the recursion but it saves function calls
which use a lot more stack than needed.
2018-08-22 14:55:17 -07:00
Mathias Agopian 38de58007c checkpoint: ground work for calculating binary light trees
computeLightTree() takes a list of light as
a bitfield and produces a depth-first 
binary tree array that can be used to efficiently
check which lights volumes contain a given z
coordinate in screen space.

Currently computeLightTree() produces the array
locally on the stack, which isn’t useful, but
before we can make use of it, a lot of other
things have to happen.
2018-08-22 14:55:17 -07:00
Mathias Agopian 4fed143099 pass CameraInfo to froxelizer 2018-08-22 14:55:17 -07:00
Mathias Agopian 8249a8a6d7 Always sort lights by distance to the camera-plane
This will be useful later.
2018-08-22 14:55:17 -07:00
Adrian Perez d9c07220c8 FrameUniforms.resolution gets consistent precision between VS/FS (#122)
* Add option USE_EXTERNAL_GLES3

Causes gl_headers to use GLES, even on desktop.
Causes all ContextManagers to be elided;
users are expected to provide their own.

* FrameUniforms.resolution gets consistent precision between VS/FS
2018-08-22 14:53:47 -07:00
Philip Rideout e45e7b256d Introduce mipgen frontend. (#120)
* Introduce mipgen frontend.

For now this is fairly simple although it does let you choose a filter.
Another cool feature is that an HTML file is generated which makes it
easy to review the generated miplevels.

This does not expose the Boundary enum to users because it has not yet
been implemented in the core Image library.

* Fix up mipgen per code review.
2018-08-21 17:54:27 -07:00
Romain Guy b587ec3f43 Fix revision formatting 2018-08-21 15:55:48 -07:00
Romain Guy b86928179b Document energy compensation for multiscattering BRDFs (#121)
* Document better BRDFs

- Document the loss of energy in the specular BRDF
- Start documenting the gain of energy in the diffuse BRDF

* Explain energy compensation with second scaled lobe

* Add multiscattering pre-integration
2018-08-21 15:51:54 -07:00
Mathias Agopian c8c61fdb8a more froxel optimizations (#118)
* better froxel records compression

We used to compress froxel records by reusing the
previous record on the left if it was identical,
now we additionally check the record above if
that fails.

In practice this saves 10% to 30% space in the
froxel record buffer, which is a scarce resource 
for us.

e.g. if a light occupied 3x3 froxels in a given 
z-slice, without compression 9 records would be
used, with left-only compression, only 3, 
and with left+above compression, only 1.

* use size_t for in and out parameters

this helps the compiler in many places, not
having to cast from 64 to 32 bits.

* implement bitset’s any() and all() operations with NEON

* empty froxels are a common case, handle it first
2018-08-20 16:45:16 -07:00
Philip Rideout d12021a196 Fix args to update-alternatives. (#117) 2018-08-20 15:37:52 -07:00
Romain Guy d91129d42c Merge branch 'master' of https://github.com/google/filament 2018-08-20 14:53:38 -07:00
Romain Guy 424fd3a6e6 Add more f0 sample values 2018-08-20 14:53:35 -07:00
Romain Guy e329ec1872 Fix typo 2018-08-20 12:27:49 -07:00
Adrian Perez c1ebe11f3a Add option USE_EXTERNAL_GLES3 (#116)
Causes gl_headers to use GLES, even on desktop.
Causes all ContextManagers to be elided;
users are expected to provide their own.
2018-08-20 12:26:53 -07:00
Romain Guy 0b914d2ad3 Filament is a real-time renderer 2018-08-20 11:48:22 -07:00
Mathias Agopian 5ed80bc616 Add ctz to utils::algorithm
Use CTZ in bitset.forEachBitSet() so we can
efficiently go through them in order instead of
reverse order.
2018-08-17 19:48:23 -07:00
Adrian Perez 0491c65517 Fix ContextManagerDummy to compile when enabled (#114) 2018-08-17 17:48:37 -07:00
Romain Guy 103ec98d8b Fix test_bluegl on macOS and Windows (#113)
* Fix test_bluegl on macOS

We need to make the context current and request a core profile.

* Fix windows testing code
2018-08-17 16:50:30 -07:00
Mathias Agopian da87405b68 option to reorder the froxel info for better cpu cache utilization
This changes the layout of the froxels data
structure in the GPU so that the major axis
is the Z axis instead of X. The idea is that
within a given screen-space tile, we have a high
probability to access froxels at the same x/y
but different z.

This is turned off right now, as it requires
a change that breaks existing compiled materials.
2018-08-17 13:44:09 -07:00
Romain Guy a597127d59 Merge branch 'master' of https://github.com/google/filament 2018-08-17 12:06:23 -07:00
Romain Guy ae1ad6f8b0 Describe F a bit more 2018-08-17 12:06:20 -07:00
Philip Rideout 07e4db795f Remove lots of reinterpret_cast. (#112)
* Remove lots of reinterpret_cast.

* Improve terseness with auto.
2018-08-17 12:01:32 -07:00
Philip Rideout 044387308a Migrate imageio to LinearImage. (#111) 2018-08-17 11:22:05 -07:00
Romain Guy 7a296f3d6b Add revisions section to the documentation 2018-08-17 10:09:08 -07:00
Mathias Agopian 63e2f69c16 add more pseudo vector swizzle to lib math
vec3: yz
vec4: yz, zw, yzw
2018-08-16 22:36:30 -07:00
Mathias Agopian 03628bbd53 really fix the previous froxelization bug
apparently off-by-one’s hard. The first row of
our *source* froxel data must be skipped because
it contains a bit mask representing wether a light
is point or spot.
2018-08-16 21:10:17 -07:00
Mathias Agopian 87b42f0837 minor clean-up 2018-08-16 20:43:30 -07:00
Mathias Agopian 82c0ff6f30 fix small bug that caused the first column of froxel to be empty
we were also off-by-one when reading the froxels’s
bounding spheres.
2018-08-16 20:43:30 -07:00
Romain Guy f3e0137c2b Fix misguiding comments in the docs 2018-08-16 18:25:10 -07:00
Romain Guy 50bb3f3530 Add energy conservation/loss images for documentation 2018-08-16 16:44:00 -07:00
Romain Guy 8c9c49e2b9 Fix potential null pointer crash
Passing `-y` without specifying an IBL on the command line would lead to a crash.
2018-08-16 16:32:15 -07:00
Romain Guy 70f5bc4291 Add section on specular colors
It explains how to compute f0 for conductors from measured spectral data.
2018-08-16 16:10:13 -07:00
Romain Guy 3b110e3774 Fix uninitialized vectors in envmap processing 2018-08-16 14:56:00 -07:00
Romain Guy 58520d7d32 Add spherical harmonics extraction test (#105)
We use a white furnace to test that spherical harmonics are properly computed.
2018-08-16 14:35:12 -07:00
Romain Guy df146c3cba Update build instructions
Explain how to skip building the Java bindings
2018-08-16 11:40:29 -07:00
Morten Olsen Lysgaard 178502c8a6 CMakeLists.txt: use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to enable embedding of filament as a subdirectory in a larger CMake project. (#103) 2018-08-16 09:25:04 -07:00
Romain Guy e439c779a2 Don't use $CMAKE_SOURCE_DIR, let's use $FILAMENT instead
See pull request #103
2018-08-16 09:08:57 -07:00
Cory Bloor 2dc0d278ac Enhance CMake compiler check on Linux (#102)
* Enhance CMake compiler check

This commit adds a check for compilers that don't meet the project's
minimum requirements. It will catch Clang versions that are too low as
well as any non-Clang compilers.

* Change SEND_ERROR to FATAL_ERROR
2018-08-15 18:05:02 -07:00
Philip Rideout 6d9668ccf6 Add unit test for cross cube images. (#101) 2018-08-15 15:36:17 -07:00
Romain Guy 7547cd9ee5 Update images for the documentation 2018-08-15 13:57:48 -07:00
Romain Guy 24dc24ce86 Add explanations about the Fresnel term 2018-08-15 13:13:48 -07:00
Mathias Agopian 2bdf4c7911 use pointers instead of std::array<>::iterator (#100)
some STL implementations assert when iterators are
out of range (even without dereferencing).
2018-08-15 12:59:28 -07:00
Romain Guy 9f2592ed9d Update SPIRV libraries (#99)
* Update SPIRV libraries

- Update `spirv-cross`
- Update `spirv-tools`
- Update `glslang`

`spirv-tools` contains a fix for an issue we reported (unnecessary promotions to highp in certain expressions).

* Add SPIRV-Tools dependency to matinfo
2018-08-15 12:59:17 -07:00
Mathias Agopian 3d3f169a63 MSVC's STL doesn't let iterators go before begin() (#98)
* MSVC's STL doesn't let iterators go before begin()

This is the case even of the iterator is not
dereferenced. Fix #94.

* cleanup
2018-08-14 22:26:39 -07:00
Romain Guy b739ac8e86 Fold computations inside the branch 2018-08-14 18:15:01 -07:00
Romain Guy 65a42a518c Add material_testbed application (#97)
* Add material_testbed application

This application can be used to automatically vary material parameters over multiple frames and capture each frame as a PNG file. This makes it easier to test/compare/etc. It's also useful to generate documentation examples.

* Rename material_testbed to frame_generator
2018-08-14 18:01:31 -07:00
Philip Rideout 5a027ca5a2 Replace deprecated color xform funcs. (#96) 2018-08-14 15:19:40 -07:00
Philip Rideout b5b90b83f8 Add test_cmgen and promote the "updateOrCompare" function. (#95) 2018-08-14 13:47:31 -07:00
shartte e6d5a85ec8 clang-cl warning fixes (#83)
* Disable certain MSVC-specific deprecation warnings

* clang-cl.exe warning fixes
2018-08-14 12:55:04 -07:00
Mathias Agopian d9ba3998d2 JobSystem now automatically free Jobs (#91)
* JobSystem now automatically free Jobs

Until now Job allocation used a linear allocator
strategy which required to “reset” the JobSystem
periodically — typically once per frame in
filament.

This is no longer required. We use a pool allocator
now, which doesn’t add much overhead. It does
use a spin-lock for thread-safety though, since
we assume very little contention, this shouldn’t
be a problem.

* Thread Safe Object Pool Allocator

A lock-less, thread-safe object pool allocator,
now used for storing JobSystem’s jobs allocations.
This gets rid of the spin-lock introduced in the
previous cl.
2018-08-13 22:25:15 -07:00
Romain Guy bb553bf53d Fix uninitialized memory bug in cmgen (#93)
We recently changed the default constructor of vector to not initialize the vector to 0. This caused subtle issues in cmgen which was creating arrays of vectors. This change simply forces 0 initialization of those arrays.
2018-08-13 22:24:23 -07:00
Mathias Agopian 7fcefb5f54 make we our indices to the hammersley sequence are within range
fix #87

We just skip samples that have a dot(N,L)<0 which 
means we’re “loosing” some samples. However,
this happens higher levels of the mipmap chain,
and since we’re increasing significantly the 
number of samples as the level increases, this
doesn’t end-up being a problem.
2018-08-13 20:23:21 -07:00
Benjamin Doherty 7569ea6359 Fix build issues 2018-08-13 18:35:11 -07:00
Mathias Agopian cf4325b8de improve windows init code
- handle errors during context creation
- handle errors when setting the swap chain
- don’t leak the context and dummy window
- don’t return dummy fences that don’t even work
2018-08-13 18:35:11 -07:00
Mathias Agopian c2362fa2cd tidy code 2018-08-13 18:35:11 -07:00
Romain Guy c429af310e Cleanup sample code 2018-08-13 17:01:04 -07:00
Romain Guy 42e319e074 Add white furnace IBL (#89)
Useful to test BRDFs and energy conservation
2018-08-13 15:51:44 -07:00
Philip Rideout acffdb328a Fix release-only warnings. (#88) 2018-08-13 15:26:51 -07:00
Philip Rideout 143da431c1 Enable image comparison in unit test. (#86) 2018-08-13 12:31:04 -07:00
Romain Guy 45b36e9306 Add link to Python bindings 2018-08-13 12:23:52 -07:00
Romain Guy 3a538f90c8 Update docs 2018-08-13 12:22:53 -07:00
Mathias Agopian c91d2aedd8 per-light multithreading works again for froxelization
We spawn MAX_LIGHTS/32 (currently 8) jobs and
multi-threading is active as soon as we have more
than one light. All jobs work on disjoint buffers
to avoid false sharing between threads.

It’s possible to adjust roughly the number of jobs
by changing the group size (currently 32). However
this also affects vectorization.

With the current parameters, with 256 lights max
we get 8 jobs, and 4 spot-light test / froxel.
2018-08-13 11:36:24 -07:00
Mathias Agopian 7b7bd85def New froxelization algorithm that uses much less memory
Instead of building a list of froxel per light,
we now build a bitfield of lights per froxel.
To keep the code efficient we have to split
the bitfield array in 4, so that we can use
multiple threads without having them or’ing
each other’s cache-lines.

This data structure is also what we want in 
froxelizeAssignRecords(), and the conversion from
one format to the other is much faster.

Our internal data structure is now 256 KiB
instead of 2 MiB. It would be 1 MiB for 1024 lights
(down from 16 MiB)

Additionally, because the code is simpler, we get
more vectorization, especially with spot-lights.

One draw-back of the current version is that
multi-threading happens only every 64 lights.
This will be fixed later.
2018-08-13 11:36:24 -07:00
Philip Rideout 1f380a6ec6 Introduce new image library, Phase I. (#80)
* Overhaul the image library, Phase I.

The preps for our upcoming mipgen command line tool by adding filtering
capabilities and unit tests for a new LinearImage class, which will
subsume Image (deprecated).

Filament's new image library is composed of three components:

- LinearImage....simple 3D tensor of floats
- ImageOps.......free functions for simple transforms
- ImageSampler...high quality filtering

The old Image class was a simple untyped data blob and is now
deprecated. The new LinearImage class is always float32, and always
stores pixels in packed scanline order. This makes it easier to
implement image-based algorithms because they can be agnostic of the
underlying format.

Remaining refactorings:
- Phase  II will migrate imageio to LinearImage
- Phase III will migrate all downstream tools to LinearImage
- Phase  IV will remove old the Image class

* Image library code review feedback.
2018-08-13 10:39:57 -07:00
Romain Guy c546890294 Add issue templates 2018-08-13 09:12:40 -07:00
Omar Shehata 41bbac7098 Fix typo (#85)
Fixing a typo in the overview section.
2018-08-13 07:44:31 -07:00
Mathias Agopian a4851ed835 fix a bunch of clang-tidy warnings
fixed a couple actual real bugs (missing returns 
in operator=, wrong implicit bool conversion).

mostly added a bunch of explicit ctor.
2018-08-10 20:53:58 -07:00
Romain Guy 9ac432d530 Fix continuous integration tests 2018-08-10 16:23:03 -07:00
Romain Guy 451d62e4de Fix artifacts location (#78) 2018-08-10 16:07:29 -07:00
shartte 6216b1a459 Remove more unsupported compiler flags when clang-cl.exe is being used. (#76) 2018-08-10 15:35:49 -07:00
Romain Guy 56d280a729 Exclude more tests 2018-08-10 15:14:39 -07:00
Romain Guy 5aab9b016f Fix tests list 2018-08-10 14:50:23 -07:00
Romain Guy af13e385c1 Run unit tests in continuous builds (#75) 2018-08-10 14:31:41 -07:00
Philip Rideout 3e9979b75d Fix the surfaceCapabilities check. (#74)
Some Intel drivers report a max image count of 0, which is legit.

Fixes #71.
2018-08-10 13:28:59 -07:00
prideout 307f4782ae Disable hex mode after printing diagnostics. 2018-08-10 12:09:09 -07:00
Philip Rideout fbe854e37d VulkanDriver now prints GPU info. (#73)
This is motivated by #71.
2018-08-10 11:58:03 -07:00
Romain Guy 263012384b Mac buils should inspect the job name (#72) 2018-08-10 11:19:52 -07:00
Mathias Agopian 8d2b3b2229 froxelization fixes (#70)
* fix stack corruption when the scene has more than 255 lights

* fix froxelization with more than 255 lights

Make sure froxelization works when the engine is
configured with more than a maximum of 255 lights.

The main issue was that the froxel structure on the
GPU uses 8 bits to encode the light count (per
froxel). So we have this 255 light max per
froxel limitation. The CPU code now honors this.

With this change we can go back to 256 lights
from 255!

All that said, it’s not recommended to increase
the maximum number of lights because the memory
usage on the CPU explodes. For instance we
go from 4 MiB with 256 lights to 18 MiB for 1024.
2018-08-09 23:07:24 -07:00
Romain Guy 12da05e249 Update docs 2018-08-09 17:41:07 -07:00
Mathias Agopian d6746e1140 Set max number of lights to 255 instead of 256 (#66)
This always was the intention because internally 
it uses 8-bits buffers instead of 16-bits. One of
our temporary buffer goes from 4 MiB to 2 MiB.
This got mistakenly changed to 256 recently.
2018-08-09 17:30:59 -07:00
Philip Rideout 07c34ee833 Simplify Image by flipping RADIANCE images. (#63)
* Simplify Image by flipping RADIANCE images.

Unit test for the new flip() method is forthcoming.

* Optimize image flipping.
2018-08-09 17:30:17 -07:00
Romain Guy 0f20068775 Detect GCC before attempting a build (#64)
This change fixes #62
2018-08-09 17:12:37 -07:00
Romain Guy 6b1788fc6e Add about section 2018-08-09 16:06:50 -07:00
Philip Rideout 69b65d9e2d Rename ColorSpace header to ColorTransform. (#61) 2018-08-09 15:54:18 -07:00
Romain Guy e5535c7a66 Rg/less warnings (#60)
* Fix warnings for real this time
2018-08-09 14:16:10 -07:00
Philip Rideout 9ed20705ec Refactor color space utilities. (#58)
* Refactor color space utilities.

* Repair Android build.
2018-08-09 13:58:58 -07:00
Ben Doherty 714e0c18e0 Fix build error on Windows 2018-08-09 13:26:44 -07:00
Romain Guy 69941a2795 Remove warnings on Darwin and Linux (#59) 2018-08-09 11:39:15 -07:00
Ben Doherty b0ab4c7321 Fix various compiler warnings on Windows (#56) 2018-08-09 10:27:43 -07:00
Romain Guy 70391fa16b Fedora needs libcxx-devel 2018-08-09 10:21:59 -07:00
Romain Guy 202ce993af Document pre-exposed lights
Fixes various mistakes
Add link to the GitHub project
Document the IBL specular in the cloth section
2018-08-09 10:18:51 -07:00
Ben Doherty b8a2457e28 Revert "Don't require Python to build (#51) (#55) 2018-08-09 09:53:35 -07:00
Romain Guy 128ab657df Switch cloth model from Ashikhmin NDF to "Charlie" NDF (#53)
* Add new Cloth NDF

Based on the work by Estevez and Kulla, also known as the "Charlie" sheen.

* Restore DFG computation to GGX

* New proposed approximation for Cloth DFG

* Add "Charlie" cloth DFG approximation to cmgen

* Switch to "Charlie" sheen for cloth shading

* Document the new cloth NDF and DFG approximation
2018-08-08 17:22:41 -07:00
Mathias Agopian a6877d5baa Fix cmgen cross cubmap input
Fixes bug #45
2018-08-08 16:50:02 -07:00
Romain Guy 9ee46fa8cf Don't require Python to build (#51)
Fixes #50
2018-08-08 12:57:22 -07:00
Ben Doherty 520ff90f34 Fix pathing issues on Windows (#49) 2018-08-08 12:17:30 -07:00
Romain Guy f3c4582727 Update incorrect Charlie DFG (#48) 2018-08-08 10:26:26 -07:00
Romain Guy 9df04b8670 Allow Android CI builds to run on Darwin (#47)
CI builds seem faster on macOS, this change prepares the scripts to move CI to macOS machines for Android builds.
2018-08-08 09:47:16 -07:00
Romain Guy 294bc98940 Make spirv-tools more quiet (#46)
We don't need the pkg-config step of spirv-tools' build configuration. Let's turn this off to keep the build quiet when nothing has changed.
2018-08-08 09:46:22 -07:00
Damianno19 3d9dfd5085 Fix forward declaration type. (#44)
* Update MaterialBuilder.h

* Fix forward declaration type. Class instead struct
2018-08-08 08:53:32 -07:00
emmcbd de1743c572 Fix huge memory allocation when decoding PNG, which can end up with std::bad_alloc (#43) 2018-08-08 07:45:57 -07:00
Romain Guy bb75923b79 Fix post-process shader when not in Vulkan (#41)
* Fix post-process shader when not in Vulkan

The post-process shader must not flip the source texture when we compile for OpenGL. This happens because we use SPIR-V/Vulkan as an intermediate format.

* Fix the Android build

We need to output a location when targeting SPIR-V for mobile.
2018-08-07 18:46:30 -07:00
Mathias Agopian 8c2da20e31 move intersection tests to their own headers
since the code is generic enough, move
sphere-plane and sphere-cone intersection tests
to their own header.
2018-08-07 18:30:17 -07:00
Mathias Agopian 8bd7688d33 slightly improve froxelizer unit test 2018-08-07 17:51:07 -07:00
Ben Doherty 46228e9610 Fix shader compilation on Windows 2018-08-07 17:10:03 -07:00
Philip Rideout f8a8098e0f Split off imageio lib from image. (#36)
* Split off imageio lib from image.

* Remove duplicated math funcs.
2018-08-07 16:38:04 -07:00
Romain Guy da03ef2378 Compile shaders in a separate static library (#34)
* Update build instructions

* Compile shaders in a separate static library

Each shader string is now part of a separate .o file, which should make recompiling filamat/matc a tad more enjoyable.

* Shaders.h belongs to filamat, not filament
2018-08-07 12:47:52 -07:00
Benjamin Doherty 65bbf44203 Fix line length 2018-08-07 12:15:47 -07:00
Benjamin Doherty 5e0a0820ba Add Ninja build instructions on Windows 2018-08-07 12:15:47 -07:00
Romain Guy 9f25b6c578 Update build instructions
The new build instructions match what the build scripts build.sh does. This unifies all the instructions and should make everyone's life easi.
2018-08-07 11:08:12 -07:00
Romain Guy 13ee398c63 Add documentation for Linux and Windows swap chains (#32) 2018-08-07 09:56:09 -07:00
Romain Guy 2b9a383c8b Prevent compilation error on Windows (#31)
The compiler cannot infer the type of the constructed object when
using the shorthand syntax.
2018-08-07 09:45:25 -07:00
Romain Guy a40e053e68 Merge branch 'master' of https://github.com/google/filament 2018-08-07 09:35:20 -07:00
Romain Guy 86bfcf9afa Fix several typos in Filament.md.html 2018-08-07 09:35:19 -07:00
Mathias Agopian 4efb663015 Rename FroxelData to Froxelizer
Also match the file name to the class name.
2018-08-06 20:48:48 -07:00
Romain Guy 666df2f9b2 Document new ide folder
This folder is meant to host configuration files that can be imported
in various IDEs. We currently use only CLion
2018-08-06 19:17:08 -07:00
Mathias Agopian 9cc39a6943 refactor code a bit to make usage of DriverAPI more explicit
because DriverAPI is not thread-safe, it’s better
to make its usage more explicit — so it’s now
passed as argument of all methods that need it.

also pass Engine as parameter in internal classes
that made little use of it (i.e. no point in
storing it if we can just pass it a sa parameter).

Change-Id: I9142959437ed3d8c8ecb7bcd030ea55d9c8ef352
2018-08-06 19:00:32 -07:00
Benjamin Doherty a32b6e7415 Output libs and binaries to consistent locations across platforms 2018-08-06 18:58:03 -07:00
Mathias Agopian 692a44350a code-style and C file header template for CLion
Change-Id: Id41f7138443915b33c9043c7a28b6f6729f9e0b1
2018-08-06 18:26:57 -07:00
Mathias Agopian d93679d8f8 rename LightData to GpuLightBuffer
Change-Id: I0188c0810bbb4582489e3c666c9ec011adecfec4
2018-08-06 18:21:37 -07:00
Mathias Agopian ac24fc3e30 clean-up LightData
remove unused code and fields, make it a value-object.

Change-Id: I52e611a1d64061c89a8ed82017a5da04f1880836
2018-08-06 18:21:37 -07:00
Mathias Agopian 94c3623c1c clean-up formatting
Change-Id: I2071e53cceb93cbe02d6bdfa238aa6ce770b0534
2018-08-06 18:14:11 -07:00
Philip Rideout f9e1d58772 Add prefix to experimental Vulkan demos. 2018-08-06 17:01:41 -07:00
Damianno19 9d14f6e907 Fix error
utils\src\Profiler.cpp(61): error : no member named 'uninitialized_fill' in namespace 'std'
2018-08-06 14:44:29 -07:00
Benjamin Doherty 6a26605864 Update documentation, use x64 native tools and no debug flag 2018-08-06 11:23:16 -07:00
Tact Yoshida ad49986245 Remove execute permissions 2018-08-06 10:36:54 -07:00
Romain Guy a6fcdea74c Attempt to address #16 2018-08-06 10:09:26 -07:00
James Darpinian f7ff98a0c0 Windows: Clang 7 crashes, Clang 6 is required instead. 2018-08-06 08:05:55 -07:00
Romain Guy 15fde11bb7 Update build.gradle and Android instructions 2018-08-05 15:23:44 -07:00
Romain Guy 329b361c81 Update Windows build instructions 2018-08-05 15:07:13 -07:00
Romain Guy 2c85725d9e Update build instructions for Linux 2018-08-05 01:17:09 -07:00
Romain Guy 7c60824022 Update README
Better describe what the first document is about.
2018-08-05 00:16:38 -07:00
Romain Guy 55476e97f0 Fix clear coat attenuation for direct lighting
The diffuse term was erroneously multiplied by (1-Fc)^2 after a previous refactoring. The documentation was correct.
2018-08-05 00:10:04 -07:00
Romain Guy c9babb32e6 Fix typo in clear coat IBL docs 2018-08-04 23:43:29 -07:00
Romain Guy ef9eabf773 Clarify the attenuation term in the clear coat model 2018-08-04 23:30:22 -07:00
Romain Guy 680ec9c796 Fix the link to the Spherical Harmonics section 2018-08-04 23:26:02 -07:00
Romain Guy dc20c3d4a2 Fix max clear coat roughness in the documentation 2018-08-04 23:02:28 -07:00
Romain Guy 0c6590f49f Fix typos in the documentation 2018-08-04 23:00:41 -07:00
Romain Guy a81a4221da Add more checks for Java builds 2018-08-04 19:50:44 -07:00
Fabian Terhorst ea592e1e67 Fix typo in README 2018-08-04 18:15:01 -07:00
Romain Guy 14092f196f Add annex on spherical harmonics to docs 2018-08-04 15:30:31 -07:00
Romain Guy 3e1c9d4d91 The repo tool is not needed 2018-08-04 11:13:25 -07:00
Romain Guy f05f855656 Make Markdeep work offline 2018-08-04 11:05:12 -07:00
Rich Wareham a9153d9ce1 libs/image: fix structure-packing pragma warning
When compiling with clang on Linux, the following warning is generated:

../../libs/image/src/ImageDecoder.cpp:487:13: warning: unterminated '#pragma pack (push, ...)' at end of file [-Wpragma-pack]
    #pragma pack(push, 1)
            ^

According to [1], the correct pragma to pop the packing state from the
internal stack is "#pragma pack(pop)" rather than "#pragma pop()" which
is used currently. This commit replaces "#pragma pop()" with "#pragma
pack(pop)".

[1] http://gcc.gnu.org/onlinedocs/gcc-4.2.3/gcc/Structure_002dPacking-Pragmas.html
2018-08-04 09:47:01 -07:00
Jesse fd380530c4 Fix more typos 2018-08-04 09:45:27 -07:00
Jesse 72ac897684 Fix some doc typos 2018-08-04 09:45:27 -07:00
Marshall 3252f90489 Fixed typo in the docs 2018-08-04 09:35:11 -07:00
Romain Guy 59d84e13a0 Fix typo in the docs 2018-08-03 23:58:04 -07:00
Romain Guy 23dc63da96 Update Linux documentation 2018-08-03 23:27:57 -07:00
2518 changed files with 51471 additions and 28015 deletions
+30
View File
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. ...
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- GPU: [e.g. NVIDIA GTX 1080]
- Backend: [OpenGL/Vulkan]
**Smartphone (please complete the following information):**
- Device: [e.g. Pixel 2]
- OS: [e.g. Android Pie 9.0]
**Additional context**
Add any other context about the problem here.
+17
View File
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**OS and backend**
Is this feature OS/backend specific? If so, explain why.
Executable → Regular
+70 -27
View File
@@ -1,18 +1,8 @@
# ==================================================================================================
# CMake
# ==================================================================================================
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. Create a sub-directory and invoke cmake from there.")
endif()
cmake_minimum_required(VERSION 3.1)
if (WIN32)
# On Windows we need to instruct cmake to generate the .def in order to get the .lib required
# when linking against dlls. CL.EXE will not generate .lib without .def file (or without pragma
# __declspec(dllexport) in front of each functions).
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
# ==================================================================================================
# Project declaration
# ==================================================================================================
@@ -24,6 +14,8 @@ project(TNT)
option(ENABLE_JAVA "Compile Java projects, requires a JDK and the JAVA_HOME env var" ON)
option(USE_EXTERNAL_GLES3 "Experimental: Compile Filament against OpenGL ES 3" OFF)
# ==================================================================================================
# OS specific
# ==================================================================================================
@@ -32,10 +24,10 @@ if (UNIX AND NOT APPLE AND NOT ANDROID)
endif()
if (WIN32)
# .exe and .dll must be together in the same folder to work.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# On Windows we need to instruct cmake to generate the .def in order to get the .lib required
# when linking against dlls. CL.EXE will not generate .lib without .def file (or without pragma
# __declspec(dllexport) in front of each functions).
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# TODO: Figure out why pdb generation messes with incremental compilaton.
# IN RELEASE_WITH_DEBUG_INFO, generate debug info in .obj, no in pdb.
@@ -57,21 +49,56 @@ endif()
# Paths
# ==================================================================================================
# Where our external libs are
set(EXTERNAL ${CMAKE_SOURCE_DIR}/third_party)
set(EXTERNAL ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
# Where our libraries are
set(LIBRARIES ${CMAKE_SOURCE_DIR}/libs)
set(LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/libs)
# Where our filament code is
set(FILAMENT ${CMAKE_SOURCE_DIR})
set(FILAMENT ${CMAKE_CURRENT_SOURCE_DIR})
# Where our tools are
set(TOOLS ${CMAKE_SOURCE_DIR}/tools)
set(TOOLS ${CMAKE_CURRENT_SOURCE_DIR}/tools)
# ==================================================================================================
# Compiler check
# ==================================================================================================
set(MIN_CLANG_VERSION "5.0")
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
if (CMAKE_C_COMPILER_VERSION VERSION_LESS MIN_CLANG_VERSION)
message(FATAL_ERROR "Detected C compiler Clang ${CMAKE_C_COMPILER_VERSION} < ${MIN_CLANG_VERSION}")
endif()
else()
message(FATAL_ERROR "Detected C compiler ${CMAKE_C_COMPILER_ID} is unsupported")
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MIN_CLANG_VERSION)
message(FATAL_ERROR "Detected CXX compiler Clang ${CMAKE_CXX_COMPILER_VERSION} < ${MIN_CLANG_VERSION}")
endif()
else()
message(FATAL_ERROR "Detected CXX compiler ${CMAKE_CXX_COMPILER_ID} is unsupported")
endif()
# Detect use of the clang-cl.exe frontend, which does not support all of clangs normal options
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
set(CLANG_CL true)
endif()
# ==================================================================================================
# General compiler flags
# ==================================================================================================
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function")
set(CXX_STANDARD "-std=c++14")
if (WIN32)
set(CXX_STANDARD "/std:c++14")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function")
if (USE_EXTERNAL_GLES3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_EXTERNAL_GLES3")
endif()
if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_USE_MATH_DEFINES=1")
@@ -97,6 +124,13 @@ if (CYGWIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif()
if (CLANG_CL)
# Since the "secure" replacements that MSVC suggests are not portable, disable
# the deprecation warnings. Also disable warnings about use of POSIX functions (i.e. "unlink").
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE")
endif()
# Add colors to ninja builds
if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
@@ -106,7 +140,9 @@ endif()
# ==================================================================================================
# Release compiler flags
# ==================================================================================================
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffunction-sections -fdata-sections")
if (NOT CLANG_CL)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffunction-sections -fdata-sections")
endif()
# On Android RELEASE builds, we disable exceptions and RTTI to save some space (about 75 KiB
# saved by -fno-exception and 10 KiB saved by -fno-rtti).
@@ -127,11 +163,11 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_SANITIZE_OPTIONS}")
# Linker flags
# ==================================================================================================
# Strip unused sections
set(GC_SECTIONS "--gc-sections")
set(B_SYMBOLIC_FUNCTIONS "-Bsymbolic-functions")
set(GC_SECTIONS "-Wl,--gc-sections")
set(B_SYMBOLIC_FUNCTIONS "-Wl,-Bsymbolic-functions")
if (APPLE)
set(GC_SECTIONS "-dead_strip")
set(GC_SECTIONS "-Wl,-dead_strip")
set(B_SYMBOLIC_FUNCTIONS "")
# tell ranlib to ignore empty compilation units
@@ -140,10 +176,13 @@ if (APPLE)
# prevents ar from invoking ranlib, let CMake do it
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qc -S <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qc -S <TARGET> <LINK_FLAGS> <OBJECTS>")
elseif (CLANG_CL)
set(GC_SECTIONS "")
set(B_SYMBOLIC_FUNCTIONS "")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,${GC_SECTIONS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,${GC_SECTIONS} -Wl,${B_SYMBOLIC_FUNCTIONS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GC_SECTIONS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GC_SECTIONS} ${B_SYMBOLIC_FUNCTIONS}")
# ==================================================================================================
# Project flags
@@ -203,6 +242,7 @@ add_subdirectory(${EXTERNAL}/libgtest/tnt)
add_subdirectory(${LIBRARIES}/filabridge)
add_subdirectory(${LIBRARIES}/filaflat)
add_subdirectory(${LIBRARIES}/filamat)
add_subdirectory(${LIBRARIES}/image)
add_subdirectory(${LIBRARIES}/math)
add_subdirectory(${LIBRARIES}/utils)
add_subdirectory(${FILAMENT}/filament)
@@ -218,12 +258,14 @@ if (APPLE)
add_subdirectory(${EXTERNAL}/moltenvk/tnt)
endif()
set (FILAMENT_SAMPLES_BINARY_DIR ${PROJECT_BINARY_DIR}/samples)
if (NOT ANDROID)
add_subdirectory(${FILAMENT}/samples)
add_subdirectory(${LIBRARIES}/bluegl)
add_subdirectory(${LIBRARIES}/filagui)
add_subdirectory(${LIBRARIES}/image)
add_subdirectory(${LIBRARIES}/imageio)
add_subdirectory(${FILAMENT}/java)
@@ -246,6 +288,7 @@ if (NOT ANDROID)
add_subdirectory(${TOOLS}/filamesh)
add_subdirectory(${TOOLS}/matc)
add_subdirectory(${TOOLS}/matinfo)
add_subdirectory(${TOOLS}/mipgen)
add_subdirectory(${TOOLS}/normal-blending)
add_subdirectory(${TOOLS}/roughness-prefilter)
add_subdirectory(${TOOLS}/skygen)
@@ -254,5 +297,5 @@ endif()
# Generate exported executables for cross-compiled builds (Android)
if (NOT CMAKE_CROSSCOMPILING)
export(TARGETS matc cmgen FILE ${CMAKE_SOURCE_DIR}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-${CMAKE_BUILD_TYPE}.cmake)
export(TARGETS matc cmgen FILE ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-${CMAKE_BUILD_TYPE}.cmake)
endif()
+153 -73
View File
@@ -1,9 +1,13 @@
![Filament logo](docs/images/filament_logo_small.png)
# Filament
Filament is a physically based rendering engine for Android, Linux, macOS and Windows. This
rendering engine was designed to be as small as possible and as efficient as possible on Android.
<img alt="Android" src="build/img/android.png" width="20px" height="20px" hspace="2px"/>![Android Build Status](https://filament-build.storage.googleapis.com/badges/build_status_android.svg)
<img alt="Linux" src="build/img/linux.png" width="20px" height="20px" hspace="2px"/>![Linux Build Status](https://filament-build.storage.googleapis.com/badges/build_status_linux.svg)
<img alt="macOS" src="build/img/macos.png" width="20px" height="20px" hspace="2px"/>![MacOS Build Status](https://filament-build.storage.googleapis.com/badges/build_status_mac.svg)
<img alt="Windows" src="build/img/windows.png" width="20px" height="20px" hspace="2px"/>![Windows Build Status](https://filament-build.storage.googleapis.com/badges/build_status_windows.svg)
Filament is a real-time physically based rendering engine for Android, Linux, macOS and Windows.
This rendering engine was designed to be as small as possible and as efficient as possible
on Android.
Filament is currently used in the
[Sceneform](https://developers.google.com/ar/develop/java/sceneform/) library both at runtime on
@@ -11,14 +15,15 @@ Android devices and as the renderer inside the Android Studio plugin.
## Documentation
- [Filament](https://google.github.io/filament/Filament.md.html), an in-depth explanation of the graphics capabilities and
implementation of Filament. This document explains the math and reasoning behind most of our
decisions.
- [Materials](https://google.github.io/filament//Materials.md.html), the full reference documentation for our material system.
This document explains our different material models, how to use the material compiler `matc` and
how to write custom materials.
- [Material Properties](https://google.github.io/filament/Material%20Properties.pdf), a reference sheet for the standard
material model.
- [Filament](https://google.github.io/filament/Filament.md.html), an in-depth explanation of
real-time physically based rendering, the graphics capabilities and implementation of Filament.
This document explains the math and reasoning behind most of our decisions. This document is a
good introduction to PBR for graphics programmers.
- [Materials](https://google.github.io/filament//Materials.md.html), the full reference
documentation for our material system. This document explains our different material models, how
to use the material compiler `matc` and how to write custom materials.
- [Material Properties](https://google.github.io/filament/Material%20Properties.pdf), a reference
sheet for the standard material model.
## Samples
@@ -41,6 +46,7 @@ Here are a few sample materials rendered with Filament:
- Native C++ API for Android, Linux, macOS and Windows
- Java/JNI API for Android, Linux, macOS and Windows
- [Python bindings](https://github.com/artometa/pyfilament)
### Backends
@@ -91,6 +97,7 @@ Many other features have been either prototyped or planned:
- `docs`: Documentation
- `math`: Mathematica notebooks used to explore BRDFs, equations, etc.
- `filament`: Filament engine
- `ide`: Configuration files for IDEs (CLion, etc.)
- `java`: Java bindings for Filament libraries
- `libs`: Libraries
- `bluegl`: OpenGL bindings for macOS, Linux and Windows
@@ -99,7 +106,8 @@ Many other features have been either prototyped or planned:
- `filaflat`: Serialization/deserialization library used for materials
- `filagui`: Helper library for [Dear ImGui](https://github.com/ocornut/imgui)
- `filamat`: Material generation library
- `image`: Image library, only intended for internal use
- `image`: Image filtering and simple transforms
- `imageio`: Image file reading / writing, only intended for internal use
- `math`: Math library
- `utils`: Utility library (threads, memory, data structures, etc.)
- `samples`: Sample desktop applications
@@ -110,6 +118,7 @@ Many other features have been either prototyped or planned:
- `filamesh`: Mesh converter
- `matc`: Material compiler
- `matinfo` Displays information about materials compiled with `matc`
- `mipgen` Generates a series of miplevels from a source image.
- `normal-blending`: Tool to blend normal maps
- `roughness-prefilter`: Pre-filters a roughness map from a normal map to reduce aliasing
- `skygen`: Physically-based sky environment texture generator
@@ -117,9 +126,10 @@ Many other features have been either prototyped or planned:
## Building Filament
### Prerequisites
To build Filament, you must first install the following tools:
- repo
- CMake 3.4 (or more recent)
- clang 5.0 (or more recent)
- [ninja 1.8](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) (or more recent)
@@ -141,6 +151,9 @@ To build Filament for Android you must also install the following:
Make sure the environment variable `ANDROID_HOME` points to the location of your Android SDK.
By default our build system will attempt to compile the Java bindings. To do so, the environment
variable `JAVA_HOME` should point to the location of your JDK.
### IDE
We recommend using CLion to develop for Filament. Simply open the root directory's CMakeList.txt
@@ -176,39 +189,68 @@ To install the libraries and executables in `out/debug/` and `out/release/`, add
You can force a clean build by adding the `-c` flag. The script offers more features described
by executing `build.sh -h`.
You can skip building the Java based components of the projects by using the `-j` flag:
### Disabling Java builds
By default our build system will attempt to compile the Java bindings. If you wish to skip this
compilation step simply pass the `-j` flag to `build.sh`:
```
$ ./build.sh -j release
```
#### Linux
If you use CMake directly instead of the build script, pass `-DENABLE_JAVA=OFF` to CMake instead.
### Linux
Make sure you've installed the following dependencies:
- `libglu1-mesa-dev`
- `libc++-dev`
- `libc++-dev` (`libcxx-devel` on Fedora)
- `libc++abi-dev`
- `ninja-build`
In addition your distribution might require:
- `libxi-dev`
Then invoke `cmake`:
```
$ mkdir build-release
$ cd build-release
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../dist-linux ..
$ mkdir out/cmake-release
$ cd out/cmake-release
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..
```
If you experience link errors you must ensure that you are using `libc++abi` by passing this
extra parameter to `cmake`:
```
-DFILAMENT_REQUIRES_CXXABI=true
```
Your Linux distribution might default to `gcc` instead of `clang`, if that's the case invoke
`cmake` with the following command:
```
$ mkdir build-release
$ cd build-release
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../dist-linux ..
$ mkdir out/cmake-release
$ cd out/cmake-release
# Or use a specific version of clang, for instance /usr/bin/clang-5.0
$ CC=/usr/bin/clang CXX=/usr/bin/clang++ \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..
```
And then invoke `ninja`:
You can also export the `CC` and `CXX` environment variables to always point to `clang`. Another
solution is to use `update-alternatives` to both change the default compiler, and point to a
specific version of clang:
```
$ update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
$ update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
$ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 100
$ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 100
```
Finally, invoke `ninja`:
```
$ ninja
@@ -216,7 +258,7 @@ $ ninja
This will build Filament, its tests and samples, and various host tools.
#### macOS
### macOS
To compile Filament you must have the most recent version of Xcode installed and you need to
make sure the command line tools are setup by running:
@@ -236,9 +278,9 @@ export JAVA_HOME="$(/usr/libexec/java_home)"
Then run `cmake` and `ninja` to trigger a build:
```
$ mkdir build-release
$ cd build-release
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../dist-darwin ..
$ mkdir out/cmake-release
$ cd out/cmake-release
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..
$ ninja
```
@@ -252,27 +294,23 @@ Google employees require additional steps which can be found here [go/filawin](h
Install the following components:
- [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)
- [Visual Studio 2015](https://www.visualstudio.com/downloads) (request MSDN membership if
needed)
- [Clang 7 for MSVC](http://prereleases.llvm.org/win-snapshots/LLVM-7.0.0-r323406-win32.exe)
- [Python 3.7](https://www.python.org/ftp/python/3.7.0/python-3.7.0b1.exe)
- [Visual Studio 2015](https://www.visualstudio.com/downloads)
- [Clang 6](http://releases.llvm.org/download.html)
- [Python 3.7](https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe)
- [Git 2.16.1 or later](https://github.com/git-for-windows/git/releases/download/v2.16.1.windows.4/PortableGit-2.16.1.4-64-bit.7z.exe)
- [Cmake 3.4](https://cmake.org/files/v3.11/cmake-3.11.0-rc1-win64-x64.msi)
- [repo](https://storage.googleapis.com/git-repo-downloads/repo), add it to PATH (open the
Control Panel > System and Security > System > Advanced System Settings > Environment variables)
- [Cmake 3.11 or later](https://cmake.org/files/v3.11/cmake-3.11.0-rc1-win64-x64.msi)
Open an x86_64 VS 2015 terminal (click the start button, type "x86" and select:
"x86_64 cross tools command prompt for VS 2015").
Open an VS2015 x64 Native Tools terminal (click the start button, type "x64 native tools" and select: "VS2015 x64 Native Tools Command Prompt").
Create a working directory:
```
> mkdir cmake-windows
> cd cmake-windows
> mkdir out/cmake-release
> cd out/cmake-release
```
Create the msBuild project:
```
> cmake -T"LLVM-vs2014" -G "Visual Studio 14 2015 Win64" ..
> cmake -T"LLVM-vs2014" -G "Visual Studio 14 2015 Win64" ../..
```
Check out the output and make sure Clang for Windows frontend was found. You should see a line
@@ -283,12 +321,12 @@ Clang:C:/Program Files/LLVM/msbuild-bin/cl.exe
You are now ready to build:
```
> msbuild TNT.sln /t:material_sandbox /m /p:configuration=Debug /v:d
> msbuild TNT.sln /t:material_sandbox /m /p:configuration=Debug
```
Run it:
```
> bin\Debug\material_sandbox.exe ..\filament\assets\models\monkey\monkey.obj
> samples\material_sandbox.exe ..\..\assets\models\monkey\monkey.obj
```
#### Tips
@@ -301,6 +339,29 @@ Run it:
- The msBuild project is what is used by Visual Studio behind the scene to build. Building from VS
or from the command-line is the same thing.
#### Building with Ninja on Windows
Alternatively, you can use [Ninja](https://ninja-build.org/) to build for Windows. An MSVC
installation is still necessary.
First, install the dependencies listed under [Windows](#Windows) as well as Ninja. Then open up a
VS2015 x64 Native Tools terminal as before. Create a build directory inside Filament and run the
following CMake command:
```
cmake .. -G Ninja ^
-DCMAKE_CXX_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe" ^
-DCMAKE_C_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe" ^
-DCMAKE_LINKER:PATH="C:\Program Files\LLVM\bin\lld-link.exe" ^
-DCMAKE_BUILD_TYPE=Release
```
You should then be able to build by invoking Ninja:
```
ninja
```
#### Development tips
- Before shipping a binary, make sure you used Release profile and make sure you have no libc/libc++
@@ -313,7 +374,7 @@ Run it:
To confirm Filament was properly built, run the following command from the build directory:
```
./samples/material_sandbox --ibl=../samples/envs/office ../assets/models/sphere/sphere.obj
./samples/material_sandbox --ibl=../../samples/envs/office ../../assets/models/sphere/sphere.obj
```
### Android
@@ -365,10 +426,10 @@ $ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm64 --api 24
Then invoke CMake in a build directory of your choice, inside of filament's directory:
```
$ mkdir android-build-release-aarch64
$ cd android-build-release-aarch64
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../build/toolchain-aarch64-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../dist ..
$ mkdir out/android-build-release-aarch64
$ cd out/android-build-release-aarch64
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../../build/toolchain-aarch64-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../android-release/filament ../..
```
And then invoke `ninja`:
@@ -383,9 +444,9 @@ or
$ ninja install/strip
```
This will generate Filament's Android binaries in `dist`. This location is important to build the
Android Studio projects located in `filament/android`. After install, the library binaries should
be found in `dist/lib/arm64-v8a`.
This will generate Filament's Android binaries in `out/android-release`. This location is important
to build the Android Studio projects located in `filament/android`. After install, the library
binaries should be found in `out/android-release/filament/lib/arm64-v8a`.
#### ARM 32-bit target (armeabi-v7a)
@@ -410,10 +471,10 @@ $ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm --api 24 \
Then invoke CMake in a build directory of your choice, inside of filament's directory:
```
$ mkdir android-build-release-arm
$ cd android-build-release-arm
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../build/toolchain-arm7-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../dist ..
$ mkdir out/android-build-release-arm
$ cd out/android-build-release-arm
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../../build/toolchain-arm7-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../android-release/filament ../..
```
And then invoke `ninja`:
@@ -428,9 +489,9 @@ or
$ ninja install/strip
```
This will generate Filament's Android binaries in `dist`. This location is important to build the
Android Studio projects located in `filament/android`. After install, the library binaries should
be found in `dist/lib/armeabi-v7a`.
This will generate Filament's Android binaries in `out/android-release`. This location is important
to build the Android Studio projects located in `filament/android`. After install, the library
binaries should be found in `out/android-release/filament/lib/armeabi-v7a`.
#### Intel 64-bit target (x86_64)
@@ -455,10 +516,10 @@ $ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86_64 --api 2
Then invoke CMake in a build directory of your choice, sibling of filament's directory:
```
$ mkdir android-build-release-x86_64
$ cd android-build-release-x86_64
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../filament/build/toolchain-x86_64-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../dist ..
$ mkdir out/android-build-release-x86_64
$ cd out/android-build-release-x86_64
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../../filament/build/toolchain-x86_64-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../out/android-release/filament ../..
```
And then invoke `ninja`:
@@ -473,9 +534,9 @@ or
$ ninja install/strip
```
This will generate Filament's Android binaries in `dist`. This location is important to build the
Android Studio projects located in `filament/android`. After install, the library binaries should
be found in `dist/lib/x86_64`.
This will generate Filament's Android binaries in `out/android-release`. This location is important
to build the Android Studio projects located in `filament/android`. After install, the library
binaries should be found in `out/android-release/filament/lib/x86_64`.
#### Intel 32-bit target (x86)
@@ -500,10 +561,10 @@ $ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86 --api 24 \
Then invoke CMake in a build directory of your choice, sibling of filament's directory:
```
$ mkdir android-build-release-x86
$ cd android-build-release-x86
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../filament/build/toolchain-x86-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../dist ..
$ mkdir out/android-build-release-x86
$ cd out/android-build-release-x86
$ cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../../filament/build/toolchain-x86-linux-android.cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../out/android-release/filament ../..
```
And then invoke `ninja`:
@@ -518,12 +579,21 @@ or
$ ninja install/strip
```
This will generate Filament's Android binaries in `dist`. This location is important to build the
Android Studio projects located in `filament/android`. After install, the library binaries should
be found in `dist/lib/x86`.
This will generate Filament's Android binaries in `out/android-release`. This location is important
to build the Android Studio projects located in `filament/android`. After install, the library
binaries should be found in `out/android-release/filament/lib/x86`.
### AAR
Before you attempt to build the AAR, make sure you've compiled and installed the native libraries
as explained in the sections above. You must have the following ABIs built in
`out/android-release/filament/lib/`:
- `arm64-v8a`
- `armeabi-v7a`
- `x86_64`
- `x86`
To build Filament's AAR simply open the Android Studio project in `android/filament-android`. The
AAR is a universal AAR that contains all supported build targets:
@@ -535,6 +605,16 @@ AAR is a universal AAR that contains all supported build targets:
To filter out unneeded ABIs, rely on the `abiFilters` of the project that links against Filament's
AAR.
Alternatively you can build the AAR from the command line by executing the following the
`android/filament-android` directory:
```
$ ./gradlew -Pfilament_dist_dir=../../out/android-release/filament assembleRelease
```
The `-Pfilament_dist_dir` can be used to specify a different installation directory (it must match
the CMake install prefix used in the previous steps).
### Using Filament's AAR
Create a new module in your project and select _Import .JAR or .AAR Package_ when prompted. Make
@@ -585,7 +665,7 @@ generate a `filamesh ` file from an FBX/OBJ asset, run the `filamesh` tool
(`./tools/filamesh/filamesh` in your build directory):
```
filamesh assets/models/monkey/monkey.obj monkey.filamesh
filamesh ./assets/models/monkey/monkey.obj monkey.filamesh
```
Most samples accept an IBL that must be generated using the `cmgen` tool (`./tools/filamesh/cmgen`
@@ -625,7 +705,7 @@ Renderer* renderer = engine->createRenderer();
To render a frame you must then create a `View`, a `Scene` and a `Camera`:
```c++
Camera* = engine->createCamera();
Camera* camera = engine->createCamera();
View* view = engine->createView();
Scene* scene = engine->createScene();
+5 -5
View File
@@ -12,7 +12,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
@@ -25,16 +25,16 @@ allprojects {
apply plugin: 'com.android.library'
def filament_path = file("../../out/release/filament").absolutePath
def filament_path = file("../../out/android-release/filament").absolutePath
if (project.hasProperty("filament_dist_dir")) {
filament_path = file("$filament_dist_dir").absolutePath
}
android {
compileSdkVersion 26
compileSdkVersion 28
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
@@ -81,7 +81,7 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-annotations:27.0.2'
implementation 'com.android.support:support-annotations:27.1.1'
}
group = "com.google.android.filament"
@@ -1,6 +1,6 @@
#Wed Dec 13 19:09:17 PST 2017
#Sun Aug 05 15:12:47 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
@@ -155,6 +155,13 @@ Java_com_google_android_filament_LightManager_nBuilderBuild(JNIEnv *env, jclass
return jboolean(builder->build(*engine, (Entity &) entity) == LightManager::Builder::Success);
}
extern "C" JNIEXPORT jint JNICALL
Java_com_google_android_filament_LightManager_nGetType(JNIEnv* env,
jclass type, jlong nativeLightManager, jint i) {
LightManager *lm = (LightManager *) nativeLightManager;
return (jint)lm->getType((LightManager::Instance) i);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_LightManager_nSetPosition(JNIEnv *env, jclass type,
jlong nativeLightManager, jint i, jfloat x, jfloat y, jfloat z) {
@@ -172,6 +172,11 @@ public class LightManager {
}
}
@NonNull
public Type getType(@EntityInstance int i) {
return Type.values()[nGetType(mNativeObject, i)];
}
public void setPosition(@EntityInstance int i, float x, float y, float z) {
nSetPosition(mNativeObject, i, x, y, z);
}
@@ -283,6 +288,8 @@ public class LightManager {
private static native void nBuilderHaloSize(long nativeBuilder, float haloSize);
private static native void nBuilderHaloFalloff(long nativeBuilder, float haloFalloff);
private static native int nGetType(long nativeLightManager, int i);
private static native void nSetPosition(long nativeLightManager, int i, float x, float y, float z);
private static native void nGetPosition(long nativeLightManager, int i, float[] out);
private static native void nSetDirection(long nativeLightManager, int i, float x, float y, float z);
File diff suppressed because it is too large Load Diff
Binary file not shown.
+34 -1
View File
@@ -34,6 +34,8 @@ function print_help {
echo " Restrict the number of make/ninja jobs."
echo " -t"
echo " Generate the Android toolchain, requires \$ANDROID_HOME to be set."
echo " -u"
echo " Run all unit tests, will trigger a debug build if needed."
echo " -v"
echo " Add Vulkan support to the Android build."
echo ""
@@ -75,6 +77,8 @@ ISSUE_ARCHIVES=false
ISSUE_CMAKE_ALWAYS=false
RUN_TESTS=false
ENABLE_JAVA=ON
INSTALL_COMMAND=
@@ -315,14 +319,35 @@ function validate_build_command {
exit 1
fi
fi
# Make sure we have Java
javac_binary=`which javac`
if [ "$JAVA_HOME" == "" ] || [ ! "$javac_binary" ]; then
echo "Warning: JAVA_HOME is not set, skipping Java projects"
ENABLE_JAVA=OFF
fi
set -e
}
function run_test {
test=$1
# The input string might contain arguments, so we use "set -- $test" to replace $1 with the
# first whitespace-separated token in the string.
set -- $test
test_name=`basename $1`
./out/cmake-debug/$test --gtest_output="xml:out/test-results/$test_name/sponge_log.xml"
}
function run_tests {
while read test; do
run_test "$test"
done < build/common/test_list.txt
}
# Beginning of the script
pushd `dirname $0` > /dev/null
while getopts ":hacfijmp:tv" opt; do
while getopts ":hacfijmp:tuv" opt; do
case ${opt} in
h)
print_help
@@ -367,6 +392,10 @@ while getopts ":hacfijmp:tv" opt; do
t)
GENERATE_TOOLCHAINS=true
;;
u)
ISSUE_DEBUG_BUILD=true
RUN_TESTS=true
;;
v)
VULKAN_ANDROID_OPTION="-DFILAMENT_SUPPORTS_VULKAN=ON"
echo "Enabling support for Vulkan in the core Filament library."
@@ -426,3 +455,7 @@ fi
if [ "$ISSUE_ANDROID_BUILD" == "true" ]; then
build_android
fi
if [ "$RUN_TESTS" == "true" ]; then
run_tests
fi
+4 -1
View File
@@ -18,10 +18,13 @@ LC_UNAME=`echo $UNAME | tr '[:upper:]' '[:lower:]'`
# $GENERATE_ARCHIVES
# $BUILD_DEBUG
# $BUILD_RELEASE
source `dirname $0`/../common/ci-common.sh
if [ "$LC_UNAME" == "linux" ]; then
source `dirname $0`/../linux/ci-common.sh
elif [ "$LC_UNAME" == "darwin" ]; then
source `dirname $0`/../mac/ci-common.sh
fi
source `dirname $0`/../linux/build-common.sh
source `dirname $0`/../common/build-common.sh
pushd `dirname $0`/../.. > /dev/null
./build.sh -p android -c $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE
+4 -3
View File
@@ -2,8 +2,9 @@
action {
define_artifacts {
regex: "git/filament/out/*.tgz"
regex: "git/filament/out/*.aar"
strip_prefix: "git/filament/out"
regex: "github/filament/out/*.tgz"
regex: "github/filament/out/*.aar"
strip_prefix: "github/filament/out"
regex: "**/*sponge_log.xml"
}
}
@@ -13,6 +13,7 @@ echo "Building $TARGET target"
BUILD_DEBUG=
BUILD_RELEASE=
GENERATE_ARCHIVES=
RUN_TESTS=
if [ "$TARGET" == "presubmit" ]; then
BUILD_RELEASE=release
@@ -32,4 +33,5 @@ if [ "$TARGET" == "continuous" ]; then
BUILD_DEBUG=debug
BUILD_RELEASE=release
GENERATE_ARCHIVES=-a
RUN_TESTS=-u
fi
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
if [ "$KOKORO_BUILD_ID" ]; then
echo "Running job $KOKORO_JOB_NAME"
TARGET=`echo "$KOKORO_JOB_NAME" | awk -F "/" '{print $NF}'`
fi
+7
View File
@@ -0,0 +1,7 @@
filament/test/test_filament --gtest_filter=-FilamentTest.FroxelData
filament/test/test_filament_exposure --gtest_filter=-FilamentExposureWithEngineTest.SetExposure:FilamentExposureWithEngineTest.ComputeEV100
libs/math/test_math
libs/image/test_image compare libs/image/tests/reference/
libs/utils/test_utils
tools/matc/test_matc
tools/cmgen/test_cmgen compare
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+3 -2
View File
@@ -15,8 +15,9 @@ set -x
# $GENERATE_ARCHIVES
# $BUILD_DEBUG
# $BUILD_RELEASE
source `dirname $0`/../common/ci-common.sh
source `dirname $0`/ci-common.sh
source `dirname $0`/build-common.sh
source `dirname $0`/../common/build-common.sh
pushd `dirname $0`/../.. > /dev/null
./build.sh -c $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE
./build.sh -c $RUN_TESTS $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE
Regular → Executable
-3
View File
@@ -9,9 +9,6 @@ CXX_VERSION=5.0.2
# CI runs on Ubuntu 14.04, we need to install clang-5.0 and th
# appropriate libc++ ourselves
if [ "$KOKORO_BUILD_ID" ]; then
echo "Running job $KOKORO_JOB_NAME"
TARGET=`echo "$KOKORO_JOB_NAME" | awk -F "/" '{print $NF}'`
sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm
sudo apt-add-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-$CLANG_VERSION main"
+4 -3
View File
@@ -2,8 +2,9 @@
action {
define_artifacts {
regex: "git/filament/out/*.tgz"
regex: "git/filament/out/*.aar"
strip_prefix: "git/filament/out"
regex: "github/filament/out/*.tgz"
regex: "github/filament/out/*.aar"
strip_prefix: "github/filament/out"
regex: "**/*sponge_log.xml"
}
}
+4 -7
View File
@@ -11,12 +11,9 @@
set -e
set -x
curl -OL https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
unzip -q ninja-mac.zip
chmod +x ninja
export PATH="$PWD:$PATH"
source `dirname $0`/../linux/build-common.sh
source `dirname $0`/../common/ci-common.sh
source `dirname $0`/ci-common.sh
source `dirname $0`/../common/build-common.sh
pushd `dirname $0`/../.. > /dev/null
./build.sh -c $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE
./build.sh -c $RUN_TESTS $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
curl -OL https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
unzip -q ninja-mac.zip
chmod +x ninja
export PATH="$PWD:$PATH"
+4 -3
View File
@@ -2,8 +2,9 @@
action {
define_artifacts {
regex: "git/filament/out/*.tgz"
regex: "git/filament/out/*.aar"
strip_prefix: "git/filament/out"
regex: "github/filament/out/*.tgz"
regex: "github/filament/out/*.aar"
strip_prefix: "github/filament/out"
regex: "**/*sponge_log.xml"
}
}
+43
View File
@@ -0,0 +1,43 @@
@echo off
:: Install build dependencies
call %~dp0ci-common.bat
if errorlevel 1 exit /b %errorlevel%
:: Put Visual Studio tools on the PATH
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
if errorlevel 1 exit /b %errorlevel%
:: Ensure that the necessary build tools are on the PATH
call %~dp0validate-build-dependencies.bat
if errorlevel 1 exit /b %errorlevel%
ninja --version
clang-cl --version
lld-link --version
cmake --version
cd github\filament
mkdir out\cmake-release
cd out\cmake-release
if errorlevel 1 exit /b %errorlevel%
cmake ..\.. -G Ninja ^
-DCMAKE_CXX_COMPILER:PATH="clang-cl.exe" ^
-DCMAKE_C_COMPILER:PATH="clang-cl.exe" ^
-DCMAKE_LINKER:PATH="lld-link.exe" ^
-DCMAKE_BUILD_TYPE=Release
if errorlevel 1 exit /b %errorlevel%
ninja
if errorlevel 1 exit /b %errorlevel%
ninja install
if errorlevel 1 exit /b %errorlevel%
:: Create an archive
dir .\install
7z a -ttar -so ..\filament-release.tar .\install\* | 7z a -si ..\filament-windows.tgz
echo Done!
+9
View File
@@ -0,0 +1,9 @@
if defined KOKORO_BUILD_ID (
choco install llvm --version 6.0.1 -y
if errorlevel 1 exit /b %errorlevel%
:: refreshenv is necessary to put LLVM on path
refreshenv
)
exit /b 0
+10
View File
@@ -0,0 +1,10 @@
# Format: //devtools/kokoro/config/proto/build.proto
action {
define_artifacts {
regex: "github/filament/out/*.tgz"
regex: "github/filament/out/*.aar"
strip_prefix: "github/filament/out"
regex: "**/*sponge_log.xml"
}
}
+3
View File
@@ -0,0 +1,3 @@
# Format: //devtools/kokoro/config/proto/build.proto
build_file: "filament/build/windows/build.bat"
+3
View File
@@ -0,0 +1,3 @@
# Format: //devtools/kokoro/config/proto/build.proto
build_file: "filament/build/windows/build.bat"
+3
View File
@@ -0,0 +1,3 @@
# Format: //devtools/kokoro/config/proto/build.proto
build_file: "filament/build/windows/build.bat"
@@ -0,0 +1,36 @@
@echo off
:: Check that rc.exe is available on PATH
where rc 1>NUL 2>&1
if errorlevel 1 (
echo Error: could not find rc, exiting
exit /b 1
)
:: Check that Clang is installed
where clang-cl 1>NUL 2>&1
if errorlevel 1 (
echo Error: could not find clang-cl, exiting
exit /b 1
)
where lld-link 1>NUL 2>&1
if errorlevel 1 (
echo Error: could not find lld-link, exiting
exit /b 1
)
:: Check that Ninja is installed
where ninja 1>NUL 2>&1
if errorlevel 1 (
echo Error: could not find ninja, exiting
exit /b 1
)
:: Check that CMake is installed
where cmake 1>NUL 2>&1
if errorlevel 1 (
echo Error: could not find cmake, exiting
exit /b 1
)
exit /b 0
+727 -94
View File
File diff suppressed because it is too large Load Diff
+44 -20
View File
@@ -2,11 +2,16 @@
<style>img { max-width: 100%; }</style>
**Filament Materials**
Crafting physically-based materials
![](images/filament_logo.png)
# About
This document is part of the [Filament project](https://github.com/google/filament). To report errors in this document please use the [project's issue tracker](https://github.com/google/filament/issues).
## Authors
- [Romain Guy](https://github.com/romainguy), [@romainguy](https://twitter.com/romainguy)
# Overview
Filament is a physically based rendering (PBR) engine for Android. Filament offers a customizable
@@ -78,6 +83,7 @@ in table [standardProperties].
**anisotropyDirection** | Local surface direction
**ambientOcclusion** | Defines how much of the ambient light is accessible to a surface point. It is a per-pixel shadowing factor between 0.0 and 1.0
**normal** | A detail normal used to perturb the surface using _bump mapping_ (_normal mapping_)
**clearCoatNormal** | A detail normal used to perturb the clear coat layer using _bump mapping_ (_normal mapping_)
**emissive** | Additional diffuse albedo to simulate emissive surfaces (such as neons, etc.) This property is mostly useful in an HDR pipeline with a bloom pass
[Table [standardProperties]: Properties of the standard model]
@@ -95,6 +101,7 @@ The type and range of each property is described in table [standardPropertiesTyp
**anisotropyDirection** | float3 | [0..1] | Linear RGB, encodes a direction vector in tangent space
**ambientOcclusion** | float | [0..1] |
**normal** | float3 | [0..1] | Linear RGB, encodes a direction vector in tangent space
**clearCoatNormal** | float3 | [0..1] | Linear RGB, encodes a direction vector in tangent space
**emissive** | float4 | rgb=[0..1], a=[-n..n] | Alpha is the exposure compensation
[Table [standardPropertiesTypes]: Range and type of the standard model's properties]
@@ -139,14 +146,14 @@ Metals (conductors)
Metal | sRGB | Hexadecimal | Color
----------:|:-------------------:|:------------:|-------------------------------------------------------
Silver | 0.98, 0.98, 0.96 | #faf9f5 | <div style="background-color: #faf9f5; width: 60px">&nbsp;</div>
Aluminum | 0.96, 0.96, 0.96 | #f4f5f5 | <div style="background-color: #f4f5f5; width: 60px">&nbsp;</div>
Titanium | 0.81, 0.78, 0.76 | #cec8c2 | <div style="background-color: #cec8c2; width: 60px">&nbsp;</div>
Iron | 0.76, 0.74, 0.73 | #c0bdba | <div style="background-color: #c0bdba; width: 60px">&nbsp;</div>
Platinum | 0.84, 0.82, 0.79 | #d6d1c8 | <div style="background-color: #d6d1c8; width: 60px">&nbsp;</div>
Gold | 1.00, 0.87, 0.62 | #fedc9d | <div style="background-color: #fedc9d; width: 60px">&nbsp;</div>
Brass | 0.96, 0.89, 0.68 | #f4e4ad | <div style="background-color: #f4e4ad; width: 60px">&nbsp;</div>
Copper | 0.98, 0.85, 0.72 | #fbd8b8 | <div style="background-color: #fbd8b8; width: 60px">&nbsp;</div>
Silver | 0.97, 0.96, 0.91 | #f7f4e8 | <div style="background-color: #faf9f5; width: 60px">&nbsp;</div>
Aluminum | 0.91, 0.92, 0.92 | #e8eaea | <div style="background-color: #f4f5f5; width: 60px">&nbsp;</div>
Titanium | 0.76, 0.73, 0.69 | #c1baaf | <div style="background-color: #cec8c2; width: 60px">&nbsp;</div>
Iron | 0.77, 0.78, 0.78 | #c4c6c6 | <div style="background-color: #c0bdba; width: 60px">&nbsp;</div>
Platinum | 0.83, 0.81, 0.78 | #d3cec6 | <div style="background-color: #d6d1c8; width: 60px">&nbsp;</div>
Gold | 1.00, 0.85, 0.57 | #ffd891 | <div style="background-color: #fedc9d; width: 60px">&nbsp;</div>
Brass | 0.98, 0.90, 0.59 | #f9e596 | <div style="background-color: #f4e4ad; width: 60px">&nbsp;</div>
Copper | 0.97, 0.74, 0.62 | #f7bc9e | <div style="background-color: #fbd8b8; width: 60px">&nbsp;</div>
[Table [baseColorsConductors]: `baseColor` for common metals]
### Metallic
@@ -212,14 +219,19 @@ Table [commonMatReflectance] describes acceptable reflectance values for various
(no real world material has a value under 2%).
Material | Reflectance | Property value
--------------------------:|:---------------------:|:------------------
Glass | 3.5% | 0.46
Water | 2% | 0.35
Common liquids | 2% to 4% | 0.35 to 0.5
Common gemstones | 8% to 16% | 0.70 to 1.0
Other dielectric materials | 2% to 5% | 0.35 to 0.56
Default value | 4% | 0.50
Material | Reflectance | Property value
--------------------------:|:-----------------|:----------------
Water | 2% | 0.35
Fabric | 4% to 5.6% | 0.5 to 0.59
Common liquids | 2% to 4% | 0.35 to 0.5
Common gemstones | 5% to 16% | 0.56 to 1.0
Plastics, glass | 4% to 5% | 0.5 to 0.56
Other dielectric materials | 2% to 5% | 0.35 to 0.56
Eyes | 2.5% | 0.39
Skin | 2.8% | 0.42
Hair | 4.6% | 0.54
Teeth | 5.8% | 0.6
Default value | 4% | 0.5
[Table [commonMatReflectance]: Reflectance of common materials]
### Clear coat
@@ -331,6 +343,17 @@ and with (right)](images/screenshot_normal_mapping.jpg)
!!! Warning
Using a normal map increases the runtime cost of the material model.
### Clear coat normal
The `clearCoatNormal` property defines the normal of the clear coat layer at a given point. It
behaves otherwise like the `normal` property.
![Figure [clearCoatNormalMapped]: A material with a clear coat normal
map and a surface normal map](images/screenshot_clear_coat_normal.jpg)
!!! Warning
Using a clear coat normal map increases the runtime cost of the material model.
### Emissive
@@ -1234,6 +1257,7 @@ struct MaterialInputs {
// not available when the shading model is subsurface or cloth
float clearCoat; // default: 1.0
float clearCoatRoughness; // default: 0.0
float3 clearCoatNormal; // default: float3(0.0, 0.0, 1.0)
float anisotropy; // default: 0.0
float3 anisotropyDirection; // default: float3(1.0, 0.0, 0.0)
@@ -1516,4 +1540,4 @@ pre-multiplied ahead of time. On Android, any texture uploaded from a
[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html) will be
pre-multiplied by default.
<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="js/markdeep.min.js"></script><script src="https://casual-effects.com/markdeep/latest/markdeep.min.js"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>
<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="../third_party/markdeep/markdeep.min.js"></script><script src="https://casual-effects.com/markdeep/latest/markdeep.min.js"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 236 KiB

View File

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 199 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 158 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 322 KiB

After

Width:  |  Height:  |  Size: 322 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

Before

Width:  |  Height:  |  Size: 461 KiB

After

Width:  |  Height:  |  Size: 461 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 320 KiB

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 452 KiB

After

Width:  |  Height:  |  Size: 452 KiB

Executable → Regular
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 324 KiB

View File

Before

Width:  |  Height:  |  Size: 562 KiB

After

Width:  |  Height:  |  Size: 562 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 KiB

After

Width:  |  Height:  |  Size: 308 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 KiB

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

View File

Before

Width:  |  Height:  |  Size: 354 KiB

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 588 KiB

After

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View File

Before

Width:  |  Height:  |  Size: 312 KiB

After

Width:  |  Height:  |  Size: 312 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 236 KiB

View File

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 269 KiB

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 KiB

Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 269 KiB

After

Width:  |  Height:  |  Size: 269 KiB

Executable → Regular
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 298 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

Before

Width:  |  Height:  |  Size: 342 KiB

After

Width:  |  Height:  |  Size: 342 KiB

View File

Before

Width:  |  Height:  |  Size: 453 KiB

After

Width:  |  Height:  |  Size: 453 KiB

Some files were not shown because too many files have changed in this diff Show More