This article studies the generation of 3D animation simulation based on gray value algorithm and fractal interpolation algorithm. The article uses fractal technology combined with the Diamond-Square algorithm to generate height data and then color it. This algorithm optimizes the 3D animation process. The results show that the algorithm is fast in generating speed and only needs to input a few simple animation parameters to generate different 3D animations.
- Diamond-square algorithm
- Fractal and fractal technology
- Three-dimensional animation simulation
The most used method in practical applications is based on the real-time generation technology of digital 3D animation models. Due to the huge original data set of real three-dimensional animation, the real-time display requires high hardware. Many applications do not need to simulate the real 3D animation data in a specific area but hope to flexibly generate 3D animations with different characteristics to meet different requirements . We need to temporarily add a 3D animation with good visual effects as an auxiliary environment modeling to ensure the realism of the entire virtual environment. It is not economical and applicable to still use the 3D animation generation method based on DTM data. But the application of fractal technology to generate three-dimensional animation can solve this problem. We can use fractal technology to realize the generation of realistic virtual three-dimensional animation with as little data as possible.
Fractal 3D animation modeling is a very important part of 3D animation modeling. Many fractal 3D animation models are related to the mathematical model of fractal Brownian motion. Fractal Brownian motion provides a method of interpolation between known data points. It is very effective for generating connections between known 3D animation data points. Many methods can produce Brownian motion. Fractal 3D animation modeling methods can be roughly summarized into five categories: midpoint displacement method, Poisson step method, Fourier filter method, successive random increase method, and band-limited noise accumulation method.
The midpoint displacement method is also called the random midpoint displacement method. This is the simplest and classic method, and it is also a direct application of fractal Brownian motion. The elevation of the midpoint of the line segment whose end elevation is known is the average of the elevations of the two endpoints . After displacement, the two line segments are subdivided and displaced by the midpoint, as mentioned earlier, and recursively until the required resolution is met. We generalize it to two dimensions. According to the different ways of surface meshing, the simulation can be divided into triangle edge subdivision method, square-square subdivision method, rhombus-square method, and other methods. The realization idea is similar to one-dimensional.
A typical triangle edge subdivision method is shown in Figure 1. The subdivision method divides the sides of the triangle equally and then connects the spare midpoints. Such a triangle becomes four small triangles . Then add a Gaussian random offset to each midpoint. The following formula gives its standard deviation:
As shown in Figure 2, the position coordinate elevation value of the interpolation point is determined by the weight ratio of 9:3:3:1. The closest point has the largest weight coefficient. This interpolation method constitutes the effect of a double quadric surface. One of its important advantages is that the normals of the landscape surface are continuous, so the “crease phenomenon” in the triangle subdivision method is eliminated . In addition, due to the effect of the double quadric surface, the contour of the landscape constructed by this algorithm is relatively soft. We can also make the surface rougher by reducing H.
Although the midpoint displacement method is simple and fast, it is usually difficult to predict the approximate shape of the generated result. Some improved algorithms have appeared in response to this problem.
Perform fractal interpolation in two-dimensional space to generate fractal three-dimensional animation data. Two-dimensional FBM is a very effective fractal model. The realistic three-dimensional animation surface is used as a random fractal, so we can use fractal FBM to describe it better . There are many ways to construct fractal FBM at present. The most commonly used methods are the random midpoint displacement method based on grids and the random midpoint displacement method based on triangles. The former method is suitable for grid three-dimensional animation data with regular divisions. At present, most 3D animation models use grid 3D animation data. This article uses this method to build a fractal three-dimensional animation surface.
The midpoint offset method in three-dimensional space is developed from one-dimensional space. The FBM curve is generated in one-dimensional space by dividing the initial line segment into two equal parts. It is generated by adding an appropriate Gaussian variable at each midpoint. Applying the midpoint offset rule in three-dimensional space is slightly different from this. In the three-dimensional space, a three-dimensional animation with FBM characteristics should be generated . We can use the idea of a midpoint shift offset on a two-dimensional base plane to generate the third coordinate of the point. This can complete the modeling process of the desired mountain range (Figure 3).
In the three-dimensional space O-XYZ, choose the square OABC on the XOY plane as the base plane. We set the horizontal projection of the space point
As shown in the figure above, cross the midpoint M and make two parallel lines DEFG on opposite sides. It can divide the square into four smaller squares. We need to obtain the height values ZD, ZE, ZF, ZG at the midpoints of the four sides of the square base plane. The purpose is to determine the height values at the four corners of each small square . The height values at these midpoints can be obtained from the average of the known height values closest to it. like
Repeating the above process for each small square can be divided into smaller square grids. At the same time, more three-dimensional point elements with height values are generated. After many iterations, when the density of the three-dimensional point element reaches the requirement, we can get the data model of the geometric object with FBM characteristics.
First, discuss the numerical calculation formula of random displacement. Generally, the following formula is used:
The above three calculation formulas all use the Gaussian function gauss(). This function does not exist in the C language library function. It would help if you defined your definition based on the central limit theorem in probability theory to sum multiple rand() random numbers and average them. So we have to reduce the speed of fractal 3D animation simulation. Many games and computer simulations that simulate fractal 3D animation generally use the following calculation formulas to achieve real-time requirements:
The rhombus-square method mainly uses the cyclic method to encrypt the raster three-dimensional animation data to generate a three-dimensional animation with any resolution. At the same time, the contradiction between the amount of calculation and the fidelity of the three-dimensional animation is well balanced . So it has become an important method for fractal 3D animation simulation. The following are the commonly used algorithms:
Generate 3D grid fractal 3D animation surface between 3D animation areas
Parameter description: Intn is the recursion depth.
Variable description: float xmid, ymid are the midpoint coordinates.
Call function description:
Use OpenGL function to divide grid (
//If the number of recursions is zero, the three-dimensional surface is displayed, and the recursive loop is jumped out;
//Perform the elevation of the midpoint of line segment A and B
//Perform the elevation of the midpoint of line segment A and D
//Perform the elevation of the midpoint of line segments B and C
//Adjust the elevation of the midpoint of line segments C and D
//Fractal perturbation of the height of the midpoint of the line segments A, B, C, D
} Otherwise, the elevation of each midpoint of the area undergoes fractal disturbance. Then the number of recursions is reduced by 1, and the area is divided into four by one. We generate fractal surfaces for each sub-region respectively.
The above gives a brief overview of the fractal landscape modeling algorithm. Due to the complexity of real natural scenes, the amount of calculation for realistic simulation of natural scenes is still very large. Therefore, it is particularly necessary to explore some efficient algorithms. Especially in the virtual simulation system, it is usually desired to produce the effect of real-time animation, so the algorithm's efficiency is more important. Although the midpoint displacement method is simple and fast, it is usually difficult to predict the approximate shape of the generated result. Some improved algorithms have appeared in response to this problem. For example, the basic shape and outline of the generated graphics are not controlled by the given number of initial iterations and initial iteration data.