|
rtEngine is a library for forming a photorealistic image by means of ray tracing. It became as easy and comfortable as never before to generate fantastically beautiful images when the program is running and to save them in any suitable format. The set of C++ classes in the rtEngine library allows software developers to get images with just a few lines of code. Any modeling system already cannot do without a photorealistic image of modelled objects.
Specifying the parameters of the atmosphere, several types of light sources, a comprehensive choice of classes for texturing objects with both parametric textures and photos, fixing the aliasing effect, controlling the tracing algorithm and speeding it up - here is a small list of what is implemented in the rtEngine library.
Simple integration with the sgCore library is another great advantage of the rtEngine library. The demo application shows one of the ways of such integration.
Everything necessary for generating high-quality 3D images can be found in the rtEngine library.
Let us enumerate and illustrate the features of the rtEngine library:
- Specifying the unlimited number of light sources with different parameters (point, cylindrical, directional light sources):
- Changing the background color, the parameters of the atmosphere and environment, specify fog, its thickness, the level of light attenuation in the environment and refraction (which allows you to create the effect as if the camera was in water, for example):
- A powerful set of functions for texturing - there is a fixed set of textures (brick, solid, etc.) and there are classes for parametric texturing and superimposing an image from a file on an object:
- Multiple parameters of object materials - from mirror flare to refraction and roughness coefficients:
- Enabling and disabling anti-aliasing in the final image:
The rtEngine library has effects with cameras and with normal lines of objects embedded in it. It will be implemented in the next versions of the library
The ray tracing method is complicated mathematically, but simple conceptionally. What the computer actually does is tracing light rays come from the source to the eye. When rays come as if from the eye to the source instead of coming from sources to the eye, it is called reverse tracing (unlike the first one - direct).
Reverse tracing is more effective because it ensures that the number of rays reaching the eye is exactly the same as the number of pixels in the image.
To imagine it, consider the screen of your monitor as a window through which you can look at a 3D model drawn by your computer. Imaginary lines called rays are drawn from your eye through each pixel on the screen and are projected on the model.
Each time a ray intersects some surface in some point, additional rays are emitted from that point. If the surface is a reflecting one, a reflected ray is generated. If the surface lets light through, a ray coming through the surface is generated and the fact that the ray changes its direction when going from one environment to another is taken into account.
This phenomenon is called refraction. Some surfaces reflect rays and let them through at the same time.
Both types of rays are emitted in this case. These rays are traced in the entire model and if rays intersect other surfaces, new rays are emitted.
In each point where the ray intersects a surface, a shadow ray is drawn from the intersection point to each light source. If this ray intersects another surface before it reaches the light source, a shadow from the surface blocking light is cast on the surface the ray comes from.
Mathematically, all these rays together with data about physical characteristics of objects of the model (color, transparency, reflectivity, etc.) allow the computer to determine the color and its intensity for each point of the image.
|