O3DE
The ApertureUI gem for Open 3D Engine. Setup, license settings, the components, how it draws through Atom, and what it does not do yet.
ApertureUI is a gem for Open 3D Engine. It wraps the Aperture UI SDK in a system component, an
entity component and an Atom render pass. It is a thin layer over the same SDK the rest of this
section describes, not a second implementation. The gem is at version 0.1.0 and is early: it
draws one screen-space document, and the section Known gaps lists what the source
shows it does not do yet.
The gem and the SDK are licensed separately. gem.json gives the gem Apache-2.0 OR MIT and
the SDK Commercial. Building or running the gem needs a RuntimeBuild package, and its CMake
configure step fails without one. The o3de download includes both.
An early gem
Read Known gaps before you start. In this version page scripts do not run, no text draws, and no network request succeeds. The shader is a partial port, so box shadows and some blend modes do not render correctly either.
What you need
- Windows.
gem.jsonlistsWindowsas the only platform, and the gem's platform traits are true for Windows only. - O3DE with Atom. The gem depends on
Atom_RPI,Atom_RHIandAtom_Feature_Common. It names no compatible O3DE release, and this site has no test matrix, so build it against the engine you use. Its CMake needs CMake 3.24 or newer. - The
o3dedownload. The package the portal callso3deholds the gem atGems/o3de-aperture-uiand the RuntimeBuild at3rdParty/ApertureUI/0.1.0, withLICENSE.mdandTHIRD_PARTY_NOTICES.mdat its root.0.1.0is the package version that the gem'sfind_package(ApertureUI 0.1.0 REQUIRED)asks for. The RuntimeBuild is the same as thegenericflavor's. Check itsMANIFEST.mdfor the Configuration (Debug,DevorShipping). The gem does not choose the configuration for your build type, so use Shipping for what you ship. See Licensing in practice.
Add the gem to a project
- Extract the zip into
%USERPROFILE%\.o3de. That puts the gem at.o3de\Gems\o3de-aperture-uiand the RuntimeBuild at.o3de\3rdParty\ApertureUI\0.1.0, which is where the gem looks for it (see below), so it needs no further setting. - Register the gem folder the way you register any O3DE gem.
- Enable
ApertureUIin the Project Manager or in the project'senabled_gems.cmake.
At configure time the gem looks for the RuntimeBuild in this order, and accepts a folder if it
contains cmake/ApertureUIConfig.cmake:
- The
APERTUREUI_PACKAGE_ROOTCMake cache variable. - The
APERTUREUI_SDKenvironment variable. %USERPROFILE%/.o3de/3rdParty/ApertureUI/0.1.0($HOMEwhere there is noUSERPROFILE).
If none matches, configure stops with an error that names these. If you would rather not extract
into .o3de, extract the zip anywhere, register the gem from there, and set APERTUREUI_SDK to its
3rdParty\ApertureUI\0.1.0 folder.
The gem's CMake applies two of the settings that
Requirements lists for every consumer: it defines
BUILDSYSTEM_COMPILE_ENGINE_AS_DLL on the imported engine targets and adds
include/Foundation/Platform/Win to their include directories. It does not define
BUILDSYSTEM_BUILDTYPE_<Configuration>. It also stages snapshot_blob.bin, icudtl.dat and
v8_icudtl.dat into a resources/ folder beside the launcher, and copies the package's DLLs there.
What the gem provides
| Piece | What it does |
|---|---|
ApertureUISystemComponent | A required system component. It installs the platform interfaces below, calls ApertureSDK::Initialize with your license settings, and registers the ApertureUIPass pass creator with Atom. |
ApertureUIComponent | The Aperture UI Document component (Add Component, category UI). It owns one aperture::UIView and one ApertureAtomRenderContext, and ticks the view every frame. |
ApertureUIRequestBus | One request: IsSdkInitialized(). |
ApertureUIPass | An Atom render pass that paints the document into the pipeline's color target. |
The system component installs six classes into aperture::core::IAPCPlatform, so the engine
reaches O3DE's systems rather than the operating system:
| Class | Replaces | Behavior |
|---|---|---|
ApertureAzFileSystem | IAPCFileSystem | Reads and writes through AZ::IO::FileIOBase. Reads are contained to the read root, writes to a separate writable root. Aliases are resolved and paths are canonicalized, so .. and symlinks cannot escape. |
ApertureAzLogger | IAPCLoggingSystem | Forwards to AZ_Printf, AZ_Warning and AZ_Error. Page text is always an argument and never the format string. |
ApertureAzAllocator | IAPCMemoryAllocator | Allocates from AZ::SystemAllocator, and treats the alignment 0 that V8 passes as 1. |
ApertureAzNetwork | IAPCNetworkProvider | Refuses every request. See Known gaps. |
ApertureAzScriptCache | IScriptCacheProvider | Stores V8's compiled bytecode as ScriptCache/<crc32>.apcache under the writable root. |
ApertureAzAudio | IAPCAudioOutput | Supports no format, so no audio stream is ever created. |
Settings
The gem reads its settings from the O3DE Settings Registry. Registry/apertureui.setreg in the
gem holds the defaults:
| Key | Default | Meaning |
|---|---|---|
/ApertureUI/LicenseKey | empty | The APUI- key from your project page. Development builds activate with it. |
/ApertureUI/ProjectId | empty | The Project ID from your project page. |
/ApertureUI/CertificatePath | empty | The path of aperture.license. Empty means next to the executable. |
/ApertureUI/ScriptThreadCount | 2 | The size of V8's worker pool. |
/ApertureUI/RenderThreadCount, /ApertureUI/CompositionThreadCount | 1 | Passed to the SDK, which does not read them in this version. |
/ApertureUI/ResourceRoot | @products@/ApertureUI | The read-only content root. |
/ApertureUI/WritableRoot | @user@/ApertureUI | Where the engine writes: localStorage files and the script cache. |
/ApertureUI/AllowNetworkAccess | false | See Known gaps. |
Put the project ID and certificate path in your project's registry, and keep the key in a per-user
file such as the project's user/Registry/ so it is never committed:
{
"ApertureUI": {
"ProjectId": "your-project-id",
"CertificatePath": ""
}
}{
"ApertureUI": {
"LicenseKey": "APUI-XXXX-XXXX-XXXX-XXXX"
}
}A packaged game needs aperture.license next to its executable, or at CertificatePath. A
development build does not check the certificate's list of executables, because it usually runs
inside Editor.exe. A shipping build does, and a package whose MANIFEST.md says Shipping behaves
as a shipping build in the editor too, so list every executable on the project page, Editor.exe
included, before you download the certificate. If the license check fails, the SDK stays inactive, the gem logs it, and
ApertureUIComponent logs "SDK is not active" and does not create a view.
Show a document
- Put your HTML, CSS, JavaScript and images under the resource root. The gem has no asset
builder: the files must exist in the folder
/ApertureUI/ResourceRootnames. With the default, that isApertureUIin the asset cache (@products@). Either arrange for your UI files to be produced there, or point the key at a folder that holds them. - Add Aperture UI Document to an entity.
- Set Document to the file's path relative to the resource root, such as
ui/hud.html. A value that starts with<is treated as markup instead. - Leave Output on
Screen.
The component loads the document when it activates and ticks the view on the UI tick. Painting does
not happen in the tick: the pass builds the command list inside the render frame. The
component's LoadDocument, SetViewportSize and ExecuteJavaScript are public functions of a
class in the gem's private Source/Clients folder, and they are not on the bus, so another module
cannot call them without changing the gem.
How it draws
ApertureUISystemComponent inserts one ApertureUIPass into the default viewport's pipeline,
directly after the main pipeline's UIPass. That puts Aperture UI over everything else, including
LyShine. A pipeline that has no pass named UIPass gets no Aperture UI, and the gem logs a
warning. When a pipeline is rebuilt, for example by a fullscreen toggle, the pass is wired again.
Every frame, inside the RHI frame scheduler:
UIView::buildCommandList()produces aHarrlowCommandList.ApertureAtomRenderContext(aSimpleAPHIRenderContext) walks it. Each draw copies its vertices and indices into a per-frame Atom dynamic buffer and records a draw item with its scissor, stencil reference, blend-keyed pipeline state and shader resource group.ApertureUIPassfinalizes the pipeline states against its own output and submits the draw items.
Opacity groups, CSS filters and masks render through off-screen layer targets. Atom cannot switch
render targets inside one scope, so the pass makes each layer submission its own frame-graph scope:
a raster scope for the draws into a layer target, a compute scope for each filter dispatch and a
copy scope for each copy. mix-blend-mode compositing is implemented in the gradient shader only:
the main shader does not evaluate it (see Partial shader port).
The gem's AZSL shaders are in Assets/Shaders/ApertureUI. The context loads three of them:
UIPlayer (the main shader), UIGradient (gradients, border rings and blend-mode compositing)
and UIFilterCompute (the blur, drop-shadow, mask and color-matrix kernels). UIFilters is kept
as a reference and is not loaded.
Known gaps
These come from the gem's source at this version. The site has no results from running the gem in an O3DE project, so read the rendering notes as what the source implements.
- Page scripts do not run. The gem calls
ApertureSDK::Initializebut neverIAPCPlatform::InitializePlatform(),StartPlatform()orInitializeJavaScriptEngine(). Nothing else starts V8, so a document with a<script>logs that the JavaScript engine is not initialized, andExecuteJavaScriptand data models have no effect. A project that needs scripts has to add the sequence in Your own C++ host to the gem'sApertureUISystemComponent::Activate(the gem is source), and pointJSEngineConfig::icuDataPathandsnapshotBlobPathat theresources/folder that the gem stages beside the launcher. - No text. The engine draws text as vector glyphs by default. Those draws need the glyph curve
buffers at
t5tot8and the vector glyph code in the pixel shader, and the gem does neither. Turning vector glyphs off is not a workaround: the atlas route needsUIView::setAtlasUpdateCallbackand an override ofResolveExternalTextureHandle, and the gem has neither. See Rendering backends for both routes. - Partial shader port.
UIPlayer.azslis a first pass over the SDK'sUIPlayer.hlsl, and its header lists what it leaves out: GPU vector glyph coverage and COLRv1 emoji, SDF border, box-shadow, background and generic-shape evaluation, video YUV sampling, bindless textures,mix-blend-modebackdrop compositing, linear-light and HDR color management, and the MSAA resolve. The engine emits box shadows as SDF draws by default, so a page withbox-shadowdoes not render it correctly. What appears instead is not verified.mix-blend-modeworks only on gradient draws, which useUIGradient.azsl. - One document, on screen.
ApertureUISystemComponentrefuses a second screen-mode document with an error. OutputTextureis accepted and nothing renders it. - No network.
ApertureAzNetworkfails every request: with "network denied" while/ApertureUI/AllowNetworkAccessisfalse, and with "no http impl" when it istrue, because the gem has no HTTP backend.fetch(),XMLHttpRequest,WebSocketandloadHtmlFromUrl()do not work. On Windows a development build's license activation does not use this provider. - No audio and no video frames.
ApertureAzAudionever creates a stream, andUIPlayer.azsldeclares no inputs for the video planes. localStoragedoes not persist. The engine writes it under the writable root and reads it back from the resource root. See File system.- Bundled fonts load from disk. The font engine reads the package's fonts by path, so they
cannot come from a
.pak.
The gem has unit tests in Code/Tests. They cover the SDK lifecycle, path containment, the
interface shims, the component, shader compilation, and the Atom resources, draw submission and
pass.