profile
viewpoint
Romain Guy romainguy Google California https://www.curious-creature.com Android UI and graphics engineer at Google.

google/filament 8553

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS and WASM/WebGL

android/android-ktx 7559

A set of Kotlin extensions for Android app development.

romainguy/ViewServer 2491

Local server for Android's HierarchyViewer

romainguy/road-trip 1479

A sample Android application that demonstrates how to implement various visual effects.

romainguy/google-io-2014 1288

Demo for the Material Witness talk I gave at Google I/O.

BinomialLLC/basis_universal 1251

Basis Universal GPU Texture Codec

romainguy/elegant-underline 821

Exploring possible implementations for better underline text decoration on Android

romainguy/kotlin-math 514

Set of Kotlin APIs to make graphics math easier to write

romainguy/filthy-rich-clients 124

Samples for the book Filthy Rich Clients

issue commentgoogle/filament

Windows build fails with MSVC 2017 nmake

Don't we require msvc 2019 anyway for proper C++14/17 support?

joelmcallister

comment created time in a few seconds

pull request commentgoogle/filament

SSAO improvements

Build error on msvc:

D:\a\filament\filament\android\filament-android\src\main\cpp\View.cpp(243,13): error C7560: 'power': designators must appear in member declaration order of class 'filament::View::AmbientOcclusionOptions' [D:\a\filament\filament\out\cmake-mt\java\filament\filament-jni.vcxproj]
pixelflinger

comment created time in 4 minutes

issue commentgoogle/filament

Customized transform of vertex in vertexShader

-g disables Filament's offline optimizer. It would be good to verify whether the issue is on our side in spirv-opt or in the Nvidia drivers.

Realitian

comment created time in 7 minutes

pull request commentjkuhlmann/cgltf

Add support for KHR_draco_mesh_compression

Done!

romainguy

comment created time in 2 hours

push eventromainguy/cgltf

Romain Guy

commit sha 739354f51fcd563b9234c40bcf85568453611e63

Convert more spaces to tabs

view details

push time in 2 hours

push eventromainguy/cgltf

Romain Guy

commit sha 7a16cba1b31e9009c4e47ccf5dd76b0e49ac6735

Convert spaces to tabs

view details

push time in 2 hours

Pull request review commentgoogle/filament

Misc Android fixes, add gradle flavor for gltfio-lite.

 POM_NAME=Filament glTF Loader-POM_ARTIFACT_ID=gltfio-android+POM_ARTIFACT_ID_FULL=gltfio-android-full

This changing the name of the Maven artifact. Can you update the root README?

prideout

comment created time in 2 hours

Pull request review commentgoogle/filament

Misc Android fixes, add gradle flavor for gltfio-lite.

 include_directories(${FILAMENT_DIR}/include         ..         ../../libs/utils/include) +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-stack-protector")

This reminds me we should really switch all of our CMake files to the proper way of setting compiler flags. This is the old hacky way.

prideout

comment created time in 2 hours

pull request commentjkuhlmann/cgltf

Add support for KHR_draco_mesh_compression

I forgot to mention that I tested the change with test_write on official gltf samples that use Draco compression.

romainguy

comment created time in 14 hours

pull request commentjkuhlmann/cgltf

Add support for KHR_draco_mesh_compression

That is correct, decompression is still up to the client app. Where would you like me to document this?

romainguy

comment created time in 18 hours

push eventromainguy/cgltf

Romain Guy

commit sha a0bbdf07f0ea72ad5f4d0dff6bbf3946880a4523

Remove debug statement

view details

push time in 20 hours

PR opened jkuhlmann/cgltf

Add support for `KHR_draco_mesh_compression`

This change adds support to read and write glTF files that use the KHR_draco_mesh_compression extension. The extension can be specified per primitive, which is why cgltf_primitive now has 2 new fields: has_draco_mesh_compression and draco_mesh_compression. draco_mesh_compression contains a buffer view and a list of attributes.

It is important to note that the extension may or may not be required. A primitive can specify both compressed and uncompressed data. While this doesn't affect the parsing, it does affect the writing since the proper extensionsUsed/Required needs to be specified. To achieve this, this change adds support for required extensions in cgltf_write.h (see required_extensions_flag in cgltf_context). The extension is deemed required when a primitive has no attributes or no indices.

Please refer to the extension spec.

+131 -16

0 comment

2 changed files

pr created time in 20 hours

create barnchromainguy/cgltf

branch : rg/draco_mesh_compression

created branch time in 20 hours

push eventromainguy/cgltf

Romain Guy

commit sha 5afc4d2445bec58e31acb3757ce3e57330537c16

Add support for CLion intelliense to cgltf_write.h

view details

push time in 21 hours

PR opened jkuhlmann/cgltf

Add intellisense support in CLion

When INTELLISENSE is defined, cgltf.h turns on CGLTF_IMPLEMENTATION to enable code completion, etc. in MSVC. This change does the same for JetBrain's CLion.

+2 -2

0 comment

1 changed file

pr created time in a day

create barnchromainguy/cgltf

branch : rg/intellisense

created branch time in a day

fork romainguy/cgltf

:diamond_shape_with_a_dot_inside: Single-file glTF 2.0 loader and writer written in C99

fork in a day

issue closedgoogle/filament

`build.sh` errors out on mac when using `ninja`.

Describe the bug When I try to follow the build instructions on mac, build.sh errors out.


**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.

closed time in a day

kanawish

issue commentgoogle/filament

`build.sh` errors out on mac when using `ninja`.

What errors are you getting? Was this due to the CMake version?

kanawish

comment created time in a day

issue commentgoogle/filament

Any way to share depth texture on different render passes?

@pixelflinger

geroge-d

comment created time in a day

Pull request review commentgoogle/filament

Introduce gltfio-lite.

 Material* UbershaderLoader::getMaterial(const MaterialKey& config) const {     }     switch (matindex) {         case MATINDEX(LIT, AlphaMode::OPAQUE): mMaterials[matindex] = CREATE_MATERIAL(LIT_OPAQUE); break;+        #if !GLTFIO_LITE         case MATINDEX(LIT, AlphaMode::MASK): mMaterials[matindex] = CREATE_MATERIAL(LIT_MASKED); break;         case MATINDEX(LIT, AlphaMode::BLEND): mMaterials[matindex] = CREATE_MATERIAL(LIT_FADE); break;

Shouldn't we at least keep blend? Without it transparents won't work and they're fairly common in glTF files. I think it's ok to ditch masked

prideout

comment created time in 5 days

push eventgoogle/filament

Romain Guy

commit sha 5e6ff5a44f0580d05fdb90457cb141d097b6c1d9

Update to a more recent version of AGP

view details

push time in 5 days

Pull request review commentgoogle/filament

Reduce size of gltfio for Android.

 LIBFILAMENT {-  global: Java_com_google_android_filament_*; JNI*;+  global: *filament*; JNI*;

How much does this increase the base filament library?

prideout

comment created time in 5 days

pull request commentgoogle/filament

Reduce size of gltfio for Android.

Are there variants we can strip out of the materials? matc lets you do that.

prideout

comment created time in 5 days

push eventgoogle/filament

Romain Guy

commit sha a4e4021950bcd06bde0e47dc43c3bb6824621441

Update README.md

view details

push time in 6 days

issue commentgoogle/filament

Compilation failure of filament Android library on macOS

One last thing to try: rm -rf ~/.gradle

rawnsley

comment created time in 6 days

Pull request review commentgoogle/filament

Some refactoring to prep for using BitmapFactory.

 target_sources(gltf-resources PRIVATE ${RESGEN_SOURCE}) # Common library # ================================================================================================== -set(APP_LIBS filament sdl2 stb math filamat utils getopt imgui filagui image camutils common-resources)+# We include gltfio in all desktop samples even if they don't use GLTF because the IBL loader needs STB.++set(APP_LIBS filament sdl2 stb math filamat utils getopt imgui filagui image camutils gltfio common-resources)

It is unfortunate to force all samples to link against gltfio though. Couldn't non-glTF samples link against an implementation of STB that's not in gltfio? Should we just switch the samples to libimage?

prideout

comment created time in 6 days

issue commentgoogle/filament

Compilation failure of filament Android library on macOS

The only place where we check this property is properly guarded:

        if (project.hasProperty("filament_tools_dir")) {
            project.ext.filamentToolsPath = project.file("$filament_tools_dir")
        }

Your build logs also mention a missing compileSdkVersion but it is present in the gradle file.

What version of Filament are you trying to build? Would you mind trying a brand new checkout?

rawnsley

comment created time in 6 days

issue commentgoogle/filament

Compilation failure of filament Android library on macOS

Make sure you have Android Studio 3.6 and do a clean build first (build.sh -c).

rawnsley

comment created time in 6 days

issue commentgoogle/filament

How to extend shader in real time?

Use the cmgen tool that’s in Filament’s tree. Use —help to see which option to use to generate the DFG LUT. Unity probably already has its own DFG LUT though so I’m not sure how useful that is.

2080717101

comment created time in 7 days

issue commentgoogle/filament

How to extend shader in real time?

I don’t understand what you are trying to do. Are you trying to use unity’s LUT in Filament? We generate our LUT with our custom tool called cmgen.

2080717101

comment created time in 7 days

Pull request review commentgoogle/filament

New mathfwd.h header

  #include "common/NioUtils.h" +#include <algorithm>

SGTM

pixelflinger

comment created time in 7 days

Pull request review commentgoogle/filament

New mathfwd.h header

 class UTILS_PUBLIC Camera : public FilamentAPI {      */     void lookAt(const math::float3& eye,                 const math::float3& center,-                const math::float3& up = { 0, 1, 0 }) noexcept;+                const math::float3& up) noexcept;++    /** Sets the camera's view matrix, assuming up is along the y axis+     *+     * @param eye       The position of the camera in world space.+     * @param center    The point in world space the camera is looking at.+     */+    void lookAt(const math::float3& eye,

That's technically an API breakage (I'm ok with it, just making sure it's expected).

pixelflinger

comment created time in 7 days

pull request commentgoogle/filament

Clamp viewport width to prevent floating point exception.

Can we also just tell SDL what is the minimum size for the window? It doesn't really make sense to let users shrink the window to the point you can't see the viewport and only part of the sidebar.

prideout

comment created time in 7 days

push eventgoogle/filament

Romain Guy

commit sha d2287f584a792059ada5221c30e96e0af1d498c0

Fix comment

view details

push time in 8 days

pull request commentgoogle/filament

gltfio: remove locale.cpp dependency

We should remove <regex>

prideout

comment created time in 8 days

Pull request review commentgoogle/filament

gltfio: remove locale.cpp dependency

 struct ResourceConfiguration {      //! Optional path or URI that points to the base glTF file. This is used solely     //! to resolve relative paths.-    utils::Path gltfPath;+    std::string gltfPath;

No STL in public headers!

prideout

comment created time in 8 days

push eventgoogle/filament

Romain Guy

commit sha 6b48491ec6838d28253c4f65a2bb6e07fc254812

Save a couple of mul

view details

push time in 8 days

Pull request review commentgoogle/filament

Add a threshold option (enabled by default) for bloom.

 class UTILS_PUBLIC View : public FilamentAPI {         float anamorphism = 1.0f;                //!< Bloom x/y aspect-ratio (1/32 to 32)         uint8_t levels = 6;                      //!< number of blur levels (3 to 12)         BlendMode blendMode = BlendMode::ADD;    //!< How the bloom effect is applied+        bool threshold = true;                   //!< Whether to threshold the source

Do we really want to enable this by default? Grmbl grmbl

pixelflinger

comment created time in 8 days

Pull request review commentgoogle/filament

Implement a Bloom post-process effect

 fragment {         return texelFetch(materialParams_colorBuffer, uv, 0);     } -    vec4 resolve() {+    vec4 resolve(inout PostProcessInputs postProcess) {

Remove inout PostProcessInputs postProcess

pixelflinger

comment created time in 9 days

Pull request review commentgoogle/filament

Implement a Bloom post-process effect

         public float intensity = 1.0f;     } +    /**+     * Options for controlling the Bloom effect+     * @see setBloomOptions+     */+    public static class BloomOptions {++        public enum BlendingMode {+            ADD,+            INTERPOLATE+        }++        /**+         * Strength of the bloom effect, between 0.0 and 1.0+         */+        public float strength = 0.10f;++        /**+         * Resolution of minor axis (2^levels to 4096)+         */+        public int resolution = 360;++        /**+         * Bloom x/y aspect-ratio (1/32 to 32)+         */+        public float anamorphism = 1.0f;++        /**+         * Number of blur levels (3 to 12)+         */+        public int levels = 6;++        /**+         * How the bloom effect is applied+         */+        public BlendingMode blendingMode = BlendingMode.ADD;+        /**

Add empty line, capitalize comment

pixelflinger

comment created time in 9 days

Pull request review commentgoogle/filament

Implement a Bloom post-process effect

 fragment { #else         vec4 color = resolveAlphaFragment(ivec2(getUV()));         color.rgb /= color.a + FLT_EPS;+        if (materialParams.bloom.x > 0.0) {+            color.rgb  = bloom(postProcess, color.rgb);

nit: 1

pixelflinger

comment created time in 9 days

Pull request review commentgoogle/filament

Implement a Bloom post-process effect

 fragment {         return texelFetch(materialParams_colorBuffer, uv, 0);     } -    vec4 resolve() {+    vec4 resolve(inout PostProcessInputs postProcess) { #if POST_PROCESS_OPAQUE         vec4 color = vec4(resolveFragment(ivec2(getUV())), 1.0);+        if (materialParams.bloom.x > 0.0) {+            color.rgb  = bloom(postProcess, color.rgb);

nit: 2 spaces instead of 1

pixelflinger

comment created time in 9 days

Pull request review commentgoogle/filament

Implement a Bloom post-process effect

+//------------------------------------------------------------------------------+// Bloom+//------------------------------------------------------------------------------++vec3 bloom(inout PostProcessInputs postProcess, const vec3 color) {

REmove inout PostProcessInputs postProcess

pixelflinger

comment created time in 9 days

issue commentgoogle/filament

Jagged Shadows: advice on shadows for large scene?

Sorry I meant you want a shadowFar and a shadowFarHint that are closer to the camera. Otherwise just make sure your bounding boxes are as tight as possible.

roxlu

comment created time in 9 days

issue closedgoogle/filament

Jagged Shadows: advice on shadows for large scene?

I've got a scene that I created in Blender. The scene fits inside a box a box of about 1500m in Blender Units. When I render this scene with Filament the shadows are jagged. I've seen the ShadowOptions in LightManager.h but I'm not sure what properties will be good for a scene like this. Any advice on what properties I might want to try?

image

image

image

The ShadowOptions:

     */
    struct ShadowOptions {
        /** Size of the shadow map in texels. Must be a power-of-two. */
        uint32_t mapSize = 1024;

        /** Constant bias in world units (e.g. meters) by which shadows are moved away from the
         * light. 1mm by default.
         */
        float constantBias = 0.001f;

        /** Amount by which the maximum sampling error is scaled. The resulting value is used
         * to move the shadow away from the fragment normal. Should be 1.0.
         */
        float normalBias = 1.0f;

        /** Distance from the camera after which shadows are clipped. this is used to clip
         * shadows that are too far and wouldn't contribute to the scene much, improving
         * performance and quality. This value is always positive.
         * Use 0.0f to use the camera far distance.
         */
        float shadowFar = 0.0f;

        /** Optimize the quality of shadows from this distance from the camera. Shadows will
         * be rendered in front of this distance, but the quality may not be optimal.
         * This value is always positive. Use 0.0f to use the camera near distance.
         * The default of 1m works well with many scenes. The quality of shadows may drop
         * rapidly when this value decreases.
         */
        float shadowNearHint = 1.0f;

        /** Optimize the quality of shadows in front of this distance from the camera. Shadows
         * will be rendered behind this distance, but the quality may not be optimal.
         * This value is always positive. Use std::numerical_limits<float>::infinity() to
         * use the camera far distance.
         */
        float shadowFarHint = 100.0f;

        /**
         * Controls whether the shadow map should be optimized for resolution or stability.
         * When set to true, all resolution enhancing features that can affect stability are
         * disabling, resulting in significantly lower resolution shadows, albeit stable ones.
         */
        bool stable = false;

        /**
         * Constant bias in depth-resolution units by which shadows are moved away from the
         * light. The default value of 0.5 is used to round depth values up.
         * Generally this value shouldn't be changed or at least be small and positive.
         */
        float polygonOffsetConstant = 0.5f;

        /**
         * Bias based on the change in depth in depth-resolution units by which shadows are moved
         * away from the light. The default value of 2.0 works well with SHADOW_SAMPLING_PCF_LOW.
         * Generally this value is between 0.5 and the size in texel of the PCF filter.
         * Setting this value correctly is essential for LISPSM shadow-maps.
         */
        float polygonOffsetSlope = 2.0f;
    };

closed time in 9 days

roxlu

issue commentgoogle/filament

Jagged Shadows: advice on shadows for large scene?

Increase the shadow map resolution and reduce the shadowFarHint. The real solution will be when we implement cascaded shadow maps.

roxlu

comment created time in 9 days

issue commentgoogle/filament

How to extend shader in real time?

Yeah then you'll have to recompile all the libraries mentioned above and recompile your filamat files from mat files.

2080717101

comment created time in 10 days

issue closedgoogle/filament

How to extend shader in real time?

Hello, I am curious about the shadingModel in sandboxLit.mat. How does LitModel (lit, unlit, subsurface, cloth, specularGlossiness) make use of main.fs and main.vs ? I've noticed that matc-tool could transfer .mat to .fiamat, which .fiamat could be identified by the engine. 
So, if I want to change .fs a little, what do I need to do to see the new results? Can you give me any ideas? 
Thank you very much.

closed time in 10 days

2080717101

issue commentgoogle/filament

How to extend shader in real time?

If you change those files you need to rebuilt libfilamat and matc (and maybe libfilament). They are not meant to be modified at runtime. If you want to generate materials at runtime use libfilamat. What do you need to change?

2080717101

comment created time in 10 days

issue commentGoogleChromeLabs/squoosh

Codec Support Query: Basis Universal

@surma I can give you more context (my ldap is romainguy@)

SignpostMarv

comment created time in 10 days

issue commentgoogle/filament

Customized transform of vertex in vertexShader

See Material vertex inputs section at https://google.github.io/filament/Materials.html.

Realitian

comment created time in 12 days

issue commentgoogle/filament

Customized transform of vertex in vertexShader

You can set the material.clipSpaceTransform property in your vertex shader. It works no matter what domain you use, it will always be applied on the clip space coordinates.

Realitian

comment created time in 12 days

issue commentgoogle/filament

mipgen succeeds but OpenGlDriver::setCompressedTextureData() fails on assert

Here are the assertions in that code path:

    assert(xoffset + width <= t->width >> level);
    assert(yoffset + height <= t->height >> level);
    assert(zoffset + depth <= t->depth);
    assert(t->samples <= 1);

Could be an issue with the dimensions or offsets or mip levels you pass?

roxlu

comment created time in 12 days

delete branch google/filament

delete branch : ma/fixssr

delete time in 12 days

push eventgoogle/filament

Mathias Agopian

commit sha 00d55cddb5e45a302df2fab132f96ac0b803abf1

fix screen-space refraction roughness calculation (#2108) It turns out that textureLod() only reads the base layer if the sampler is not set to xxx_MIPMAP_xxx. This prevented the gaussian-blur code to work properly. Specifically, the horizontal pass would always use the base layer. Not only this made the blur unstable, but also hurt performance significantly. With this change, the untonamap/tonemap is no longer needed and the results are much more convincing with objects with highlights.

view details

push time in 12 days

PR merged google/filament

fix screen-space refraction roughness calculation cla: yes

It turns out that textureLod() only reads the base layer if the sampler is not set to xxx_MIPMAP_xxx. This prevented the gaussian-blur code to work properly. Specifically, the horizontal pass would always use the base layer. Not only this made the blur unstable, but also hurt performance significantly.

With this change, the untonamap/tonemap is no longer needed and the results are much more convincing with objects with highlights.

+11 -21

0 comment

2 changed files

pixelflinger

pr closed time in 12 days

issue commentgoogle/filament

mipgen succeeds but OpenGlDriver::setCompressedTextureData() fails on assert

You're triggering an assert so it could be you're asking to use an unsupported compression format (astc on desktop?).

roxlu

comment created time in 12 days

push eventgoogle/filament

Romain Guy

commit sha 88dd32b1a7e607cab4d0b65a9cae260360cf05a8

Add emissive to material_sandbox

view details

push time in 13 days

push eventgoogle/filament

Romain Guy

commit sha 9be871f14b232ab9603f077774caf3fdeeca1613

Don't use a LOD bias but a specific LOD in SSAO code

view details

push time in 13 days

Pull request review commentgoogle/filament

sample-gltf-viewer now supports landscape orientation.

       android:roundIcon="@mipmap/ic_launcher_round"       android:supportsRtl="true"       android:theme="@style/AppTheme">-    <activity android:name="com.google.android.filament.gltf.MainActivity" android:screenOrientation="portrait">+    <activity android:name="com.google.android.filament.gltf.MainActivity"+        android:screenOrientation="fullSensor"

This attribute is not needed, you can just remove it, it's the default behavior.

prideout

comment created time in 13 days

issue closedgoogle/filament

Spherical harmonic indirect lighting appears to be inverted along Y axis compared to Skybox

Diffuse lighting from indirect lighting appears to be inverted along the Y axis, compared to the Skybox cube map from which the spherical harmonic values were derived.

To test this (using library version 1.4.5), we used the debug cube map found in section 8.6.3 (Figure 89) of the "Physically Based Rendering in Filament" documentation. We used cmgen to create the SH values. The diffuse lighting for surfaces facing the +/-X and +/-Z axes look correct, but +/-Y faces are getting the opposite lighting. The cube map in the skybox appears to render correctly, and the specular reflections from the skybox seem correct. The problem seems to be the SH values (or how they are interpreted by Filament).

Given that there are several steps to set up this lighting/skybox combo, it is possible that we are doing something wrong, but I have tried to confirm each step of the process.

  • OS: Windows 10
  • GPU: AMD FirePro D500 (FireGL V)
  • Backend: OpenGL

closed time in 13 days

BStringhamVRSK

issue commentgoogle/filament

Spherical harmonic indirect lighting appears to be inverted along Y axis compared to Skybox

Ah no it's because FIlament expects its SH to be pre-optimized by folding as many constant computations as possible in them. Use --sh-shader when invoking cmgen (implied by -x). A good way to test if you are using the right flags is to test with assets/environments/white_furnace. If you use the right flags the SH should be similar to these:

( 1.000000000000000,  1.000000000000000,  1.000000000000000); // L00, irradiance, pre-scaled base
(-0.000000029081750, -0.000000029081750, -0.000000029081750); // L1-1, irradiance, pre-scaled base
( 0.000000000000000,  0.000000000000000,  0.000000000000000); // L10, irradiance, pre-scaled base
(-0.000000060320701, -0.000000060320701, -0.000000060320701); // L11, irradiance, pre-scaled base
( 0.000000000000000,  0.000000000000000,  0.000000000000000); // L2-2, irradiance, pre-scaled base
(-0.000000149214443, -0.000000149214443, -0.000000149214443); // L2-1, irradiance, pre-scaled base
( 0.000001189041427,  0.000001189041427,  0.000001189041427); // L20, irradiance, pre-scaled base
( 0.000000000274918,  0.000000000274918,  0.000000000274918); // L21, irradiance, pre-scaled base
( 0.000000683613393,  0.000000683613393,  0.000000683613393); // L22, irradiance, pre-scaled base

The first band is set to 1, all the other bands to 0. If you are not using the right flags, the first band will be set to something around 3.5.

./out/cmake-release/tools/cmgen/cmgen --sh-shader --sh=3 assets/environments/white_furnace/white_furnace.exr

BStringhamVRSK

comment created time in 13 days

issue commentgoogle/filament

Spherical harmonic indirect lighting appears to be inverted along Y axis compared to Skybox

BTW you don't have to use SH anymore with Filament 1.4.5. If you don't specify SH Filament will pull diffuse lighting from the 16x16 mip level instead. It is useful with extremely high dynamic range IBLs (30 stops for instance) as it better encodes strong directional lighting but the result may not always be as good as with SH on untextured, high roughness objects like a white sphere.

BStringhamVRSK

comment created time in 13 days

issue commentgoogle/filament

Spherical harmonic indirect lighting appears to be inverted along Y axis compared to Skybox

I can't repro your issue. I just tested with the same env map (from assets/environments/debug) and it looks correct (blue light coming from above, green from below).

How did you use cmgen? Here are the commands I used:

./out/cmake-release/tools/cmgen/cmgen -x ~/Desktop/ assets/environments/debug/debug.png

and

./out/cmake-release/samples/material_sandbox -i ~/Desktop/debug/ assets/models/sphere/sphere.obj

Result:

Screen Shot 2020-02-06 at 11 11 21 AM

BStringhamVRSK

comment created time in 13 days

Pull request review commentgoogle/filament

More comments and small bug fixes regarding MSAA

 void OpenGLDriver::blit(TargetBufferFlags buffers,         // GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater         // than zero and (...) the source and destination rectangles are not defined with the         // same (X0, Y0) and (X1, Y1) bounds.++        // Additionally the EXT_multisampled_render_to_texture extension doesn't specify what+        // happens when blitting from an "implicit" resolve render target (does it work?), so+        // to ere on the safe side, we don't allow it.

ere -> err

pixelflinger

comment created time in 14 days

push eventgoogle/filament

Romain Guy

commit sha 46090793a881f5e7cdc624667f2bb140c430e5e3

Fully document refraction properties

view details

push time in 14 days

Pull request review commentgoogle/filament

sample-gltf-viewer: enable gzip compression for bin and ktx.

 android {     // We use the .filamat extension for materials compiled with matc     // Telling aapt to not compress them allows to load them efficiently     aaptOptions {-        noCompress 'filamat', 'ktx', 'bin'+        noCompress 'filamat'

We should probably stop compressing filamat files as well. It actually makes even more sense than for other assets since they are small and the RAM copy won't cost much.

prideout

comment created time in 14 days

issue commentgoogle/filament

Can mipgen handle 8bit grayscale + alpha PNG images?

Looks like the meshes with bands just have inverted normals.

roxlu

comment created time in 14 days

issue commentgoogle/filament

Can mipgen handle 8bit grayscale + alpha PNG images?

The transparency of the cube doesn't change, you are just seeing the specular reflections (which are not affected by alpha unless you set the blending mode to fade).

roxlu

comment created time in 14 days

push eventgoogle/filament

Romain Guy

commit sha c3a995dd3dd1b2e44824f55d97aa200bd128598e

Update README.md

view details

push time in 14 days

delete branch google/filament

delete branch : rg/cgltf

delete time in 15 days

push eventgoogle/filament

Romain Guy

commit sha 0f7f6f60042e85baa4b5c53064f90737364b3ec5

Update to cgltf v1.5 (#2097)

view details

push time in 15 days

PR merged google/filament

Update to cgltf v1.5 cla: yes
+662 -236

0 comment

8 changed files

romainguy

pr closed time in 15 days

issue commentgoogle/filament

Does lookAt returns a left handed matrix 😲 ?

I would dispute it's an actual convention but more importantly Filament APIs expect model matrices, not "view" matrices. We do have a Camera::getViewMatrix() for convenience and for people used to this terminology but you never set the view matrix yourself. You either call Camera::lookAt() or Camera::setModelMatrix() (all the former does is setModelMatrix(mat4f::lookAt(eye, center, up)) anyway).

roxlu

comment created time in 15 days

delete branch google/filament

delete branch : pr/audi

delete time in 15 days

PR closed google/filament

Reviewers
What it takes to “compile” with ES2 headers cla: yes

Just exploratory experiment -- this gives us an idea of what we'd need to fix. Obviously the biggest issues:

  • no UBOs
  • no samplers
  • no vao (can be emulated, probably)
  • much less texture formats, no 11_11_10, no float, no half
  • no blitting (can be emulated with texturing)
  • no 3D textures (not a problem now, but we were thinking of using them)
+297 -296

1 comment

9 changed files

pixelflinger

pr closed time in 15 days

pull request commentgoogle/filament

What it takes to “compile” with ES2 headers

Closing PR, keeping the branch open

pixelflinger

comment created time in 15 days

PR closed google/filament

Request for feedback: double-precision accurate translation cla: yes

Filament does all its calculations for rendering in view-space, which means it's able to handle very large scenes. However, the position of objects (and camera) in the scene is still limited to float precision.

A related issue is that our TransformManager is only able to store float matrices.

This PR is an attempt to address these issues efficiently. The first thing to notice is that we only need a high precision on the translation component of matrices, this is because most of our objects are simply rotated and translated, and rarely scaled by very-large amounts.

Here me augment the TransformManager so it can maintain the 4th column as double precision; we accomplish this by storing an extra float3 per matrix. It's calculated as doubleTranslation - float3{doubleTranslation}.

We also add methods to set and get a transform as mat4, internally only the 4th column is kept as double precision.

Finally when we calculate the worldTransform, we take this extra data into account, but only for calculating the new 4th column, so the extra work is small. This makes assumption that the 4th row is [0 0 0 x], but even if it's not, the result wouldn't be worse than it is now.

Filament could them make use of this to maintain the precision of the position when converting everything to viewspace.

+139 -50

1 comment

10 changed files

pixelflinger

pr closed time in 15 days

pull request commentgoogle/filament

Request for feedback: double-precision accurate translation

Closing PR, keeping the branch open

pixelflinger

comment created time in 15 days

PR closed google/filament

Reviewers
switch to C++17 (from C++14) cla: yes

Some of the new features:

  • no message required for static_assert
  • nested namespace definitions, e.g.: namespace Foo::Bar{ ... }
  • compile-time static if, e.g.: if constexpr(exp) { }
  • structured binding declarations, e.g.: auto [r, e] = foo();
  • inline variables (avoiding ODR with definitions of variables in headers)
  • a file-system
  • std::optional, std::any, 'std::variant,std::byte`
  • etc ...
+21 -13

3 comments

9 changed files

pixelflinger

pr closed time in 15 days

pull request commentgoogle/filament

switch to C++17 (from C++14)

Closing PR, keeping the branch open

pixelflinger

comment created time in 15 days

pull request commentgoogle/filament

Update SPIRV-Tools

We should update this PR and move to spirv-tools v2020.1 (there's a tag for it). The bug you were waiting on has been fixed btw.

bejado

comment created time in 15 days

PR opened google/filament

Reviewers
Update to cgltf v1.5
+662 -236

0 comment

8 changed files

pr created time in 15 days

create barnchgoogle/filament

branch : rg/cgltf

created branch time in 15 days

issue closedgoogle/filament

Does lookAt returns a left handed matrix 😲 ?

While writing this issue, I've got the strong feeling that I'm wrong and Filamant is correct ... but as always I'm up for a lesson. The docs, section 8.6 Coordinate Systems describes that Filament uses a right handed coordinate system +X = right, +Y = up, +Z = forward. Normally a camera looks into the negative Z right? Is this the difference with other right handed libs: that we look into the positive Z?

When I create a basic lookat matrix like using the code below, I get this result:

 1.00,  0.00,  -0.00,  0.00
-0.00,  1.00,  -0.00,  0.00 
 0.00,  0.00,   1.00,  15.00
 0.00,  0.00,   0.00,  1.00

Using this test case.

#include <stdio.h>
#include <stdlib.h>
#include <math/mat4.h>

static void print_mat4(const char* title, filament::math::mat4& m);

int main(int argc, char* argv[]) {

  filament::math::mat4 m;
  filament::math::float3 p(0.0, 0.0, 15.0);
  filament::math::float3 t(0.0, 0.0, 0.0);
  filament::math::float3 u(0.0, 1.0, 0.0);

  m = m.lookAt(p, t, u);

  print_mat4("lookat", m);

  return 0;
}

static void print_mat4(const char* title, filament::math::mat4& mat) {

  printf("Matrix: %s.\n", title);

  double* m = (double*)&mat[0][0];

  printf("%2.2f, %2.2f, %2.2f, %2.2f\n", m[0], m[4], m[8], m[12]);
  printf("%2.2f, %2.2f, %2.2f, %2.2f\n", m[1], m[5], m[9], m[13]);
  printf("%2.2f, %2.2f, %2.2f, %2.2f\n", m[2], m[6], m[10], m[14]);
  printf("%2.2f, %2.2f, %2.2f, %2.2f\n", m[3], m[7], m[11], m[15]);
}

I've got a little repository where I compare different math libraries. These are the results of other libraries using the same eye/target/up vectors.

Lookat matrices test with the GLM library (right handed)
---------------------------------------------------------
 1.00, -0.00,  0.00, -0.00
 0.00,  1.00,  0.00, -0.00
-0.00, -0.00,  1.00, -15.00
 0.00,  0.00,  0.00,  1.00

Lookat matrices test with the Songho library
----------------------------------------------
[  -1.00000    0.00000    0.00000    0.00000]
[   0.00000    1.00000    0.00000    0.00000]
[   0.00000    0.00000   -1.00000   15.00000]
[   0.00000    0.00000    0.00000    1.00000]

Lookat matrices test with the linmath library (right handed)
-------------------------------------------------------------
 1.00, -0.00,  0.00,  0.00
 0.00,  1.00,  0.00,  0.00
-0.00, -0.00,  1.00, -15.00
 0.00,  0.00,  0.00,  1.00

Lookat matrices test with the mathfu library (right handed) 
--------------------------------------------------------------
 1.00, -0.00, -0.00,  0.00
 0.00,  1.00,  0.00, -0.00
-0.00, -0.00,  1.00, -15.00
 0.00,  0.00,  0.00,  1.00

closed time in 15 days

roxlu

issue commentgoogle/filament

Does lookAt returns a left handed matrix 😲 ?

I see where the confusion comes from. Our lookAt returns the post (or model matrix/transform) of the camera, not what's commonly called the view matrix. If you want the view matrix, take the inverse of what lookAt computes and you'll get the same result as glm for instance.

print_mat4("lookat", inverse(m));
1.00, 0.00, 0.00, -0.00
0.00, 1.00, 0.00, -0.00
0.00, 0.00, 1.00, -15.00
0.00, 0.00, 0.00, 1.00
roxlu

comment created time in 15 days

issue commentgoogle/filament

Does lookAt returns a left handed matrix 😲 ?

The docs say: "Filament's Camera looks towards its local -Z axis. That is, when placing a camera in the world without any transform applied to it, the camera looks down the world's -Z axis."

I'm not sure where you got the info that +Z is forward.

roxlu

comment created time in 15 days

push eventgoogle/filament

Romain Guy

commit sha eee9249dfc8ad17f999f57a73b9378d110f9f744

Fix table

view details

push time in 16 days

Pull request review commentgoogle/filament

rework refraction filtering/blurring to improve performance

 void applyRefraction(const PixelParams pixel,     p.xy = uvToRenderTargetUV(p.xy * (0.5 / p.w) + 0.5);      // perceptualRoughness to LOD-    const float kNumRoughnessLods = 5.0;     // Empirical factor to compensate for the gaussian approximation of Dggx, chosen so     // cubemap and screen-space modes match at perceptualRoughness 0.125     float tweakedPerceptualRoughness = perceptualRoughness * 1.74;-    float lod = log2(tweakedPerceptualRoughness * 2.0) + (kNumRoughnessLods - 1.0);+    float lod = max(0.0, 2.0 * log2(tweakedPerceptualRoughness) + frameUniforms.refractionLodOffset);

Can the lod offset be negative?

pixelflinger

comment created time in 18 days

issue closedgoogle/filament

Rendering multiple instances of the same `filamesh::MeshReader::Mesh`?

When I use the filamesh util to create a .filamesh file and the filamesh::MeshReader to load this mesh, it creates the vertex and index buffers together with a utils::Entity which represents a renderable:

struct Mesh {
    utils::Entity renderable;
    filament::VertexBuffer* vertexBuffer = nullptr;
    filament::IndexBuffer* indexBuffer = nullptr;
};

When I want to create multiple instances of this mesh (e.g. rendering many trees of the same mesh) what is the recommended approach? Do I load the mesh, keep it around and create new renderable entities for each instance I want to draw?

If this is the case you would need to copy the properties of the entity. Some can be retrieved via the getters in RenderableManager.h like getPrimitiveCount(), getMaterialIntanceAt().

But how would I get the values for the calls to setGeometryAt()? The utils::Entity aka renderable does not have getters that allow me to retrieve all the necessary information and the filamesh::MeshReader doesn't keep the necessary info either.

void setGeometryAt(Instance instance, size_t primitiveIndex,
        PrimitiveType type, VertexBuffer* vertices, IndexBuffer* indices,
        size_t offset, size_t count) noexcept;

This seems to be somewhat related to gltfio and this issue: https://github.com/google/filament/issues/1513.

closed time in 18 days

roxlu

issue commentgoogle/filament

Rendering multiple instances of the same `filamesh::MeshReader::Mesh`?

This is just a simple helper API for samples or simple apps, it’s not meant to do more than it provides. You would indeed have to create multiple renderables. To do so you’d need to expose the information about each part. Note that the filamesh format is fully documented in the readme file of the filamesh tool if you want to create your own more advanced loader.

roxlu

comment created time in 18 days

issue commentgoogle/filament

How to apply flat shading to glTF model?

You can use a flat interpolation in the material: https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/vertexandattributes:interpolation

cx20

comment created time in 19 days

push eventgoogle/filament

Romain Guy

commit sha 503e66790ba5c5a948b2e9df83c335c62c3537e7

Docs fixup

view details

push time in 20 days

push eventgoogle/filament

Romain Guy

commit sha a8dc91c2388fa28d5cda0ee3cb60fe3739d62f6e

Update static version of Materials.md.html

view details

push time in 20 days

push eventgoogle/filament

Romain Guy

commit sha bc554f77f4eb45c0780fb176616b7c30e2dc0069

Add documentation for refractive materials

view details

push time in 20 days

pull request commentgoogle/filament

fixed compile error by vs2019

Thanks!

locobrain

comment created time in 20 days

push eventgoogle/filament

brian.wang

commit sha dada7332c698c17b8d6a8c724f0e173bc4c190a7

fixed compile error by vs2019 (#2087)

view details

push time in 20 days

PR merged google/filament

fixed compile error by vs2019 cla: yes
+11 -11

0 comment

1 changed file

locobrain

pr closed time in 20 days

Pull request review commentgoogle/filament

gltfio: Introduce the asynchronous API and use it.

 class ModelViewer {         destroyModel()         asset = assetLoader.createAssetFromJson(buffer)         asset?.let { asset ->-            val resourceLoader = ResourceLoader(engine)-            resourceLoader.loadResources(asset)-            resourceLoader.destroy()+            resourceLoader.asyncBeginLoad(asset)

This begs for a use of coroutines in Kotlin :)

prideout

comment created time in 20 days

more