Game image generation method and system based on 3D rendering engine
By calculating the eye-catching and attention of intersecting objects in the game engine, optimizing the LOD-level rendering resource allocation, solving the abrupt picture and detail tearing problems in game image generation, achieving better rendering effects and resource utilization.
Patent Information
- Application Number
- CN202411977198.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The existing 3D rendering methods have problems such as abrupt picture and tear in the game image generation, especially when the camera perspective is constantly switched, resources are seriously wasted, affecting the rendering effect.
By obtaining intersecting objects in the game engine, calculating their eye-catchingness, filtering suspicious objects, combining the historical data of user perspective and the motion characteristics of intersecting objects, calculating attention, optimizing the LOD-level rendering resource allocation, and ensuring smooth transition of the picture.
The resource allocation strategy is optimized to avoid sudden screen switching and tearing, ensure the rendering effect of game images, and save rendering resources.
Smart Images

Figure CN119904566B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of game image generation, and in particular to a game image generation method and system based on a 3D rendering engine. Background Art
[0002] As a core component of game graphics generation, 3D rendering engines bear the crucial task of transforming virtual worlds into real-world experiences. By meticulously managing scenes, models, lighting, and materials, 3D rendering engines are able to produce impressive game graphics in real time. Currently, two types of rendering technologies are used in the industry: real-time rendering and offline rendering. Offline renderers require recompilation for every scene change, even if the change may be minor, such as changing the color of a light, changing the camera angle, or moving a character. Real-time rendering engines, on the other hand, provide near-instantaneous results. However, real-time rendering requires operating within limited computing resources, which limits complexity and image quality. View distance culling and level of detail are two commonly used optimization techniques in real-time rendering engines. Their primary purpose is to reduce the number of objects and geometric complexity that the rendering engine must process, thereby improving rendering efficiency. Conventional LOD (Level of Detail) levels are matched based on the distance between the object and the camera's perspective, but they are only suitable for static images. When there are dynamic elements in the image and when the camera's perspective is constantly switching, this LOD matching strategy wastes rendering resources, and causes problems such as abrupt images and torn details, affecting the 3D rendering effect of the game image. Summary of the Invention
[0003] In order to solve the problems of abrupt images and torn details when generating game images using existing 3D rendering methods, the present invention aims to provide a method and system for generating game images based on a 3D rendering engine. The technical solutions adopted are as follows:
[0004] In a first aspect, the present invention provides a method for generating a game image based on a 3D rendering engine, the method comprising the following steps:
[0005] Get the intersecting objects in the current game engine's 3D model that intersect with the surface of the viewing frustum;
[0006] The eye-catching degree of each intersecting object is obtained based on the overlap between the bounding box of each intersecting object and the viewing frustum, the change in the physics engine information of each intersecting object, and the relative distance between intersecting objects on the same surface of the viewing frustum. The eye-catching degree is used to filter suspicious objects.
[0007] Obtaining a consistency index corresponding to the historical intersection object based on the consistency between the spatial vectors of the historical intersection objects and the corresponding camera view vectors in the historical log data; determining the user view following time difference based on the matching relationship between the changes in the spatial vectors of the historical intersection objects and the changes in the corresponding camera view vectors and the consistency index; and screening matching objects for each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera;
[0008] The visual relationship factor between the suspicious object and each of its matching objects is obtained by combining the projection distribution of the suspicious object and its matching objects relative to the plane aligned with the camera lens, as well as the change in the spatial vector when the suspicious object changes state. The attention level of each suspicious object is calculated by combining the spatial distance between the suspicious object and its matching objects, the visual relationship factor, and the time difference of the user's perspective following.
[0009] The LOD level model is determined based on the attention level to generate game images.
[0010] Preferably, obtaining the eye-catching degree of each intersecting object according to the overlap between the bounding box of each intersecting object and the viewing frustum, the change in the physical engine information of each intersecting object, and the relative distance between the intersecting objects on the same surface of the viewing frustum includes:
[0011] Obtaining the overlapping volume of the bounding box of the intersecting object to be analyzed and the visual frustum, and determining the ratio of the overlapping volume to the volume of the bounding box of the intersecting object to be analyzed as the overlapping ratio of the object to be analyzed;
[0012] Obtaining the projected area of the intersecting object to be analyzed in the plane pointed by the camera lens and the area of the surface with the largest intersecting area among all intersecting planes of the intersecting object to be analyzed and the viewing cone; determining the ratio between the projected area and the area of the surface with the largest intersecting area as the projection ratio;
[0013] The ratio between the projection ratio and the coincidence ratio is used as the coincidence factor of the intersecting object to be analyzed;
[0014] Calculate the normalized change rate of each type of physical engine information of the intersecting object to be analyzed based on each type of physical engine information in the previous frame image and the current frame image; determine the physical engine information corresponding to the maximum normalized change rate result as the motion parameter of the intersecting object to be analyzed;
[0015] Normalizing the inverse proportionality of the spatial distance between the bounding box of the intersecting object to be analyzed and each other intersecting object on the surface of the visual frustum intersecting with the object as a first weight corresponding to each other intersecting object; and performing weighted averaging on the motion parameters of each other intersecting object using the first weight to obtain a dynamic reference value for the intersecting object to be analyzed.
[0016] Determine the ratio of the value of the motion parameter to the dynamic reference value of the intersecting object to be analyzed as the eye-catching degree of the intersecting object to be analyzed;
[0017] The intersecting object to be analyzed is any intersecting object in the 3D model of the current game engine that intersects with a surface of the viewing frustum; wherein the intersecting object is an object whose bounding box intersects with any surface of the viewing frustum.
[0018] Preferably, the method of screening suspicious objects by using eye-attractiveness includes: determining intersecting objects whose normalized eye-attractiveness is greater than a preset eye-attractiveness threshold as suspicious objects.
[0019] Preferably, obtaining the consistency index corresponding to the historical intersection object according to the consistency between the spatial vector of the historical intersection object in the historical log data and the corresponding camera view vector includes:
[0020] Calculate the vector difference between the spatial vector of each historical intersection object and the corresponding camera view vector respectively; average and normalize all the vector differences corresponding to each historical intersection object in the historical log data, and use the difference between a constant 1 and the normalized result as the consistency index corresponding to each historical intersection object;
[0021] Among them, the spatial vector of the historical intersection object is composed of the translation parameters, up and down tilt parameters, rotation parameters and speed of the historical intersection object; the camera view vector is composed of the camera's translation parameters, up and down tilt parameters, rotation parameters and FOV used to characterize the camera's zooming in and out.
[0022] Preferably, determining the user perspective following time difference based on the matching relationship between the change of the spatial vector of the historical intersecting object and the change of the corresponding camera perspective vector and the consistency index includes:
[0023] Calculate the difference between two adjacent spatial vectors of the candidate object in the historical log data, record it as a change vector of the candidate object, and all the change vectors of the candidate object constitute a first change vector sequence;
[0024] Calculating a difference between two adjacent view vectors of a camera in the historical log data, recording the difference as a change vector of the camera, wherein all the change vectors of the camera constitute a second change vector sequence;
[0025] Performing DTW matching on the first change vector sequence and the second change vector sequence to obtain matching pairs; calculating the time difference corresponding to two elements in each matching pair, where the time difference is the difference between the element in the second change vector sequence and the element in the first change vector sequence in the matching pair; the candidate object is any historical intersection object;
[0026] The normalized result of the consistent index corresponding to each historical intersection object is used as a weight, and the time differences corresponding to all historical intersection objects are weighted and averaged to obtain the user perspective following time difference.
[0027] Preferably, screening matching objects for each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera includes:
[0028] Recording the relative distance between the suspicious object to be evaluated and the camera as a first distance, and recording the relative distance between each object except the suspicious object to be evaluated and the camera as a second distance corresponding to each object except the suspicious object to be evaluated;
[0029] Determine the objects other than the suspicious object to be evaluated that correspond to the second distance being greater than the first distance as matching objects of the suspicious object to be evaluated;
[0030] The suspicious object to be evaluated is any suspicious object.
[0031] Preferably, the step of synthesizing the projection distribution of the suspicious object and its matching objects relative to the plane aligned with the camera lens and the change of the space vector when the state of the suspicious object changes to obtain the visual relationship factor between the suspicious object and each of its matching objects includes:
[0032] For the suspicious object to be evaluated and any of its matching objects:
[0033] If the projected area of the suspicious object to be evaluated relative to the plane at which the camera lens is aligned is greater than or equal to the projected area of any matching object relative to the plane at which the camera lens is aligned, then a spatial vector corresponding to the minimum degree of spatial vector transformation when the suspicious object to be evaluated is transformed from a current state to a state with a maximum projected area of the suspicious object to be evaluated relative to the plane at which the camera lens is aligned is determined as the minimum transformation vector of any matching object;
[0034] Calculating a Euclidean norm of the minimum conversion vector to obtain a first conversion value;
[0035] The sum of the spatial distance between the suspicious object to be evaluated and any matching object and a preset adjustment parameter, and the normalized result of the ratio between the first conversion value and the sum is determined as the visual relationship factor between the suspicious object to be evaluated and any matching object; wherein the preset adjustment parameter is a value greater than 0.
[0036] Preferably, the calculation of the attention level of each suspicious object by combining the spatial distance between the suspicious object and its matching object, the visual relationship factor, and the user's perspective following time difference includes:
[0037] The attention degree of the suspicious object to be evaluated is calculated based on the visual relationship factor between the suspicious object to be evaluated and all its matching objects, the spatial distance value between the suspicious object to be evaluated and all its matching objects, and the user perspective following time difference. The visual relationship factor and the spatial distance value are both positively correlated with the attention degree, and the user perspective following time difference is negatively correlated with the attention degree.
[0038] Preferably, the determining of the LOD level model based on the attention level to generate the game image includes:
[0039] All LOD models are divided into a preset number of levels, and all attention levels are also divided into a preset number of levels. The corresponding LOD levels are matched according to the numerical values of the attention levels of different suspicious objects, and the corresponding rendering resources are allocated according to the LOD levels to obtain game images.
[0040] In a second aspect, the present invention provides a game image generation system based on a 3D rendering engine, the system comprising:
[0041] The intersection object acquisition module is used to obtain the intersection objects that have an intersection relationship with the surface of the viewing frustum in the 3D model of the current game engine;
[0042] The suspicious object screening module is used to determine the eye-catching degree of each intersecting object based on the overlap between the bounding box of each intersecting object and the viewing frustum, the changes in the physics engine information of each intersecting object, and the relative distance between intersecting objects on the same surface of the viewing frustum; and to screen suspicious objects using the eye-catching degree.
[0043] A matching object screening module is configured to obtain a consistency index corresponding to the historical intersection object based on the consistency between the spatial vector of the historical intersection object and the corresponding camera view vector in the historical log data; determine the user view following time difference based on the matching relationship between the change in the spatial vector of the historical intersection object and the change in the corresponding camera view vector and the consistency index; and screen matching objects for each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera;
[0044] The attention calculation module is used to integrate the projection distribution of the suspicious object and its matching objects relative to the plane aligned with the camera lens, as well as the changes in the spatial vector when the suspicious object changes state, to obtain the visual relationship factor between the suspicious object and each of its matching objects; and to calculate the attention level of each suspicious object by combining the spatial distance between the suspicious object and its matching objects, the visual relationship factor, and the user's perspective following time difference;
[0045] The game image generation module is used to generate game images based on the LOD level model determined by the attention level.
[0046] The present invention has at least the following beneficial effects:
[0047] The present invention first obtains all intersecting objects in the 3D model of the current game engine that have an intersecting relationship with the surface of the viewing frustum, and then calculates the eye-catching degree of each intersecting object based on the overlap of the bounding box of the intersecting object with the viewing frustum, the change of the physical engine information of the intersecting object, and the relative distance between the intersecting objects on the same surface of the viewing frustum, and screens out all suspicious objects. The user's perspective following time difference is estimated based on the relative changes of historical intersecting objects and cameras in the user's historical log data; considering that different objects may interact during movement, the matching objects of each suspicious object are screened out based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects except the suspicious object and the camera, and the alignment of the suspicious object and its matching object with respect to the camera lens is calculated. The projection distribution of the plane, the change of the spatial vector when the state of the suspicious object changes, and the time difference of the user's perspective following are used to obtain the attention level of each suspicious object. The LOD level model is further determined based on the attention level to generate the game image. The method provided by the present invention takes into account the low observation frequency characteristics of the user's camera perspective when following dynamic objects during actual observation, as well as the guiding effect of the camera perspective when the objects at the edge of the picture move. By calculating the attention level of the intersecting objects as the LOD level matching standard, its rendering resources are reasonably allocated, avoiding sudden switching of the picture, tearing, delay, etc. when the object moves and guides the user's camera perspective to follow, optimizing the resource allocation strategy, and obtaining the LOD level matching method that best suits the user's observation habits, which not only ensures the rendering effect of the game image but also saves rendering resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0049] Figure 1 A flowchart of a method for generating game images based on a 3D rendering engine provided by an embodiment of the present invention;
[0050] Figure 2 A schematic diagram of a visual cone provided by an embodiment of the present invention;
[0051] Figure 3 Switch the camera perspective to the previous picture;
[0052] Figure 4 This is the picture after the camera perspective is switched;
[0053] Figure 5 This is a structural block diagram of a game image generation system based on a 3D rendering engine provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to further illustrate the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the game image generation method and system based on the 3D rendering engine proposed in accordance with the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments.
[0055] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0056] The specific scheme of the game image generation method and system based on the 3D rendering engine provided by the present invention is described in detail below with reference to the accompanying drawings.
[0057] Example of a method for generating a game image based on a 3D rendering engine:
[0058] The specific scenario targeted by this embodiment is: in the process of 3D rendering of game images, in order to improve the generation effect of game images, combined with the low observation frequency characteristics of the user's camera perspective when following dynamic objects during actual observation, and the guiding role of the camera perspective when objects at the edge of the screen move, the resource allocation strategy is optimized to avoid sudden switching of the screen and the occurrence of problems such as tearing and delay, thereby ensuring the rendering effect of the game image.
[0059] This embodiment proposes a method for generating game images based on a 3D rendering engine, such as Figure 1 As shown, the game image generation method based on the 3D rendering engine of this embodiment includes the following steps:
[0060] Step S1: Obtain an intersecting object in a 3D model of the current game engine that intersects with a surface of a viewing frustum.
[0061] Create a 3D scene in the game engine, including models, cameras, lights, etc. The first perspective in the game screen is the camera perspective, and the game space is a 3D model. Graphics rendering refers to the process of converting 3D models, textures, lighting and other materials into two-dimensional images through a series of calculations and displaying them on the screen, obtaining the game image within the camera perspective; a viewing cone is defined according to the position and direction of the camera. This viewing cone consists of six planes, namely the near clipping plane, the far clipping plane and four side planes, such as Figure 2 As shown in FIG, this figure is a schematic diagram of the visual cone.
[0062] The objects in the current game engine's 3D model are segmented based on their spatial position using an octree (3D) to generate the segmentation results. This is similar to a binary tree, but each node can have up to eight child nodes, because three-dimensional space can be divided into eight equal-sized parts. Each node represents a cubic space, with the root node being the 3D model. Each cubic space can be further segmented into eight sub-cubes, which become children of the current node. This continues until the number of objects in the node is insufficient for further segmentation, or until the preset maximum depth is reached. The resulting sub-nodes provide indexing, making spatial queries of the 3D model (such as range queries and nearest neighbor queries) faster. The maximum depth is set by the implementer based on the specific situation.
[0063] The 3D model space is composed of several elements, each of which is an object, such as a tree, a building, or a character. Each element should have a unique identifier, such as an ID or a name. For each element object in the 3D space, the bounding box of each object is obtained. If the bounding box of the object is completely within the viewing cone, the object is visible; if the bounding box is completely outside the viewing cone, the object is invisible; if the bounding box intersects with the viewing cone, further refinement of the test is required to determine its visibility and optimize the rendering effect of the object. Therefore, in this embodiment, the objects whose bounding boxes intersect with any surface of the viewing cone in the 3D model of the current game engine are recorded as intersecting objects, where any surface of the viewing cone is the near clipping plane, the far clipping plane, and any one of the four side surfaces of the viewing cone.
[0064] So far, this embodiment has obtained multiple intersecting objects in the 3D model of the current game engine.
[0065] Step S2: Obtain the eye-catching degree of each intersecting object based on the overlap between the bounding box of each intersecting object and the viewing frustum, the change in the physics engine information of each intersecting object, and the relative distance between intersecting objects on the same surface of the viewing frustum; and use the eye-catching degree to filter suspicious objects.
[0066] For each object, the developer created multiple different versions (LOD levels) of the model. Each version has the same basic shape and appearance, but with a different level of detail. LOD is a method of reducing the number of polygons based on the distance of the 3D object from the camera. Each LOD level has a different polygon count. Generally, objects closer to the camera use high-detail models, while objects farther away use low-detail models. Based on the calculated distance, the appropriate LOD level is selected for rendering.
[0067] Changes in camera perspective may be partly determined by the user's attention to different objects. For example, a sudden shift in the camera perspective may be due to the appearance of an object of interest at the edge of the viewing cone, and the user adjusts the perspective for better observation. Therefore, when analyzing the relationship between the camera perspective and the object LOD level, the guiding effect of the intersecting objects at the edge of the viewing cone on the camera perspective should be considered.
[0068] like Figure 3 and Figure 4 As shown, Figure 3 The picture before the camera perspective switches, Figure 4 This is the picture after the camera perspective switches. Observe the positions of objects 1, 2, and 3 in the left picture. The right picture has shifted to the right and the viewing distance has widened relative to the left picture. Object 2 was originally at the edge of the left picture, but after the perspective change, it appears in the center of the right picture. In addition, object 3 (a rock) rolls between objects 1 and 2. Objects 2 and 3 are both intersecting objects at the edge of the viewing cone. It can be inferred that the user noticed the dynamic rolling of object 3 in advance from the left perspective, and then the perspective followed object 3 to the right, the viewing distance was widened to observe a more complete picture, and finally the center of the perspective just fell on the position where the rock stopped rolling. In this process, the camera perspective is considered to be guided and influenced by object 3. At this time, it represents a deeper interaction between the game screen and the user.
[0069] When switching LOD, you need to pay attention to objects that may have a guiding role at the edge of the frustum, and focus on depicting and smoothing the fluidity of the objects.
[0070] Next, this embodiment is described by taking any intersecting object in the 3D model of the current game engine that intersects with the surface of the viewing frustum as an example. Other intersecting objects can be processed using the method provided in this embodiment.
[0071] Specifically, any intersecting object in the 3D model of the current game engine that intersects with the surface of the viewing cone is recorded as the intersecting object to be analyzed. The overlapping volume of the bounding box of the intersecting object to be analyzed and the viewing cone is obtained, and the ratio of the overlapping volume to the volume of the bounding box of the intersecting object to be analyzed is determined as the overlap ratio of the object to be analyzed; the projection area of the intersecting object to be analyzed in the plane pointed by the camera lens and the area of the surface with the largest intersection area among all the intersecting planes between the intersecting object to be analyzed and the viewing cone are obtained; the ratio between the projection area and the area of the surface with the largest intersection area is determined as the projection ratio. The ratio between the projection ratio and the overlap ratio is used as the overlap factor of the intersecting object to be analyzed; the larger the projection ratio and the smaller the overlap ratio, the more likely that the projection direction is orthogonal to the main direction of the intersecting object, and the 3D object can be almost observed in its entirety from a 2D perspective. This may be due to reasons such as the shape of the object, the focal length of the camera, and the perspective effect.
[0072] By querying the physical components of the intersecting objects, the physical engine information of the intersecting objects is obtained. In this embodiment, the physical engine information includes speed translation parameters, up and down tilt parameters, rotation parameters and speed.
[0073] Based on each type of physics engine information for the intersecting object to be analyzed in the previous and current image frames, the normalized change rate corresponding to each type of physics engine information for the intersecting object to be analyzed is calculated. The physics engine information corresponding to the maximum normalized change rate is determined as the motion parameter of the intersecting object to be analyzed. A linear normalization method can be used to normalize the change rate, which is a prior art technique and will not be described in detail here. The inversely proportional normalized result of the spatial distance between the bounding box of the intersecting object to be analyzed and each other intersecting object on the surface of the visual frustum intersecting with it is recorded as the first weight corresponding to each other intersecting object. The closer the spatial distance, the greater the first weight. In this embodiment, the inversely proportional normalized result of the spatial distance is an exponential function with a natural constant as the base and the negative spatial distance as the exponent. The motion parameters of each other intersecting object are weighted and averaged using the first weight, and the obtained result is used as the dynamic reference quantity of the intersecting object to be analyzed. The smaller the dynamic reference amount, the more prominent the dynamic changes of the corresponding object. The ratio of the numerical value of the motion parameter to the dynamic reference amount of the intersecting object to be analyzed is determined as the eye-catching degree of the intersecting object to be analyzed. The greater the eye-catching degree, the larger the visual area and more dynamic references that the corresponding intersecting object can provide in its projection direction, and it is easier to be noticed by the user's peripheral vision.
[0074] By adopting the above method, the eye-catching degree of each intersecting object can be obtained, and the eye-catching degree of each intersecting object is normalized respectively so that the normalized value is in (0, 1). The intersecting objects whose normalized eye-catching degree is greater than the preset eye-catching threshold are determined as suspicious objects, that is, multiple suspicious objects are screened out from all the intersecting objects that have an intersecting relationship with the surface of the visual cone in the 3D model of the current game engine. The suspicious objects are objects that may have a guiding effect on the camera's perspective in the current frame. When normalizing the eye-catching degree, the maximum and minimum value method can be used for normalization. This normalization method is a prior art and will not be described in detail here. In this embodiment, the preset eye-catching threshold is 0.7. In specific applications, the implementer can set it according to the specific situation.
[0075] Step S3: Obtain a consistency index corresponding to the historical intersection object based on the consistency between the spatial vector of the historical intersection object in the historical log data and the corresponding camera view vector; determine the user view following time difference based on the matching relationship between the change of the spatial vector of the historical intersection object and the change of the corresponding camera view vector and the consistency index; and screen the matching object of each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera.
[0076] The client uses an API call, undergoes authentication and authorization, and retrieves and extracts historical log data of a specific user's gaming behavior from the server. This historical log data contains information about the user's screen switching habits. Similar to the method for obtaining intersecting objects in the current game engine's 3D model that intersect with the surfaces of the viewing cone in step S1, the intersecting objects in each frame of the historical log data are obtained and recorded as historical intersecting objects. For any historical intersecting object, its translation parameter, tilt parameter, rotation parameter, and velocity constitute its spatial vector. The translation parameter, tilt parameter, and rotation parameter are expressed as three-dimensional vectors, Euler angles, and quaternions, respectively. This method can obtain the spatial vector of each historical intersecting object. Next, we construct the camera's field of view vector corresponding to each frame of image in the historical log data. The camera's field of view vector is used to describe basic lens switching actions such as zooming in and out, translation, tilting, and rotation. The camera's field of view is expressed as a 3D vector for translation, Euler angles for tilt, quaternions for rotation, and a scalar value (FOV) for zooming in and out. Therefore, the camera's translation parameters, tilt parameters, rotation parameters, and the FOV used to characterize the camera's zooming in and out constitute the camera's field of view vector.
[0077] The camera lens zooms in and out with the purpose of magnifying and reducing the picture, which should be to follow the dynamic details of the object. The FOV value is adjusted to zoom out. Generally, when the speed of each object is large, the viewing angle is widened to obtain a wider field of view, which is convenient for observing high-speed moving objects. Therefore, the speed in the spatial vector of the historical intersecting object corresponds to the FOV in the camera's viewing angle vector, and the two are in a directly proportional relationship. The speed in the spatial vector of the intersecting object and the FOV in the camera's viewing angle vector are normalized to eliminate the dimension. It should be noted that the spatial vector and viewing angle vector mentioned later are all spatial vectors and viewing angle vectors after this normalization processing.
[0078] Calculate the difference between the spatial vector of each historical intersection object and the corresponding camera view vector, and use the difference as the corresponding vector difference. Average all the vector differences corresponding to each historical intersection object in the historical log data and normalize them using the sigmoid function. Subtract the normalization result from the constant 1 to obtain the difference as the consistency index corresponding to each historical intersection object.
[0079] In reality, the consistency between the camera's view vector and the spatial vector of any object is not very high, because the switching speed of the camera's view is often slower than the change in the spatial state of the object. For example, the user's camera view cannot completely follow the entire process of a rock rolling frame by frame. Therefore, the temporal change of the camera's view vector can be regarded as a low-sampling-rate tracking process.
[0080] This embodiment uses any historical intersecting object as an example for explanation. The method provided in this embodiment can be used to process other historical intersecting objects. Specifically, any historical intersecting object is recorded as a candidate object, and the difference between two adjacent spatial vectors of the candidate object in the historical log data is calculated. The difference is recorded as the change vector of the candidate object. All the change vectors of the candidate object are arranged in chronological order, and the sequence obtained at this time is recorded as the first change vector sequence; the difference between two adjacent perspective vectors of the camera in the historical log data is calculated and recorded as the change vector of the camera; all the change vectors of the camera in the historical log data are arranged in chronological order, and the sequence obtained at this time is recorded as the second change vector sequence. It should be noted that when calculating the difference between two adjacent spatial vectors, the difference is obtained by subtracting the spatial vector with a later time from the spatial vector with a earlier time; similarly, when calculating the difference between two adjacent perspective vectors, the difference is also obtained by subtracting the perspective vector with a later time from the perspective vector with a earlier time.
[0081] DTW (Dynamic Time Warping) matching is performed on the elements in the first change vector sequence and the elements in the second change vector sequence to obtain matching pairs. Each matching pair contains two elements: one element in the first change vector sequence and the other element in the second change vector sequence. It should be noted that the matching pairs extracted in this embodiment are all elements with a one-to-one matching relationship. The time difference corresponding to the two elements in each matching pair is calculated, where the time difference is the difference between the element in the second change vector sequence and the element in the first change vector sequence in the matching pair. Each matching pair corresponds to a time difference. In the matching result, a positive time difference indicates that the spatial vector of the object changes first, and the camera perspective is briefly delayed before changing accordingly. A negative time difference indicates that the user's perspective anticipated the spatial change of the object and the camera perspective vector was positioned in advance. The normalized result of the consistency index corresponding to each historical intersection object is used as the weight corresponding to each historical intersection object. The time differences corresponding to all historical intersection objects are weighted and averaged, and the result obtained is used as the user perspective following time difference.
[0082] When a suspicious object moves, if it successfully attracts the user's camera view, the movement of the suspicious object may interact with other objects. In order to smooth the visual effect, the visual relationship between the suspicious object and other objects needs to be considered.
[0083] Next, this embodiment is described by taking any suspicious object as an example. Other suspicious objects can be processed using the method provided in this embodiment.
[0084] Any suspicious object is recorded as a suspicious object to be evaluated, the relative distance between the suspicious object to be evaluated and the camera is recorded as a first distance, and the relative distance between each object other than the suspicious object to be evaluated and the camera is recorded as a second distance corresponding to each object other than the suspicious object to be evaluated; when the second distance is greater than the first distance, it means that the suspicious object is a foreground relative to the objects other than the suspicious object, and the objects other than the suspicious object to be evaluated corresponding to the second distance being greater than the first distance are determined as matching objects of the suspicious object to be evaluated, that is, multiple matching objects of the suspicious object to be evaluated are screened.
[0085] By adopting the above method, multiple matching objects for each suspicious object can be screened out.
[0086] Step S4: Obtain a visual relationship factor between the suspicious object and each of its matching objects by comprehensively analyzing the projection distribution of the suspicious object and its matching objects relative to the plane aligned with the camera lens and the change of the spatial vector when the state of the suspicious object changes; and calculate the attention level of each suspicious object by combining the spatial distance between the suspicious object and its matching objects, the visual relationship factor, and the time difference of the user's perspective following.
[0087] By calling the API provided by the graphics library or physics engine, the posture of the suspicious object is obtained, and the different projection areas of the suspicious object in the direction of the camera viewing angle are obtained.
[0088] The following description continues with the example of a suspicious object to be evaluated. Specifically, for the suspicious object to be evaluated and any of its matching objects: if the projected area of the suspicious object to be evaluated relative to the plane at which the camera lens is aligned is greater than or equal to the projected area of any of the matching objects relative to the plane at which the camera lens is aligned, the spatial vector corresponding to the minimum degree of spatial vector transformation when the suspicious object to be evaluated transitions from its current state to the maximum projected area of the suspicious object to be evaluated relative to the plane at which the camera lens is aligned is determined as the minimum transformation vector of the matching object. The smaller the degree of spatial vector transformation, the greater the probability of visual interaction between the two. It should be noted that the degree of spatial vector transformation can be characterized by the magnitude of the change in the spatial vector. The method for obtaining the magnitude of the vector change is known in the art and will not be further described here. The Euclidean norm of the elements in the minimum transformation vector is calculated, and the result of this calculation is used as a first transformation value. The sum of the spatial distance between the suspicious object to be evaluated and any of the matching objects and a preset adjustment parameter is then normalized to determine the visual relationship factor between the suspicious object to be evaluated and any of the matching objects. The preset adjustment parameter is a value greater than 0. The purpose of introducing a preset adjustment parameter in the calculation process of the visual relationship factor is to prevent the denominator from being 0. In this embodiment, the preset adjustment parameter is 0.01. In specific applications, the implementer can set it according to specific circumstances.
[0089] When the motion state of the suspicious object changes, the user's camera perspective may also change according to the user's perspective tracking time difference. Therefore, the camera's attention to the object is evaluated by combining the spatial distance between the suspicious object and its matching object, the visual relationship factor, and the user's perspective tracking time difference.
[0090] Specifically, the attention degree of the suspicious object to be evaluated is calculated based on the visual relationship factor between the suspicious object to be evaluated and all its matching objects, the spatial distance value between the suspicious object to be evaluated and all its matching objects, and the user perspective following time difference. The visual relationship factor and the spatial distance value are both positively correlated with the attention degree, and the user perspective following time difference is negatively correlated with the attention degree.
[0091] Among them, a positive correlation relationship indicates that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases. It can be an additive relationship, a multiplicative relationship, etc., which is determined by actual application; a negative correlation relationship indicates that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtractive relationship, a division relationship, etc., which is determined by actual application.
[0092] In this embodiment, a specific calculation formula for the attention degree is given. The attention degree of the suspicious object to be evaluated can be expressed as:
[0093]
[0094] Among them, E represents the attention of the suspicious object to be evaluated, N represents the number of matching objects of the suspicious object to be evaluated, and Z n represents the visual relationship factor between the suspicious object to be evaluated and its nth matching object, C n It represents the spatial distance between the suspicious object to be evaluated and its nth matching object, V represents the time difference of user perspective following, and norm() represents the normalization function.
[0095] The visual relationship factor between the suspected object and its nth matching object can be considered the event observation frequency, while the visual relationship factor between the suspected object and its nth matching object can be considered the event occurrence probability. The product of the two is the expected value of the visual interaction between the suspected object and its nth matching object captured when the user's camera is focused. The expected values of the suspected object and all matching objects are averaged and normalized to obtain the attention level of the suspected object. It should be noted that if the projected area of the suspected object relative to the plane of the camera lens is smaller than the projected area of one of its matching objects relative to the plane of the camera lens, the visual relationship factor between the suspected object and the corresponding matching object at that time is set to 0, and the suspected object is included in the calculation of the attention level of the suspected object.
[0096] Using the above method, the attention level of each suspicious object can be obtained. This embodiment estimates the following speed based on the user's screen switching habits, and then obtains the observation frequency of the user's camera perspective when the suspicious object may move toward any other object. Then, based on the minimum spatial vector change of each suspicious object, the probability of visual interaction with other objects is obtained. Based on the observation frequency and visual interaction probability, the expected value of each suspicious object interacting with other objects and being observed by the user is obtained, and finally the attention level of each suspicious object is obtained.
[0097] Step S5: Determine the LOD level model based on the attention level to generate a game image.
[0098] In step S4, this embodiment calculates the attention level of all suspicious objects in the current image. Next, the corresponding LOD level model is matched based on the attention level of all suspicious objects in the current image. Specifically, all LOD models are divided into a preset number of levels, and all attention levels are also divided into a preset number of levels. In this embodiment, the preset number is 5, that is, all LOD models are divided into 5 levels, and all suspicious objects are also divided into five levels based on the size of the attention level of all suspicious objects. Then, the corresponding LOD level is matched according to the attention level of the numerical value of the attention level of different suspicious objects, and corresponding rendering resources are allocated according to the LOD level. The rendering resources include light, texture, shadow, etc. The vertices of the 3D model are transformed, including model transformation, view transformation and projection transformation, to transform the vertex coordinates from model space to screen space. The transformed vertex data is converted into pixel data to generate a rasterized image. According to the rendering resource allocation strategy in the above steps, rendering effects are applied to each pixel, including lighting, texture mapping, shadow and other effects, and the final color value is calculated. Finally, multiple layers (such as background, foreground, UI, etc.) are merged and output to the screen for display, thus completing the generation and display of the game image.
[0099] Compared with the shortcomings of the traditional method of obtaining LOD weights based only on distance and matching corresponding LOD levels, this embodiment takes into account the low observation frequency characteristics of the user's camera perspective when following dynamic objects during actual observation, and the guiding effect of the camera perspective when objects at the edge of the screen move. By calculating the attention level of intersecting objects as the LOD level matching standard, its rendering resources are reasonably allocated, avoiding sudden screen switching, tearing, delays, etc. when the objects move and guide the user's camera perspective to follow, optimizing the resource allocation strategy, and obtaining the LOD level matching method that best suits the user's observation habits, which not only saves rendering resources but also improves the smoothness of game operation.
[0100] Example of a game image generation system based on a 3D rendering engine:
[0101] like Figure 5 As shown, the figure shows a structural block diagram of a game image generation system based on a 3D rendering engine, which includes an intersecting object acquisition module, a suspicious object screening module, a matching object screening module, an attention calculation module, and a game image generation module;
[0102] The intersection object acquisition module is used to obtain the intersection objects that intersect with the surface of the viewing frustum in the 3D model of the current game engine;
[0103] The suspicious object screening module is used to determine the eye-catching degree of each intersecting object based on the overlap between the bounding box of each intersecting object and the viewing frustum, the changes in the physics engine information of each intersecting object, and the relative distance between intersecting objects on the same surface of the viewing frustum; and to screen suspicious objects using the eye-catching degree.
[0104] A matching object screening module is configured to obtain a consistency index corresponding to the historical intersection object based on the consistency between the spatial vector of the historical intersection object and the corresponding camera view vector in the historical log data; determine the user view following time difference based on the matching relationship between the change in the spatial vector of the historical intersection object and the change in the corresponding camera view vector and the consistency index; and screen matching objects for each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera;
[0105] The attention calculation module is used to integrate the projection distribution of the suspicious object and its matching objects relative to the plane aligned with the camera lens, as well as the changes in the spatial vector when the suspicious object changes state, to obtain the visual relationship factor between the suspicious object and each of its matching objects; and to calculate the attention level of each suspicious object by combining the spatial distance between the suspicious object and its matching objects, the visual relationship factor, and the user's perspective following time difference;
[0106] The game image generation module is used to generate game images based on the LOD level model determined by the attention level.
[0107] It should be understood that Figure 5 The structural block diagram of the game image generation system based on the 3D rendering engine and its modules can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated hardware. Those skilled in the art will understand that the above-mentioned methods and systems can be implemented using computer-executable instructions and / or contained in processor control code, for example, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the system and its modules of this specification. Not only can hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc. be implemented, they can also be implemented using software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software (for example, firmware).
[0108] For more details about the above modules, please refer to other places in this manual and will not be repeated here.
[0109] In other embodiments, a device for generating game images based on a 3D rendering engine is provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and execute the executable program code from the memory, causing the device to execute the aforementioned method for generating game images based on a 3D rendering engine. The device can be a chip, component, or module. The chip may include a connected processor and memory; the memory is used to store instructions. When the processor calls and executes the instructions, the chip can execute the method for generating game images based on a 3D rendering engine provided in the aforementioned embodiments.
[0110] In other embodiments, a computer program product is also provided. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the game image generation method based on the 3D rendering engine provided in the above embodiment.
[0111] In other embodiments, a medium is also provided, which stores at least one program executable by a computer. When the at least one program is executed by a computer, the computer executes the steps of the game image generation method based on a 3D rendering engine in the above embodiment. The medium can be a computer-readable storage medium.
[0112] Among them, the provided systems, equipment, products, and media are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0113] It should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for generating game images based on a 3D rendering engine, characterized in that: The method comprises the following steps: Get the intersecting objects in the current game engine's 3D model that intersect with the surface of the viewing frustum; The eye-catching degree of each intersecting object is obtained based on the overlap between the bounding box of each intersecting object and the viewing frustum, the change in the physics engine information of each intersecting object, and the relative distance between intersecting objects on the same surface of the viewing frustum. The eye-catching degree is used to filter suspicious objects. Obtaining a consistency index corresponding to the historical intersection object based on the consistency between the spatial vectors of the historical intersection objects and the corresponding camera view vectors in the historical log data; determining the user view following time difference based on the matching relationship between the changes in the spatial vectors of the historical intersection objects and the changes in the corresponding camera view vectors and the consistency index; and screening matching objects for each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera; The visual relationship factor between the suspicious object and each of its matching objects is obtained by combining the projection distribution of the suspicious object and its matching objects relative to the plane aligned with the camera lens, as well as the change in the spatial vector when the suspicious object changes state. The attention level of each suspicious object is calculated by combining the spatial distance between the suspicious object and its matching objects, the visual relationship factor, and the time difference of the user's perspective following. The LOD level model is determined based on the attention level to generate game images.
2. The method for generating game images based on a 3D rendering engine according to claim 1, wherein: Obtaining the eye-catching degree of each intersecting object based on the overlap between the bounding box of each intersecting object and the viewing frustum, the change in the physics engine information of each intersecting object, and the relative distance between the intersecting objects on the same surface of the viewing frustum includes: Obtaining the overlapping volume of the bounding box of the intersecting object to be analyzed and the visual frustum, and determining the ratio of the overlapping volume to the volume of the bounding box of the intersecting object to be analyzed as the overlapping ratio of the object to be analyzed; Obtaining the projected area of the intersecting object to be analyzed in the plane pointed by the camera lens and the area of the surface with the largest intersecting area among all intersecting planes of the intersecting object to be analyzed and the viewing cone; determining the ratio between the projected area and the area of the surface with the largest intersecting area as the projection ratio; The ratio between the projection ratio and the coincidence ratio is used as the coincidence factor of the intersecting object to be analyzed; Calculate the normalized change rate of each type of physical engine information of the intersecting object to be analyzed based on each type of physical engine information in the previous frame image and the current frame image; determine the physical engine information corresponding to the maximum normalized change rate result as the motion parameter of the intersecting object to be analyzed; Normalizing the inverse proportionality of the spatial distance between the bounding box of the intersecting object to be analyzed and each other intersecting object on the surface of the visual frustum intersecting with the object as a first weight corresponding to each other intersecting object; and performing weighted averaging on the motion parameters of each other intersecting object using the first weight to obtain a dynamic reference value for the intersecting object to be analyzed. Determine the ratio of the value of the motion parameter to the dynamic reference value of the intersecting object to be analyzed as the eye-catching degree of the intersecting object to be analyzed; The intersecting object to be analyzed is any intersecting object in the 3D model of the current game engine that intersects with a surface of the viewing frustum; wherein the intersecting object is an object whose bounding box intersects with any surface of the viewing frustum.
3. The method for generating game images based on a 3D rendering engine according to claim 1, wherein: The method of screening suspicious objects by using the eye-attractiveness includes determining intersecting objects whose normalized eye-attractiveness is greater than a preset eye-attractiveness threshold as suspicious objects.
4. The method for generating game images based on a 3D rendering engine according to claim 1, wherein: The obtaining of a consistency index corresponding to the historical intersection object based on the consistency between the spatial vector of the historical intersection object in the historical log data and the corresponding camera view vector includes: Calculate the vector difference between the spatial vector of each historical intersection object and the corresponding camera view vector respectively; average and normalize all the vector differences corresponding to each historical intersection object in the historical log data, and use the difference between a constant 1 and the normalized result as the consistency index corresponding to each historical intersection object; Among them, the spatial vector of the historical intersection object is composed of the translation parameters, up and down tilt parameters, rotation parameters and speed of the historical intersection object; the camera view vector is composed of the camera's translation parameters, up and down tilt parameters, rotation parameters and FOV used to characterize the camera's zooming in and out.
5. The method for generating game images based on a 3D rendering engine according to claim 1, wherein: The determining of the user perspective following time difference based on the matching relationship between the change of the spatial vector of the historical intersecting object and the change of the corresponding camera perspective vector and the consistency index includes: Calculating the difference between two adjacent spatial vectors of the candidate object in the historical log data, recording the difference as the change vector of the candidate object, and all the change vectors of the candidate object constitute a first change vector sequence; Calculating the difference between two adjacent view vectors of the camera in the historical log data, recording the difference as the camera's change vector, and all the camera's change vectors forming a second change vector sequence; Performing DTW matching on the first change vector sequence and the second change vector sequence to obtain matching pairs; calculating the time difference corresponding to two elements in each matching pair, where the time difference is the difference between the element in the second change vector sequence and the element in the first change vector sequence in the matching pair; the candidate object is any historical intersection object; The normalized result of the consistent index corresponding to each historical intersection object is used as a weight, and the time differences corresponding to all historical intersection objects are weighted and averaged to obtain the user perspective following time difference.
6. The method for generating game images based on a 3D rendering engine according to claim 1, wherein: The step of screening matching objects for each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera includes: Recording the relative distance between the suspicious object to be evaluated and the camera as a first distance, and recording the relative distance between each object except the suspicious object to be evaluated and the camera as a second distance corresponding to each object except the suspicious object to be evaluated; Determine the objects other than the suspicious object to be evaluated that correspond to the second distance being greater than the first distance as matching objects of the suspicious object to be evaluated; The suspicious object to be evaluated is any suspicious object.
7. The method for generating game images based on a 3D rendering engine according to claim 6, wherein: The method of synthesizing the projection distribution of the suspicious object and its matching object relative to the plane aligned with the camera lens and the change of the space vector when the state of the suspicious object changes to obtain the visual relationship factor between the suspicious object and each of its matching objects includes: For the suspicious object to be evaluated and any of its matching objects: If the projected area of the suspicious object to be evaluated relative to the plane at which the camera lens is aligned is greater than or equal to the projected area of any matching object relative to the plane at which the camera lens is aligned, then a spatial vector corresponding to the minimum degree of spatial vector transformation when the suspicious object to be evaluated is transformed from a current state to a state with a maximum projected area of the suspicious object to be evaluated relative to the plane at which the camera lens is aligned is determined as the minimum transformation vector of any matching object; Calculating a Euclidean norm of the minimum conversion vector to obtain a first conversion value; The sum of the spatial distance between the suspicious object to be evaluated and any matching object and a preset adjustment parameter, and the normalized result of the ratio between the first conversion value and the sum is determined as the visual relationship factor between the suspicious object to be evaluated and any matching object; wherein the preset adjustment parameter is a value greater than 0.
8. The method for generating game images based on a 3D rendering engine according to claim 6, wherein: The calculation of the attention level of each suspicious object by combining the spatial distance between the suspicious object and its matching object, the visual relationship factor, and the user's perspective following time difference includes: The attention degree of the suspicious object to be evaluated is calculated based on the visual relationship factor between the suspicious object to be evaluated and all its matching objects, the spatial distance value between the suspicious object to be evaluated and all its matching objects, and the user perspective following time difference. The visual relationship factor and the spatial distance value are both positively correlated with the attention degree, and the user perspective following time difference is negatively correlated with the attention degree.
9. The method for generating game images based on a 3D rendering engine according to claim 1, wherein: The method of determining the LOD level model based on the attention level to generate the game image includes: All LOD models are divided into a preset number of levels, and all attention levels are also divided into a preset number of levels. The corresponding LOD levels are matched according to the numerical values of the attention levels of different suspicious objects, and the corresponding rendering resources are allocated according to the LOD levels to obtain game images.
10. A game image generation system based on a 3D rendering engine, characterized in that: The system includes: The intersection object acquisition module is used to obtain the intersection objects that have an intersection relationship with the surface of the viewing frustum in the 3D model of the current game engine; The suspicious object screening module is used to determine the eye-catching degree of each intersecting object based on the overlap between the bounding box of each intersecting object and the viewing frustum, the changes in the physics engine information of each intersecting object, and the relative distance between intersecting objects on the same surface of the viewing frustum; and to screen suspicious objects using the eye-catching degree. A matching object screening module is configured to obtain a consistency index corresponding to the historical intersection object based on the consistency between the spatial vector of the historical intersection object and the corresponding camera view vector in the historical log data; determine the user view following time difference based on the matching relationship between the change in the spatial vector of the historical intersection object and the change in the corresponding camera view vector and the consistency index; and screen matching objects for each suspicious object based on the difference between the relative distance between each suspicious object and the camera and the relative distance between other objects other than the suspicious object and the camera; The attention calculation module is used to integrate the projection distribution of the suspicious object and its matching objects relative to the plane aligned with the camera lens, as well as the changes in the spatial vector when the suspicious object changes state, to obtain the visual relationship factor between the suspicious object and each of its matching objects; and to calculate the attention level of each suspicious object by combining the spatial distance between the suspicious object and its matching objects, the visual relationship factor, and the user's perspective following time difference; The game image generation module is used to generate game images based on the LOD level model determined by the attention level.
Citation Information
Patent Citations
Dynamic model processing method and device in game and electronic equipment
CN116510294A
Virtual object rendering method and device, electronic equipment and storage medium
CN117654030A