Download

[FEATURE REQUEST] Mesh Distance Fields access on ES3_1 Vulkan

Hey there, been digging through the engine code to see why there’s no mesh distance field support for ES3_1. I think I got the gist of why, but some comments left in the code seem to point to that it’s possible to support eventually. Getting the Clipmaps to compile on GL seems to be blocker listed in the code comments, but what about on Vulkan ES3_1? Is this really a hardware issue? Code comments seem to point to an excessive use of samplers being the root problem. Same comment suggests using an atlas instead.

//@todo - get the clipmap branches to compile under gl

//@todo - would be nice to atlas to get rid of branches and multiple samplers but the partial update scrolling relies on wrap addressing

So, I’m working on oculus quest stuff. We have no post processing as an option so that really limits what we can do. In this very particular use case I want to mask water out of the hull of a boat. I don’t have post process, stencil buffer, or mesh distance fields to use as a mask here.

The only two plausible avenues I can see are either getting mesh distance field support or to somehow get the stencil buffer piped in through a vulkan subpass or something. Either of those two would be great, but I’m leaning on distance fields because there’s much greater utility there IMHO.

Mesh Distance Fields also power volumetric fog from what I can see along with other features.

Something to note is that it appears most of the engine shader compilation treats OpenGL ES3_1 and Vulkan ES3_1 as the same thing. Even though they are similar, we should really have more separation for those paths.

Could we please get support for Mesh Distance field access on vulkan at least?

Bump also interested in an in depth answer on why this isn’t supported for ES3_1

I can provide the file paths that I’ve found so far to look at. I made changes to all the engine files and recompiled successfully, but for some reason the editor was still reporting that the feature wasn’t available in ES3. There’s probably more stuff I’m not seeing somewhere.

I can understand this not working on OpenGL, but surely this should work on vulkan, especially on quest 2 at the least.

Edit
Files I’ve looked at:

  • Engine\Shaders\Private\PhysicsFieldSampler.ush
  • Engine\Shaders\Private\PhysicsFieldShared.ush
  • Engine\Source\Runtime\Engine\Classes\PhysicsField\PhysicsFieldComponent.h
  • Engine\Source\Runtime\Engine\Private\PhysicsField\PhysicsFieldComponent.cpp
  • Engine\Shaders\Private\GlobalDistanceFieldShared.ush
  • Engine\Source\Runtime\RHI\Public\RHIDefinitions.h
  • Engine\Source\Runtime\Engine\Public\SceneManagement.h
  • Engine\Source\Runtime\Engine\Private\ShaderCompiler\ShaderCompiler.cpp

I responded to you in discord as well I think, but does vulkan have a sm5 renderer you can run on mobile? With iOS metal you can do that and then you get all SM5 rendering features including mesh distance fields.

yes it does, but that comes with a lot of other things that cause a massive slow down. I’d rather be able to cherry pick rendering features. Which you can sort of do by using a config file for DataDrivenShaderPlatform

edited comment above as well, but these are what I’ve looked at so far:

  • Engine\Shaders\Private\PhysicsFieldSampler.ush
  • Engine\Shaders\Private\PhysicsFieldShared.ush
  • Engine\Source\Runtime\Engine\Classes\PhysicsField\PhysicsFieldComponent.h
  • Engine\Source\Runtime\Engine\Private\PhysicsField\PhysicsFieldComponent.cpp
  • Engine\Shaders\Private\GlobalDistanceFieldShared.ush
  • Engine\Source\Runtime\RHI\Public\RHIDefinitions.h
  • Engine\Source\Runtime\Engine\Public\SceneManagement.h
  • Engine\Source\Runtime\Engine\Private\ShaderCompiler\ShaderCompiler.cpp