There are now only 2 main commandTypeFlags, COLOR and DEPTH, indicating if we need to generate respectively COLOR and DEPTH commands. The command generation code, only has 3 implementations: DEPTH, COLOR and DEPTH + COLOR. We also add "options" flags that get passed along, used to control what goes into the the depth pass -- this because sometimes we don't want translucent or alpha masked objects. e.g. when rendering the shadow pass, we want the DEPTH + shadow casters regardless of if they're translucent. With this, we can fix a SSAO problem where alpha-masked objects where not participating when the depth pre-pass was used. Now, we add those objects to the DEPTH if SSAO is active and MSAA is not.
Filament
This package contains several executables and libraries you can use to build applications using Filament. Latest versions are available on the project page.
Binaries
cmgen, Image-based lighting asset generatorfilamesh, Mesh convertermatc, Material compilermatinfo, Displays information about materials compiled withmatcmipgen, Generates a series of miplevels from a source image.normal-blending, Tool to blend normal mapsroughness-prefilter, Pre-filters a roughness map from a normal map to reduce aliasingskygen, Physically-based sky environment texture generatorspecular-color, Computes the specular color of conductors based on spectral data
You can refer to the individual documentation files in docs/ for more information.
Libraries
Filament is distributed as a set of static libraries you must link against:
backend, Required, implements all backendsbluegl, Required to render with OpenGL or OpenGL ESbluevk, Required to render with Vulkanfilabridge, Support library for Filamentfilaflat, Support library for Filamentfilament, Main Filament librarybackend, Filament render backend libraryutils, Support library for Filamentgeometry, Geometry helper library for Filamentsmol-v, SPIR-V compression library
To use Filament from Java you must use the following two libraries instead:
filament-java.jar, Contains Filament's Java classesfilament-jni, Filament's JNI bindings
To use the Vulkan backend on macOS you must also make the following libraries available at runtime:
MoltenVK_icd.jsonlibMoltenVK.dylibvulkan.1.dylib
Linking against Filament
This walkthrough will get you successfully compiling and linking native code against Filament with minimum dependencies.
To start, download Filament's latest binary release
and extract into a directory of your choosing. Binary releases are suffixed
with the platform name, for example, filament-20181009-linux.tgz.
Create a file, main.cpp, in the same directory with the following contents:
#include <filament/FilamentAPI.h>
#include <filament/Engine.h>
using namespace filament;
int main(int argc, char** argv)
{
Engine *engine = Engine::create();
engine->destroy(&engine);
return 0;
}
The directory should look like:
|-- README.md
|-- bin
|-- docs
|-- include
|-- lib
|-- main.cpp
We'll use a platform-specific Makefile to compile and link main.cpp with Filament's libraries.
Copy your platform's Makefile below into a Makefile inside the same directory.
Linux
FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v
CC=clang++
main: main.o
$(CC) -Llib/x86_64/ main.o $(FILAMENT_LIBS) -lpthread -lc++ -ldl -o main
main.o: main.cpp
$(CC) -Iinclude/ -std=c++14 -pthread -c main.cpp
clean:
rm -f main main.o
.PHONY: clean
macOS
FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v
FRAMEWORKS=-framework Cocoa -framework Metal
CC=clang++
main: main.o
$(CC) -Llib/x86_64/ main.o $(FILAMENT_LIBS) $(FRAMEWORKS) -o main
main.o: main.cpp
$(CC) -Iinclude/ -std=c++14 -c main.cpp
clean:
rm -f main main.o
.PHONY: clean
Windows
Note that the static libraries distributed for Windows include several
variants: mt, md, mtd, mdd. These correspond to the run-time library
flags
/MT, /MD, /MTd, and /MDd, respectively. Here we use the mt variant.
When building Filament from source, the USE_STATIC_CRT CMake option can be
used to change the run-time library version.
FILAMENT_LIBS=lib/x86_64/mt/filament.lib lib/x86_64/mt/backend.lib lib/x86_64/mt/bluegl.lib \
lib/x86_64/mt/filabridge.lib lib/x86_64/mt/filaflat.lib lib/x86_64/mt/utils.lib \
lib/x86_64/mt/geometry.lib lib/x86_64/mt/smol-v.lib
CC=clang-cl.exe
main.exe: main.obj
$(CC) main.obj $(FILAMENT_LIBS) gdi32.lib user32.lib opengl32.lib
main.obj: main.cpp
$(CC) /MT /Iinclude/ /std:c++14 /c main.cpp
clean:
del main.exe main.obj
.PHONY: clean
Compiling
You should be able to invoke make and run the executable successfully:
$ make
$ ./main
FEngine (64 bits) created at 0x106471000 (threading is enabled)
On Windows, you'll need to open up a Visual Studio Native Tools Command Prompt
and invoke nmake instead of make.
Generating C++ documentation
To generate the documentation you must first install doxygen and graphviz, then run the
following commands:
$ cd filament/filament
$ doxygen docs/doxygen/filament.doxygen
Finally simply open docs/html/index.html in your web browser.