Documentation

Support

Asset Transformer SDK


User Manual

Python API

C# API

Changelog

Discussions

Asset Transformer SDK

Viewer

Describes viewer functionality within the Asset Transformer SDK for 3D asset visualization and interaction.
Read time 5 minutesLast updated 21 hours ago

The View module API can be used to render scenes, generating offline screenshots (see following snippet), or create interactive viewers (see Python UI).
direction = geom.Point3(0, 0, -1) # frontviewer = view.createViewer(resolution, resolution)gpu_scene = view.createGPUScene(occurrence, show_edges)view.addGPUScene(gpu_scene, viewer)view.fitCamera(direction, type, fov, viewer, [occurrence])if show_edges: view.setViewerProperty("ShowEdges", "True", viewer)if show_lines: view.setViewerProperty("ShowLines", "False", viewer)view.takeScreenshot(path, viewer)view.destroyViewer(viewer)view.destroyGPUScene(gpu_scene)

Viewer textures

When building a custom UI, textures generated by the SDK viewer can be retreived using view.getGLTextureHandle. These textures are packed and might contain other elements than what the name only suggests. See table below for a detailed explanation:

Texture name

Vulkan format

OpenGL format

Content

CompositedR8G8B8A8_UNORMRGBA8UI4 8-bits unsigned int containing the color of the composited image
AlbedoOpactityR8G8B8A8_UNORMRGBA8UI4 8-bits unsigned int containing the albedo (RGB) and the opacity (A)
NormalR32G32B32A32_SFLOATRGBA32F4 32-bits float. The first 3 floats represent the normal. The last float (A) is the z coordinate or the tangent. Normals and tangents are represented between 0 and 1. They are obtained by computing
normal * 0.5 + 0.5 = storedNormal
DepthD32_SFLOATR32FSingle 32-bits float representing the depth (not linearized)
MetallicRoughnessAOMiscR8G8B8A8_UNORMRGBA8UI4 8-bits unsigned int containing the metallic value (R), the roughness (G), the ambient occlusion (B), and a last value (A) that is either 2.0 when the primitive is selected or 0.0 when it is not
EmissiveR8G8B8A8_UNORMRGBA8UI4 8-bits unsigned int. The first 3 represent the color of the emissive value. The last one (A) is currently unused
ObjectIdPrimitiveIdR32G32B32A32_UINTRGBA32UI4 8-bits unsigned int. The first unsigned is composed of the sceneID (first 2 bits) and the occurrenceID (6 last bits). The second one contains the primitiveID. The last 2 unsigned are coordinates x and y of tangents, put as int using
floatBitsToUint
. They are obtained by computing
floatBitsToUint(tangent * 0.5 + 0.5) = storedTangent
UVsR32G32B32A32_SFLOATRGBA32F4 32-bits floats. The first 2 represent UV0, the last two represent UV1
SSAOR8_UNORMR8UISingle 8-bits unsigned int representing the Screen Space Ambient Occlusion computed value (when SSAO or SSGI are activated)
IndirectLightingR8G8B8A8_UNORMRGBA8UI4 8-bits unsigned int representing the computed indirect lighting (when SSGI is activated)

Viewer properties

Viewer properties can be get/set using view.getViewerProperty and view.setViewerProperty.

Property

Type

Description

OcclusionCullingEnabledBoolean
DepthReprojectionEnabledBoolean
ReprojectionResolutionDivisionInt
SelectionOverlayEnabledBoolean
ShowPolygonsBoolean
ShowEdgesBoolean
ShowPatchesBoolean
ShowBRepsBoolean
ShowLinesBoolean
ShowPointsBoolean
UseVertexColorBoolean
UseNormalMapsBoolean
InvertVisibilityBoolean
UpdateHLODsBoolean
HLODErrorPixelCountInt
BackFaceCullingEnum: BackFaceCulling, BackFaceColor, DoubleSided
LineWidthReal
WireframeWidthReal
PointSizeReal
WireframeColorColor
NonManifoldColorColor
EdgeBorderColorColor
PointColorColor
LineColorColor
PatchBorderColorColor
UseUVAsPositionBoolean
UVChannelEnum: UV0, UV1
RenderCompositedBoolean
RenderAlbedoOpacityBoolean
RenderMetallicRoughnessAOMetaBoolean
RenderNormalBoolean
RenderEmissiveBoolean
RenderObjectIdPrimitiveIdBoolean
RenderUVsBoolean
RenderSSAOBoolean
RenderIndirectLightingBoolean
UseSSAOBoolean
SSAOBlurBoolean
SSAOBlurSizeInt
SSAORadiusReal
SSAOAmplitudeReal
UseSSGIBoolean
SSGIQualityEnum: Low, Medium, High, VeryHigh
SSGIThicknessReal
SSGICoeffReal
SSGIFilteringPassesUInt
UseFXAABoolean
ExplodeCenterPoint3
ExplodeFactorPoint3
EnvironmentFilePath
CubeMapSizeInt
PrefilterMapSizeInt
IrradianceMapSizeInt
ExposureCoeff
ShowBackgroundBoolean
BackgroundColorColorAlpha
CubemapRotationBoundedInteger
BlurMapBoundedInteger
EnableToneMapingBoolean
UseEnvironmentMapBoolean
AmbientColorColorAmbientColor will be used only if useEnvironmentMap=False
UsePoseBoolean
ShadowsEnabledBoolean
ShadowMapResolutionInt
ShadowCullingEnum: FrontFaceCulling, DoubleSided
DepthBiasReal
UsePCFBoolean
ComputeLastAABBBoolean