Posts

Getting maximum possible texture size and GPU memory available

Getting maximum possible texture size Material is based on OpenGL Wiki page: https://www.khronos.org/opengl/wiki/Textures_-_more     int max_tex_size;     glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size);       cout << "GPU maximal 2D texture size: " << max_tex_size << endl; For 3D texture: GL_MAX_3D_TEXTURE_SIZE For cubemap texture:GL_MAX_CUBE_MAP_TEXTURE_SIZE Getting total and available GPU memory for NVidia cards Material is based on the article How to Know the Graphics Memory Size and Usage In OpenGL by JEGX: https://www.geeks3d.com/20100531/programming-tips-how-to-know-the-graphics-memory-size-and-usage-in-opengl/     #define GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX 0x9048    #define GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX 0x9049     GLint total_mem_kb = 0;     glGetIntegerv(GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX, &total_mem_kb...

Computing ray origin and direction from Model View Projection matrices for raymarching

When performing raymarching (as well a raycasting and raytracing) using fragment shaders in OpenGL, it's required to compute ray's origin and direction. Here we will give solution for finding it from the Model View Projection matrices in OpenGL, implemented in openFrameworks. Using it, you can combine raymarching/raycasting/raytracing with forward OpenGL rendering, so obtain hybrid rendering modes. Also, you can use it for creating VE applications based on raymarching or hybrid rendering. (Actually, we checked what this approach is corrent by creating VR rendering app in HTC Vive). The algorithm can be used on any OpenGL platform with any language supporting matrix inversion computation (in our case it's C++ with GLM library, included in openFrameworks 0.10.1). The approach is based on this hint by  GClements in this discussion on the topic: https://community.khronos.org/t/ray-origin-through-view-and-projection-matrices/7257...

Morphing point clouds algorithm

In some sense, point cloud is an universal medium for representing 2D and 3D vector objects and raster images/volumes. Namely, each 2D or 3D raster (image/volume) can be treated at least in two opposite ways: as a grid of points, where each point posess the color and opacity, without overlapping. as a set of points, where each point has pure grayscale, reg, green or blue color, and almost transparent. So many points overlapped additively and get required colors.  Of course, there are possibilities between this polar cases. Each 2D or 3D vector object (curve/surface) can be filled points so dense, that when viewing it on a rester display, it looks like just vector object. Such representation of an objects from a "sand" points gives opportunities of free morphing objects. So, consider the following problem. Let A and B are two point clouds of size N of equal color and transparency. It's required to create bijective mapping k_i, that {A_i}->{B_...

Raymarching in Shadertoy, openFrameworks and Unreal Engine

Raymarching is a special method of rendering 3D objects or 3D scene: It's used for rendering ocean water, clouds, metaballs in Unreal Engine 4 and other engines and 3D editors. It's a main technique used for rendering 3D in Shadertoy projects. Examples Shadertoy projects of rendering generative volumes, clouds, ocean and skybox reflections: Sculpture III by iq: https://www.shadertoy.com/view/XtjSDK , see more at http://www.iquilezles.org/www/articles/raymarchingdf/raymarchingdf.htm https://www.shadertoy.com/view/MsfGRr https://www.shadertoy.com/view/lss3zr https://www.shadertoy.com/view/XslGRr https://www.shadertoy.com/view/llsXD2 https://www.shadertoy.com/view/XsB3Rm stochastic ray trace by Otavio Good https://www.shadertoy.com/view/WlfXRr  Metaballs and volumetric clouds in Unreal Engine 4: https://www.youtube.com/watch?v=ZbLCIcTHup4 https://www.youtube.com/watch?v=hWNX9jGEt8k Claybook game is made entirely in similar technique: https://www.youtube.com/...

Raytracing APIs

Raytracing is a most powerful technique for making photorealistic 3D images. It's based on literal tracing light's rays path, and requires a lot of computtional resources. See theory of raytracing in a sample chapter of the book Real-Time Rendering, Fourth Edition . Currently NVidia RTX videocards are dedicated to work with raytracing in realtime, and so realtime raytracing becomes the main tool for 3D graphics. There are two main directions for raytracing API: using NVidia RTX cards and Intel CPU. Withoud such special API, raytracing (and reymarching and raycasting) can be implemented directly, for example, in fragment shader, for example, see such shaders on Shadertoy site. NVidia RTX  NVidia RTX videocards allows to work with NVidia's OptiX or Microsoft DirectX: https://developer.nvidia.com/rtx Raytracing with NVidia OptiX raytracing engine: https://developer.nvidia.com/optix https://developer.nvidia.com/rtx/raytracing See tutorial: https:/...

Programming VR with openFrameworks

To work with VR using openFrameworks, you can use ofxOpenVR addon: https://github.com/perevalovds/ofxOpenVR It's implementation of Valve Software's OpenVR API, which was originally developed by smallfly https://github.com/smallfly/ofxOpenVR , next I forked it into Kuflex repo, and finally to my repo. The most important fix comparing original version is about problem of one eye's vertical shift due matrices computations errors. This addon lets create VR applications (using HTC Vive) on openFrameworks, Windows 10. It's using oF's programmable render. Requirements HTC Vive (though, it is not required to compile projects, just to deploy) and Steam VR Visual Studio 2017 openFrameworks 10.1 ofxOpenVR addon folder, which should be placed to openFrameworks/addons/ofxOpenVR. Running examples To check addons is working, compile and run its examples located in openFrameworks/addons/ofxOpenVR . There are two examples: exam...

Compact platforms for computer vision and AI computations

Currently there are two main brands for compact AI: Intel and NVidia. Intel Myriad Site: https://www.movidius.com/ "Intel's Myriad ™ X VPU features a fully tune-able ISP pipeline for the most demanding image and video applications. The Intel ® Movidius™ Myriad ™ X VPU also features hardware based encode for up to 4K video resolution, meaning the VPU is a single-chip solution for all imaging, computer vision and CNN workloads." Particular products: Compact systems: https://up-shop.org/home/285-up-squared-ai-vision-x-developer-kit.html Intel neural compute stick https://software.intel.com/en-us/neural-compute-stick Example of using with Raspberry Pi: https://www.intel.ai/practical-applications-of-deep-learning-build-a-diy-smart-security-camera-using-the-intel-movidius-neural-compute-stick/#gs.7g7fgl NVidia Jetson Site: https://developer.nvidia.com/buy-jetson "NVIDIA® Jetson™ systems provide the performance and power efficien...