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 |
|---|---|---|---|
| Composited | R8G8B8A8_UNORM | RGBA8UI | 4 8-bits unsigned int containing the color of the composited image |
| AlbedoOpactity | R8G8B8A8_UNORM | RGBA8UI | 4 8-bits unsigned int containing the albedo (RGB) and the opacity (A) |
| Normal | R32G32B32A32_SFLOAT | RGBA32F | 4 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 |
| Depth | D32_SFLOAT | R32F | Single 32-bits float representing the depth (not linearized) |
| MetallicRoughnessAOMisc | R8G8B8A8_UNORM | RGBA8UI | 4 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 |
| Emissive | R8G8B8A8_UNORM | RGBA8UI | 4 8-bits unsigned int. The first 3 represent the color of the emissive value. The last one (A) is currently unused |
| ObjectIdPrimitiveId | R32G32B32A32_UINT | RGBA32UI | 4 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 |
| UVs | R32G32B32A32_SFLOAT | RGBA32F | 4 32-bits floats. The first 2 represent UV0, the last two represent UV1 |
| SSAO | R8_UNORM | R8UI | Single 8-bits unsigned int representing the Screen Space Ambient Occlusion computed value (when SSAO or SSGI are activated) |
| IndirectLighting | R8G8B8A8_UNORM | RGBA8UI | 4 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 |
|---|---|---|
| OcclusionCullingEnabled | Boolean | |
| DepthReprojectionEnabled | Boolean | |
| ReprojectionResolutionDivision | Int | |
| SelectionOverlayEnabled | Boolean | |
| ShowPolygons | Boolean | |
| ShowEdges | Boolean | |
| ShowPatches | Boolean | |
| ShowBReps | Boolean | |
| ShowLines | Boolean | |
| ShowPoints | Boolean | |
| UseVertexColor | Boolean | |
| UseNormalMaps | Boolean | |
| InvertVisibility | Boolean | |
| UpdateHLODs | Boolean | |
| HLODErrorPixelCount | Int | |
| BackFaceCulling | Enum: BackFaceCulling, BackFaceColor, DoubleSided | |
| LineWidth | Real | |
| WireframeWidth | Real | |
| PointSize | Real | |
| WireframeColor | Color | |
| NonManifoldColor | Color | |
| EdgeBorderColor | Color | |
| PointColor | Color | |
| LineColor | Color | |
| PatchBorderColor | Color | |
| UseUVAsPosition | Boolean | |
| UVChannel | Enum: UV0, UV1 | |
| RenderComposited | Boolean | |
| RenderAlbedoOpacity | Boolean | |
| RenderMetallicRoughnessAOMeta | Boolean | |
| RenderNormal | Boolean | |
| RenderEmissive | Boolean | |
| RenderObjectIdPrimitiveId | Boolean | |
| RenderUVs | Boolean | |
| RenderSSAO | Boolean | |
| RenderIndirectLighting | Boolean | |
| UseSSAO | Boolean | |
| SSAOBlur | Boolean | |
| SSAOBlurSize | Int | |
| SSAORadius | Real | |
| SSAOAmplitude | Real | |
| UseSSGI | Boolean | |
| SSGIQuality | Enum: Low, Medium, High, VeryHigh | |
| SSGIThickness | Real | |
| SSGICoeff | Real | |
| SSGIFilteringPasses | UInt | |
| UseFXAA | Boolean | |
| ExplodeCenter | Point3 | |
| ExplodeFactor | Point3 | |
| Environment | FilePath | |
| CubeMapSize | Int | |
| PrefilterMapSize | Int | |
| IrradianceMapSize | Int | |
| Exposure | Coeff | |
| ShowBackground | Boolean | |
| BackgroundColor | ColorAlpha | |
| CubemapRotation | BoundedInteger | |
| BlurMap | BoundedInteger | |
| EnableToneMaping | Boolean | |
| UseEnvironmentMap | Boolean | |
| AmbientColor | Color | AmbientColor will be used only if useEnvironmentMap=False |
| UsePose | Boolean | |
| ShadowsEnabled | Boolean | |
| ShadowMapResolution | Int | |
| ShadowCulling | Enum: FrontFaceCulling, DoubleSided | |
| DepthBias | Real | |
| UsePCF | Boolean | |
| ComputeLastAABB | Boolean |