Flow render engine

Sat 15 February 2020
written by Xavier Figuera Sun 02 April 2023

What is real-time rendering?

The rendering concept, must be seen as an automatic process generation of a photorealistic or non-photorealistic image of a geometric data source, this data source can come from different sources, such as parsed files with a data export tool, these data represent a model to render, the models can be in 3D space or 2D space, although in a real-time rendering, three-dimensional objects are usually rendered.

The real-time concept in this case, must be understood as the images are generated online, and its generation rate is fast enough, so that the sequence of images looks like an animation that simulates something. This is the most highly interactive area of computer graphics. The rendering cycle occurs at a speed fast enough so that the viewer does not see individual images, but immerses himself in a dynamic process.

The rate at which images are displayed is measured in frames per second (FPS) or Hertz (Hz). At around 6 FPS, a sense of interactivity starts to grow, 24 FPS might be acceptable and is certainly real-time, but a higher rate is important for minimizing response time. Video games runs to 30, 60, 72, or higher FPS. From about 72 FPS and up, the human eye cannot detect any differences in display rate. For this rates, the interactivity sense is total, so a good performance is to achieve $ \approx $ 15-16 milliseconds of temporal delay between frames.

Not only speed is the only criterion in the real-time rendering concept, as has been said, real-time rendering usually involves producing three-dimensional images, therefore, if interactivity is combined with three-dimensional rendering, there are sufficient conditions for obtain real-time rendering, but there is a third element that, if combined with the concepts explained, completes the definition: the graphics accelerator hardware.

This type of hardware dedicated to three-dimensional graphics has been available in professional workstation for many years, at the consumer level is available from 1996 when appeared the first graphic card accelerators called 3Dfx Voodoo 1. In recent years, there has been a rapid evolution in this area, and nowadays every computer, tablet, video game console and mobile phone, comes with a built-in graphics card processor, this evolution in graphics hardware has powered a widely research in the field of interactive computer graphics.

Popular application areas of real-time rendering are video games, scientific computation visualization systems, CAD systems, flight simulation, industry software simulation, virtual reality, architecture, among others.

What is a real-time rendering engine?

A real-time rendering engine is a middleware that plays a fundamental role in different real-time or interactive graphics applications.

The engine takes graphics primitives in 3D space normally as input and generates real-time images as output. The real-time concept in this case, should be understood as that the images are generated online and the generation rate is fast enough so that the sequence images looks like an animation that simulates something as described above in what is a real-time rendering? section.

Middleware users are mainly application developers. For application developers, a rendering engine is a software development kit. More precisely, a rendering engine consists of a set of reusable modules, such as static or dynamic link libraries. By using these libraries, developers can focus on the business logic of the application, without diverting attention to rather complicated graphics rendering issues.

In most cases, a professional rendering engine, usually does rendering tasks better than the programs written by application developers who are not computer graphics professionals. Meanwhile, adopting a good rendering engine in application development projects, can reduce the development period, since lots of complex works are done by the rendering engine and, consequently, development costs and risks are alleviated.

There are divers rendering engines, that are available as commercial packages and open-source projects as well, here we present Flow Render Engine.

Flow Render Engine Presentation

Flow render engine is a real-time render engine written in C++11/C++14 totally object oriented and modular, the engine was written from scratch seeking a couple of targets, first, document how to design a real-time render engine in modular way with a solid structure and second, it builds a middleware to make it easier and intuitive for developers to produce computer graphics applications utilising 3D hardware-accelerated. In some cases, Ogre3D, Wild Magic and Magnum have served as inspiration to build a real-time rendering engine from scratch. Wild Magic nowadays is no longer maintained and has been replaced by Geometric tools engine.

The documentation about how to design a real-time render engine seeks to be a lightweight documentation, understandable running away for complexities.

The engine is developed in layered fashion way, for reach this modularity uses design patterns and defines different interfaces among other techniques. These layers decouple different responsibility levels see engine architecture. The library abstracts all about details using the underlying graphics libraries, such as OpenGL, Vulkan and Direct3D defining an understandable rendering interface as a plug-in, it being possible loaded at run-time.

Flow render engine is not a game engine, it’s only a graphics solution, however, Flow render engine could be used to make games, but for features like physics, collisions, AI, networking, sound etc, you will need to integrate third-party libraries according to the needs of the project, in this manner the engine not enforcing a particular set of libraries with an inbuilt set of assumed requirements.

However, the engine implements an own mathematical library with the common mathematical functions for computer graphics and has embedded an OBJ importer, so it’s not needed third-party libraries for a basic loading of models.

All the real-time simulations such as games, simulations, graphics applications require cameras and effects, cameras give the point of view of which the 3D perspective scene is rendered, so the engine implements perspective and orthographic cameras. Effects are an important feature in a real-time rendering engine, because they make the rendered scenes more realistic and consequently closer to reality, although sometimes simply make them much more amazing.

The effects involves different techniques and objects such as textures, materials and lighting models, everything was implemented inside the engine from an essential point of view, being scalable if applicable, it's worth pointing out, that in modern graphics approach everything is ruled via shaders, so the shaders has an important role here, consequently the engine implements an effects system with factory approach with a shader parser system, that supports the effects implemented with a specific structure.

Finally, the engine comes with different demos as example how to implement applications over the engine and show the engine rendering capabilities, see rendered scenes and online Emscripten demos.

The following video shows some scenes rendered with the engine showing its rendering capabilities.




Supported platforms

  • Windows with MSVC staring from 2015 onwards and MinGW, with target platforms i686, x64.
  • Linux with gcc 5.1 onwards, tested on Ubuntu 18.04.4 LTS onwards.
  • Web (Webassembly or asm.js) via Emscripten.
  • To manage building process in different operating systems and compilers, the project uses CMake.

Engine Features

  • API with fluent interface approach for more readable code.
  • Rendering interface completely decoupled of graphic API implementation.
  • Rendering interface implementation designed as a plug-in, interchangeable at runtime, so it's possible to render with different graphic APIs, such as OpenGL, OpenGL|ES, Vulkan, or Direct3D without recompiling the engine.
  • Dynamic and static plug-ins are supported.
  • Different managers with a factory approach, to create and manage different engine resources.
  • Different window systems supported for Windowed applications totally decoupled from operating system with an interface definition. GLFW and SDL2 toolkits are integrated, another toolkits integrations could be possible.
  • Real-time rendering using OpenGL 3.3 and OpenGL|ES 3.2 for now with 2D and 3D.
  • No third-party math library is used, own implementation is provided.
  • The engine provides a basic shader system, vertex and fragment shader are supported written in GLSL 3.x or GLSL|ES, with a specific structure.
  • Direct geometry import with Wavefront OBJ file format with own parser, triangulate faces supported only, no third-party libraries are used.
  • Normals, tangents and bi-tangents calculation procedurally on CPU or in real-time on GPU.
  • Direct textures import with several image file formats: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC via lightweight std_image.h library to import images.
  • Camera models supported: perspective and orthographic projection.
  • No scene graph is supported for now, lineal access to render queue without culling techniques is implemented.Working on scene graph integration.
  • 2D textures supported.
  • Local Effects.
  • Full web platform supported via Emscripten. The de-facto standard toolkit for web platform is SDL2 to create windows, keyboard and mouse handling, GLFW 3.3.8 system is also supported but not works properly on web platform however, it works perfectly on desktop version.
  • The de-facto standard engine GUI is Dear ImGui, it’s fully integrated on engine to create rendered user interfaces, see Shaper super formula demo. Other GUI’s integrations could be possible.
  • Mouse and Keyboard system works with different toolkits selectable in compile time, these are SDL2 or GLFW, the engine defines Flow Events to wrap the different subsystems in only one definition.
  • Screenshots are possible from desktop and web platform.

Textures

  • Single texturing and multi-texturing supported.
  • Sky-boxes support.

Local Effects.

  • Basic shading (Gouraud, Lambert, Phong and Blinn shading).
  • Lighting (Directional, Point and Spot light).
  • Materials.
  • Normal Maps.
  • Material Capture

Math library features

  • Vectors.
  • Matrices.

Geometric Transformations.

  • Translations.
  • Scaling.
  • Rotations.

Viewing Transformations.

  • Projection matrix.
  • View matrix(lookAt).
  • Rotation matrix(yawPitchRoll).