Commit Graph
1202 Commits
Author SHA1 Message Date
Philip Rideout dcc17b9b7e Allow dynamic doubleSided and materialThreshold. (#1072)
* MaterialInstance now has setMaskThreshold for convenience.

* Materials now support dynamic doubleSided property.

This does not change the format of material packages because they
already have both getDoubleSided() and getDoubleSidedSet().

The only way in which this change could impact existing applications is
that materials that explicity set doubleSided to "false" will now
respect the material's culling mode, rather than forcing it to NONE.

Fixes gltf_viewer with littlest_tokyo in ubershader mode.

Fixes #963.

* JNI for dynamic material properties.

* Add underscore prefix to internal material params.

* Remove un-needed mat info field.
2019-04-08 11:43:01 -07:00
Mathias Agopian 1634a8a2db debug option to fill the shadowmap with a checkerboard 2019-04-05 18:45:35 -07:00
Mathias Agopian ff1053523c move the shadowmap renering code to ShadowMap.cpp 2019-04-05 18:45:35 -07:00
Mathias Agopian e423611e39 first step of lispsm documentation 2019-04-05 18:45:03 -07:00
Ben Dohertyandpixelflinger 5ddbcdf418 Update filament/src/details/ShadowMap.h
Co-Authored-By: pixelflinger <pixelflinger@gmail.com>
2019-04-05 11:29:56 -07:00
Mathias Agopian 138c7e091e Fix a bug when computing the warp-space alignment matrix
We where treating a direction as a vector when projecting the camera's
forward vector. We never saw this bug before because we always used
<0,0,0> as the origin of the light space.

Now that we can pick an arbitrary light-space, we use the camera's
origin. Other choices are possible. But the camera origin is a nice
reference point.

Also simplify some code.
2019-04-05 11:29:56 -07:00
Mathias Agopian bc381ac1b7 Add a "stable" shadow-map option
- "stable" mode disables all resolution optimizations that can affect
stability of the shadow map (e.g. lispsm, focusing)

- expose near/far hint + stable option to java
2019-04-05 11:29:56 -07:00
Mathias Agopian 147dfec5e5 Minor code/comment cleanup 2019-04-05 11:29:56 -07:00
Mathias Agopian 098f8f539d fix LISPSM warping frustum computation
We were using the view frustum as a basis instead of the shadow 
receivers volume which didn't give a good warping for the scene, we
were working around it by setting a virtual near plane dynamically.

Now that the warping frustum is tight, the virtual near plane is 
no longer needed -- it's still needed for the user to adjust the
precision and the default is still 1m.
2019-04-05 11:29:56 -07:00
Philip Rideout 230f0e1b2b Fix setCustomProjection JS binding.
Fixes #1073.
2019-04-05 08:37:45 -07:00
Philip Rideout 10251821c6 filagui: Introduce widget for manipulating vectors.
This is our first ImGui extension, it draws a draggable 3D arrow for
manipulating a unit vector. This is especially useful for tweaking the
light direction.
2019-04-04 10:59:38 -07:00
Ben Doherty ba0bc9e481 Add correct Metal load and store actions (#1070) 2019-04-04 08:25:12 -07:00
Philip Rideout ccc9606ffc gltfio: allow folder paths and disable auto-scale 2019-04-03 10:18:05 -07:00
Philip Rideout ab52a759b8 Update Vulkan documentation. 2019-04-03 12:08:46 -04:00
Philip Rideout 396801b3d0 Fix stale comments in VulkanHandles. 2019-04-02 11:18:03 -07:00
Mathias Agopian ca7f942b7b uhm, actually set the IBL rotation from the builder
Thankfully, the setRotation() method does work, which provides a
workaround.
2019-04-01 19:03:19 -07:00
Romain Guy 7b87662db0 Don't flip the normals (#1060)
* Don't flip the normals

* Fix the ubershader as well
2019-04-01 12:04:27 -07:00
Mathias Agopian 6374c9ab59 Expose the depth buffer to the postprocess pass 2019-04-01 10:57:32 -07:00
Pixelflinger 6bec21d611 split RenderPass::render()
instead we now have generateSortedCommands() and execute().
2019-04-01 10:57:32 -07:00
Mathias Agopian c667fd3087 reorganize shadow and color pass
this is mostly simplifying and playing nicer with the framegraph, in
particular, now the framegraph computes the discard and clear flags
for the color pass.

the next step will be to move the shadow pass to the framegraph.
2019-04-01 10:57:32 -07:00
Mathias Agopian 9f99904a1f recordDriverCommands() now takes a range 2019-04-01 10:57:32 -07:00
Mathias Agopian 84c08d3abc rename updateUniformBuffer to loadUniformBuffer
This is to make it more evident that uploading a buffer
partially, doesn't keep its content and the back of the buffer
becomes undefined.
2019-04-01 10:56:46 -07:00
Ben Doherty b020311c8c Add MetalBufferPool to Metal backend (#1053) 2019-03-29 17:00:24 -07:00
Romain Guy 9a72773c29 Move markdeep-rasterizer 2019-03-29 10:02:40 -07:00
Romain Guy ab12d1d1bb Add postLightingColor property to materials (#1057)
* Add postLightingColor property to materials

This property can be used to modify the color computed in the lighting
passes of the materials. That color is blended with the computed color
according to the postLightingBlending option (add, transparent or opaque).

* Remove test

* Update docs

* Address code review comment

* Switch postLightingColor default blend mode to transparent
2019-03-29 10:02:07 -07:00
Philip Rideout 1fc8e8dbeb WebGL fix for "createContext is not a function".
One of the recent releases of emsdk moved its GL-related utility methods
into an object called GL, previously it exposed them directly.

This change also makes it so that we create the WebGL 2.0 context
and register it with emscripten, rather than the other way around.

Note that our CI does "emsdk activate latest", not sure when this broke
exactly.
2019-03-28 11:23:05 -07:00
Philip Rideout feb7d968b6 Fix web build break. 2019-03-28 08:09:24 -07:00
Jack Diver 5366105ed2 Removing STL headers from filameshio (#1050)
* Removed STL headers from filameshio/MeshReader.h modified the samples to work the same, and made an effort to remedy the jsbindings although I'm not experienced with them.

* Fixed assignment operators for MaterialRegistry

* Fixed formating for MeshReader Material Registry

* Forgot one format

* Forgot another format
2019-03-28 07:30:22 -07:00
Philip Rideout c92700ce28 Simplification due to sampler bindings starting at 0. 2019-03-28 07:29:14 -07:00
Ben Doherty aa90f7edd6 Update Filament dependencies in iOS samples and README (#1049) 2019-03-27 14:37:51 -07:00
Philip Rideout 7a106be627 MATERIAL BREAK: VulkanBinder now binds 2 descriptor sets at a time.
This allows us to start Vulkan sampler bindings at zero, similar
to uniforms. Further cleanup will be implemented in a subsequent pull
request.
2019-03-27 13:11:24 -07:00
Philip Rideout 01e8154bc8 Rename CodeGenTargetApi to TargetLanguage.
This is just a cleanup and does not change any behavior. The old code
was a little strange because we'd generate code designed for OpenGL but
we'd pass VULKAN to the code generator. This was a little white lie that
really meant: "I will need SPIRV (for optimization purposes only)"
2019-03-27 10:17:02 -07:00
Philip Rideout 0076de25fa Configurability fixups per code review. 2019-03-27 09:24:44 -07:00
Philip Rideout 5090fe6395 Allow configurable attribute and binding counts.
This fixes two issues related to the Vulkan backend, one being a build
issue and the other being a run-time issue:

(1) Compile-Time Issue

To prevent accidental introduction of padding into hashed structures,
the Vulkan backend was static-asserting the size of the hash input. I
think it's fine to simply use a pragma pack instead.

(2) Run-Time Issue

SibGenerator was erroneuously using BindingPoints::COUNT instead of
UNIFORM_BINDING_COUNT for determining the first sampler binding index.
(Hopefully this logic will go away after some upcoming Vulkan cleanup.)
Since SibGenerator does not include Program, this moves the uniform and
sampler counts into EngineEnums, which might be a good place anyway
since they are ideally "config" constants.
2019-03-27 09:24:44 -07:00
Philip Rideout abdfc44aa8 Fix Vulkan sampler enumeration to be similar to MetalDriver.
There will (probably) be a follow-up change that makes this even
simpler.
2019-03-26 15:36:36 -07:00
Mathias Agopian 2eb2f910b1 make OpenGLPlatform semi-public again
There is a new static method that can be used by derived classes to
instantiate an OpenGLDriver.

This is to support existing clients that use their own implementation
of OpenGLPlatform with filament's OpenGLDriver implementation.
2019-03-26 13:38:38 -07:00
Mathias Agopian 46877abd8c Handle.h is definitely a public API of libbackend 2019-03-26 11:47:47 -07:00
Mathias Agopian e37701c097 Minor header cleanup
remove unneeded includes and reorder includes.
2019-03-26 11:47:47 -07:00
Mathias Agopian 09cae083b2 update doxygen config file 2019-03-26 11:47:47 -07:00
Mathias Agopian 0b8acb451d attempt to fix filament-js 2019-03-26 11:47:47 -07:00
Mathias Agopian b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Mathias Agopian 639d05374b update layering: libbackend is now at the bottom
We now have:

backend -> filabridge -> filaflat -> filament
                      -> filamat

Instead of backend depending on filabridge.
2019-03-26 11:47:47 -07:00
Philip Rideout 3f0bd4596e Add HwFence support to the Vulkan backend.
There are two changes involved here:

1) Recreate (do not recycle) the submission fences at every frame.

2) Add shared ownership semantics to existing fences to allow DriverAPI
   clients to "own" fences.

The first change was motivated by FrameSkipper, which might have a
fence list that is longer than the number of swap chain contexts.

The second change was implemented simply by creating a tiny wrapper
struct for VkFence with a proper constructor and destructor, then
leveraging shared_ptr.
2019-03-25 18:27:38 -07:00
Philip Rideout c0c6b4bea0 (affects OpenGL) Move beginFrame calls to fix fence lifetime.
There are a couple reasons for this change. First of all, creating a
Vulkan fence outside of beginFrame / endFrame is not ideal because
the backend does not know yet which command buffer will be chosen
during swap chain acquisition.

Secondly, the Renderer currently calls endFrame in this order:

    frameInfoManager.endFrame
    mFrameSkipper.endFrame
    driver.endFrame

However the beginFrame calls were ordered like this:

    frameInfoManager.beginFrame
    driver.beginFrame
    mFrameSkipper.beginFrame

This change makes it such that the beginFrame calls have the reverse
ordering of the endFrame calls, which is less surprising.

I did a poor man's sanity check by running textured-object on a Pixel 2,
(which enables dynamic resolution) and hacking PostProcessManager to
make it visually obvious if anything were amiss.
2019-03-25 18:26:42 -07:00
Mathias Agopian 4bec201717 naming convention NUM_FOOS -> FOO_COUNT 2019-03-25 17:55:19 -07:00
Mathias Agopian 8ec3b62715 libbackend header cleanup
This is mostly about moving constant from EngineEnums.h to
the backend, either in Program.h or DriverEnums.h

The goal is that libbackend doesn't depend on EngineEnums.h
2019-03-25 17:55:19 -07:00
Mathias Agopian 3ca691cb40 API BREAK: Make all subclasses of Platform private
OpenGLPlatform, VulkanPlatform and MetalPlatfrom are no longer public
classes, they never should have been.

This will break code using those, the solution is simply to copy the
header locally.
2019-03-25 17:55:19 -07:00
Philip Rideout 570dd8a869 Add an extra clean task to Android samples.
It is easy to run into our new material version error if a stale
filamat file is sitting around, this helps with that.
2019-03-25 17:39:47 -07:00
Romain Guy 9c69b377b7 Fix #1039 (#1040) 2019-03-25 16:24:19 -07:00
Ben Doherty 8b7c2159d3 Fix issue with Windows JAWT swapchains (#1021) 2019-03-25 14:41:46 -07:00