minOS mystery on macOS

Recent sView 20.08 release includes macOS builds – again after a three years break of macOS support. Release promises support of OS X 10.10 and later, but several users have reported a very strange thing – macOS 10.13 and 10.14 declined to start an application indicating that sView requires macOS 10.15 or later for unknown reason…

sview_macos_error.png

This error has deeply puzzled me, as I have personally installed sView on OS X 10.10 without any errors – an older macOS version than reported by users. A nonsense I would say!

Continue reading

PBR in OCCT 3D Viewer

Next OCCT 7.5.0 release will add a new PBR (physically-based rendering) mode to real-time rendering engine. OCCT implements PBR metal-roughness material workflow described by core glTF 2.0 specifications and also includes glTF data exchange components. New functionality opens a door to a new level of realism and visual quality of displayed models, and improves interoperability across various 3D engines supporting the same material workflow.

cadass14_helmet5.png

Continue reading

OCCT receives OpenVR support

Release of “Half Life: Alyx” for Virtual Reality shown to me, that VR is not only about funny mechanics. Exploration of deeply detailed world can be joyful even without interactions, although they make world more realistic.

This reminded me about unfinished two-years-old patch for Open CASCADE Technology adding OpenVR support. Looks like a good time to complete the patch!

Continue reading

sRGB color space in OpenGL

RGB (red+green+blue) is the most commonly used color model, and computer graphics is not an exception. Mixture of red, green and blue (also called primaries for RGB) with different proportions allows defining any other color distinguishable by the human eye, which is known to everybody from early school days.

Artists, however, usually aware of much more terms with and without RGB in name – sRGB, AdobeRGB, scRGB, DCI-P3, Rec. 2020, wide-gamut RGB. And developers of graphics applications, including 3D Viewer, should be aware of them too.

CIE1931xy_gamut_comparison.svg.png

Color spaces comparison chart
from Wikipedia.

Continue reading

Atomic float arithmetic on GPU

Mutex is an essential tool for any multi-threaded application. But when it comes to small primitive types, and not structures, there are more options to consider.

Atomic operations, or simply atomics, are handy CPU or GPU instructions allowing to concurrently modify a value of primitive type without involving expensive tools like mutexes.

This small article is not intended to clarify usage of atomic operations, but to share a tricky experience of such operations in GPU program.

iss_tiles_vis_error.png

Continue reading

AIS_ViewController in OCCT 7.4.0

Open CASCADE 7.4.0 brings new handy class AIS_ViewController.

3D Viewer needs handling mouse input to bring interactivity to it. AIS_ViewController class takes responsibility for mapping user input events (mouse, keyboard, etc.) onto 3D viewer camera manipulations (rotation, panning, zooming) as well as highlighting objects in scene. Basically, it provides a more solid, cross-platform interface to V3d_View and AIS_InteractiveContext methods. AIS_ViewCube is another new class in OCCT 7.4.0 displaying an interactive cube for selecting 3D viewer camera direction.

occt_draw_view_cubes

As existing OCCT users might be curious what AIS_ViewController is, I have decided writing a small memo in Questions & Answers form.

Continue reading

GL_R16 and OpenGL ES on Android

sView user on Android device just sent me a link to online stereoscopic 3D video with yuv420p10 pixel format… and it is not an anime. The user complained about green screen in the player instead of a video. So far I haven’t seen much videos with more than 8-bit per channel in a wild, and appearance of such files in online services surprised me.

FFmpeg decodes such videos into pixel formats like AV_PIX_FMT_YUV420P10LE. This pixel format has 10-bit per-channel payload, but actually aligned into 16-bit per-channel planes. sView uploads such pixel formats into GL_ALPHA16 textures, which has been implemented a long time ago. After some investigation, I figured out that there is no OpenGL ES implementation supporting such texture format, and the only direct counterpart is GL_R16_EXT (normalized 16-bit red channel only format, same as GL_R16 on desktop), which is not yet in any core OpenGL ES specs, and requires extension GL_EXT_texture_norm16.

By the way, all this “deprecation thing” applied to useful texture formats like GL_APHA8, replaced by GL_R8 for no profit within OpenGL 3+ on desktop, always confused be. Applications supporting wide range of OpenGL drivers (including OpenGL 2.1) has to be messed up with different code per OpenGL version for exactly the same thing! As texture swizzling came later (and also messed-up API), fallback requires dummy GLSL code modifications fetching .r or .a of texture sample color.

Apparently, so far just two vendors support GL_EXT_texture_norm16 extension – Qualcomm Adreno and NVIDIA Tegra, which is quite predictable considering links to desktop graphics in their past. Testing on Adreno device has shown good playback performance of given video sample.

Unfortunately, devices with Mali graphics do not support this extension, leading to bad performance due to software conversion via SWScaler. Possible solution would be uploading planes into GL_R16UI textures (which is included into OpenGL ES 3.0 specs, but integer formats do not support texture filtering) and either implement texture filtering via GLSL program or convert it further into GL_R32F format (the latter one seems to be implemented by some internet browsers).

Displaying Mesh Edges in OCCT

Mesh displayed in OCCT 3D Viewer might come from different sources – imported from external file (glTF, JT, STL, PLY, OBJ), computed for analytical BRep geometry by BRepMesh and ExpressMesh algorithms or generated directly by application code.

interior1_persp_glsl_msaa.png

Draw Harness test case for Mesh Edges.

The mesh is usually displayed shaded, but this presentation is not suitable for analysis of mesh structure. In many cases, application developer needs other mesh presentations to locate issues (too many details, not enough details, local deviations, etc.) and make corrections based on analysis results (adjust mesh generation or export parameters).

In this case, mesh edges presentation becomes very helpful. Continue reading