Ambient light occlusion processing method, device and equipment

By pre-baking, the target three-dimensional texture is generated and the ambient light occlusion effect is rendered using the target cube model, the problem of ambient light occlusion processing is solved, resulting in increased computing pressure on the server, achieving efficient game operation and good user experience.

CN114832375BActive Publication Date: 2025-05-02SIKELI CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210510129.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2025-05-02
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

When performing ambient light shading processing, the server's calculation pressure increases, the game operation speed becomes slower, and the user's gaming experience is affected.

Method used

By obtaining the target model unit of the target virtual object and its corresponding pre-baked three-dimensional texture, the target cube model is used to render the ambient light occlusion effect, reducing the real-time calculation pressure.

Benefits of technology

While ensuring the real-time performance of ambient light shading, it accelerates the three-dimensional texture rendering and ambient light shading processing, reduces server performance consumption, and improves game running speed. It is suitable for low-end models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114832375B_ABST
    Figure CN114832375B_ABST
Patent Text Reader

Abstract

The present application discloses an ambient occlusion processing method, device and equipment, which relates to the field of game light and shadow processing technology, and can solve the current technical problem that the computing pressure of the server is increased and the user's gaming experience is easily affected when performing ambient occlusion processing. It includes: obtaining a target model unit of a target virtual object, the target model unit is a model unit to be processed for ambient occlusion, and the target model unit is provided with a minimum bounding box; obtaining a target three-dimensional texture corresponding to the target model unit, the target three-dimensional texture is a pre-baked three-dimensional texture of the target model unit, and the size of the target three-dimensional texture is related to the minimum bounding box size of the target model unit; obtaining a target cube model of the target model unit, the target cube model is used to render the target three-dimensional texture, and the size of the target cube model is the same as the size of the target three-dimensional texture; according to the target cube model and the target three-dimensional texture, the ambient occlusion effect of the target model unit is rendered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of game light and shadow processing, and in particular to an ambient light occlusion processing method, device and equipment. Background Art

[0002] Ambient Occlusion (AO) is a technical method to achieve the local illumination and shadow reality of some objects in global illumination. It can produce important visual light and shade effects. By depicting the shadows caused by occlusion between objects, it can better capture the details in the scene, solve problems such as light leakage and floating shadows, and improve the unclear shadows of small objects such as corners, gears, and cracks in the scene, and enhance the depth and three-dimensional sense of the scene. With the development of computer graphics technology, players have higher and higher requirements for the realism of game graphics. In order to improve the quality of the game, in addition to baking the scene with static lighting, Ambient Occlusion also needs to be processed for dynamic virtual objects in the game scene.

[0003] Currently, when performing ambient occlusion processing, Ambient Occlusion processing of dynamic virtual objects can be achieved based on the screen space post-processing solution. However, the screen space post-processing solution requires multiple sampling and real-time calculation, which will increase the computing pressure of the server, slow down the game running speed, and thus affect the user's gaming experience. Summary of the invention

[0004] In view of this, the present application discloses an ambient light occlusion processing method, device and equipment, which can solve the current technical problem that when performing ambient light occlusion processing, the computing pressure of the server is increased, the game running speed is slowed down, and the user's gaming experience is easily affected.

[0005] According to one aspect of the present application, a method for processing ambient light occlusion is provided, the method comprising:

[0006] Acquire a target model unit of a target virtual object, wherein the target model unit is a model unit to be subjected to ambient light occlusion processing, and the target model unit is provided with a minimum bounding box;

[0007] Acquire a target three-dimensional texture corresponding to the target model unit, where the target three-dimensional texture is a pre-baked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a minimum bounding box size of the target model unit;

[0008] Acquire a target cube model of the target model unit, where the target cube model is used to render the target three-dimensional texture, and a size of the target cube model is the same as a size of the target three-dimensional texture;

[0009] The ambient occlusion effect of the target model unit is rendered according to the target cube model and the target three-dimensional texture.

[0010] Preferably, before acquiring the target three-dimensional texture corresponding to the target model unit, the method further includes:

[0011] The minimum bounding box set by the target model unit is extended upward by a preset distance along the X, Y, and Z axes respectively to obtain a target bounding box;

[0012] Pre-baking the target bounding box to generate an initial three-dimensional texture of the target model unit;

[0013] The initial three-dimensional texture is subjected to convolution blur processing to generate a target three-dimensional texture having a blurred extension effect in an extension area of ​​the target model unit.

[0014] Preferably, rendering the ambient occlusion effect of the target model unit according to the target cube model and the target three-dimensional texture comprises:

[0015] Determining the world coordinates of the intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene, wherein the target cube model and the target three-dimensional texture have a coordinate corresponding relationship;

[0016] The three-dimensional texture sampling UV value of the intersection point is calculated based on the world coordinates and the coordinate correspondence, and the ambient occlusion effect of the target model unit is rendered according to the three-dimensional texture sampling UV value, wherein the ambient occlusion effect matches the geometric shape of the target model unit.

[0017] Preferably, determining the world coordinates of the intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene comprises:

[0018] Determining at least one intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene according to the sight direction depth map;

[0019] The world coordinates of the intersection point are calculated using a screen ray interpolation algorithm.

[0020] Preferably, the calculating the three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence includes:

[0021] Converting the world coordinates into local coordinates of the target cube model using a model matrix of the target cube model;

[0022] According to the coordinate correspondence, a three-dimensional texture sampling UV value corresponding to the local coordinate is determined.

[0023] Preferably, rendering the ambient occlusion effect of the target model unit according to the three-dimensional texture sampling UV value includes:

[0024] Acquire a first pixel value of the target three-dimensional texture at the three-dimensional texture sampling UV value, and a second pixel value of the at least one virtual object at the world coordinate;

[0025] Performing a multiplication process on the first pixel value and the second pixel value to calculate a pixel masking value of the at least one virtual object in the world coordinates;

[0026] The at least one virtual object is rendered according to the pixel occlusion value to form an ambient occlusion effect of the target model unit on the at least one virtual object.

[0027] Preferably, the acquiring the target three-dimensional texture corresponding to the target model unit includes:

[0028] Determine the main bone position coordinates of the bone part corresponding to the target model unit;

[0029] The pre-baked target three-dimensional texture is mapped to the target model unit according to the main skeleton position coordinates, so that the movement of the target three-dimensional texture is consistent with the movement of the target model unit.

[0030] According to another aspect of the present application, an ambient light occlusion processing device is provided, the device comprising:

[0031] A first acquisition module is used to acquire a target model unit of a target virtual object, wherein the target model unit is a model unit to be subjected to ambient light occlusion processing, and the target model unit is provided with a minimum bounding box;

[0032] A second acquisition module is used to acquire a target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is a pre-baked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a minimum bounding box size of the target model unit;

[0033] A third acquisition module is used to acquire a target cube model of the target model unit, wherein the target cube model is used to render the target three-dimensional texture, and the size of the target cube model is the same as the size of the target three-dimensional texture;

[0034] A rendering module is used to render the ambient occlusion effect of the target model unit according to the target cube model and the target three-dimensional texture.

[0035] Preferably, the device further comprises: a pre-baking module;

[0036] The pre-baking module is used to expand the minimum bounding box set by the target model unit upward by a preset distance along the X, Y, and Z axes to obtain a target bounding box; generate an initial three-dimensional texture of the target model unit according to the pre-baking of the target bounding box; and perform convolution blur processing on the initial three-dimensional texture to generate a target three-dimensional texture with a blurred extension effect in the extension area of ​​the target model unit.

[0037] Preferably, the rendering module comprises: a determination unit and a rendering unit;

[0038] The determining unit is used to determine the world coordinates of the intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene, wherein the target cube model and the target three-dimensional texture have a coordinate corresponding relationship;

[0039] The rendering unit is used to calculate the three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence, and render the ambient light occlusion effect of the target model unit according to the three-dimensional texture sampling UV value, wherein the ambient light occlusion effect matches the geometric shape of the target model unit.

[0040] Preferably, the determining unit is specifically configured to:

[0041] Determining at least one intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene according to the sight direction depth map;

[0042] The world coordinates of the intersection point are calculated using a screen ray interpolation algorithm.

[0043] Preferably, when calculating the three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence, the rendering unit is specifically used to:

[0044] Converting the world coordinates into local coordinates of the target cube model using a model matrix of the target cube model;

[0045] According to the coordinate correspondence, a three-dimensional texture sampling UV value corresponding to the local coordinate is determined.

[0046] Preferably, when rendering the ambient occlusion effect of the target model unit according to the three-dimensional texture sampling UV value, the rendering unit is specifically used to:

[0047] Acquire a first pixel value of the target three-dimensional texture at the three-dimensional texture sampling UV value, and a second pixel value of the at least one virtual object at the world coordinate;

[0048] Performing a multiplication process on the first pixel value and the second pixel value to calculate a pixel masking value of the at least one virtual object in the world coordinates;

[0049] The at least one virtual object is rendered according to the pixel occlusion value to form an ambient occlusion effect of the target model unit on the at least one virtual object.

[0050] Preferably, the second acquisition module is specifically used to:

[0051] Determine the main bone position coordinates of the bone part corresponding to the target model unit;

[0052] The pre-baked target three-dimensional texture is mapped to the target model unit according to the main skeleton position coordinates, so that the movement of the target three-dimensional texture is consistent with the movement of the target model unit.

[0053] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned ambient light occlusion processing method is implemented.

[0054] According to another aspect of the present application, an ambient light occlusion processing device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, and the above-mentioned ambient light occlusion processing method is implemented when the processor executes the program.

[0055] By means of the above technical scheme, the present application provides an ambient occlusion processing method, device and equipment, which can first obtain the target model unit of the target virtual object to be processed for ambient occlusion, and then obtain the target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is obtained by pre-baking the target model unit, and its size is related to the minimum bounding box size of the target model unit; further, the target cube model of the target model unit can be obtained, and the target three-dimensional texture is rendered using the target cube model, and the ambient occlusion effect of the target model unit is rendered according to the target cube model and the target three-dimensional texture. The technical scheme in the present application generates the target three-dimensional texture by pre-baking, and uses the volume information of the target three-dimensional texture to simulate the ambient occlusion effect of the model on the scene. While ensuring the real-time performance of the ambient occlusion effect, it can accelerate the subsequent three-dimensional texture rendering and ambient occlusion processing process, reduce the performance consumption of the server during ambient occlusion processing, reduce the game's requirements on the performance of the game player's device, so that low-end models can also run the game normally, and at the same time can improve the game running speed, creating a good game experience for game users.

[0056] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0058] Figure 1 A schematic diagram of a process flow of an ambient light occlusion processing method provided in an embodiment of the present application is shown;

[0059] Figure 2 A schematic flow chart of another ambient light occlusion processing method provided in an embodiment of the present application is shown;

[0060] Figure 3 A schematic diagram of the structure of an ambient light shielding processing device provided in an embodiment of the present application is shown;

[0061] Figure 4 A schematic diagram of the structure of another ambient light shielding processing device provided in an embodiment of the present application is shown;

[0062] Figure 5 A schematic diagram of the physical structure of an ambient light shading processing device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0063] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0064] In order to solve the technical problem that the current ambient light occlusion processing causes the server's computing pressure to increase, slows down the game running speed, and easily affects the user's gaming experience, the present application provides an ambient light occlusion processing method, such as Figure 1 As shown, the method includes:

[0065] 101. Obtain a target model unit of a target virtual object, where the target model unit is a model unit to be subjected to ambient light occlusion processing, and a minimum bounding box is set for the target model unit.

[0066] Among them, the target virtual object refers to a three-dimensional fixed object or a three-dimensional movable object in the virtual game scene. The three-dimensional fixed object can be a virtual terrain (such as mountains, gravel), a fixed virtual object (such as buildings, furniture, statues), etc.; the three-dimensional movable object can be a virtual character, a virtual animal, a virtual vehicle (such as a car, a cart), a movable virtual object (such as a sweeping robot, a fan), etc.; the target model unit is any model part in the complete model corresponding to the target virtual object that needs to be rendered to generate an ambient light occlusion effect, which can be understood as the head, back or legs of a virtual character.

[0067] In a specific application scenario, the target model units of each target virtual object to be subjected to ambient light occlusion processing can be pre-set according to the virtual object display requirements in the virtual game scene. For example, only one target model unit (such as the back) that needs to generate an ambient light occlusion effect can be set in the virtual character, or multiple target model units (such as the back and legs) that need to generate an ambient light occlusion effect can be set in the virtual character. For this embodiment, the target model unit of the target virtual object can be directly obtained according to the setting result, and further by executing subsequent embodiment steps 102 to 104, the rendering of the ambient light occlusion effect corresponding to the target model unit contained in the target virtual object is realized. When multiple target model units are set for the same target virtual object at the same time, the rendering priority of the multiple target model units can be set according to the part composition of the model, and the rendering of the ambient light occlusion effect of the target model unit is performed in sequence in the order of rendering priority from large to small, wherein the rendering priority can be set according to the user's custom setting, and no specific limitation is made here.

[0068] The executor of the present application may be a game client or a server. After obtaining the target model unit of the target virtual object to be subjected to ambient occlusion processing, the target three-dimensional texture corresponding to the target model unit may be obtained. Then, the target cube model of the target model unit may be obtained, and the target three-dimensional texture may be rendered using the target cube model. Furthermore, the ambient occlusion effect of the target model unit may be rendered based on the target cube model and the target three-dimensional texture.

[0069] 102. Obtain a target three-dimensional texture corresponding to the target model unit, where the target three-dimensional texture is a pre-baked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a minimum bounding box size of the target model unit.

[0070] Among them, the target three-dimensional texture is a three-dimensional form, and its characteristic is that it records the texture information of the target model unit. Different from the two-dimensional texture in the form of a picture, the recording form of the corresponding texture information of the target three-dimensional texture is a cube model. The texture information of the target three-dimensional texture includes two parts. One part is the model unit texture of the same size as the target model unit, and the other part is the edge extension texture of the target model unit. The edge extension texture has a fuzzy extension effect in the extension area of ​​the target model unit.

[0071] In a specific application scenario, after determining that the target virtual object needs to generate at least one target model unit for the ambient occlusion effect, before executing the steps of this embodiment, it is necessary to pre-bake the at least one target model unit to generate a static target three-dimensional texture. Specifically, this can be done by setting the minimum bounding box corresponding to the target model unit, and using the minimum bounding box to bake according to the skeletal joints of the target model unit to generate a static target three-dimensional texture with a fuzzy extension effect.

[0072] Accordingly, as an optional method, after generating the target three-dimensional texture, in order to realize the resource reuse of the generated three-dimensional texture, a mapping relationship between the pre-baked target three-dimensional texture and the target model unit can be created, and the target three-dimensional texture and the mapping relationship can be stored in the target texture atlas library. Accordingly, for this embodiment, the target three-dimensional texture corresponding to at least one target model unit of the target virtual object can be retrieved in the texture atlas library according to the mapping relationship, and then the target three-dimensional texture is bound to the main skeleton position of the target model unit, so that the movement of the target three-dimensional texture is consistent with the movement of the target model unit. By splitting the target virtual object according to the model unit, pre-baking the texture respectively, and binding the pre-baked three-dimensional texture generated to the target model unit, the subsequent three-dimensional texture rendering and ambient light occlusion processing process can be accelerated. Rendering from scratch may take a lot of time, so some parts of the rendering are "baked" in advance for the selected target virtual object through pre-baking processing. Then, when you click to render, the rendering of the entire scene will be faster because the colors of these target virtual objects do not need to be recalculated. In addition, by generating an edge extension texture with a fuzzy extension effect and binding the edge extension texture to the target model unit, it can be ensured that the target virtual object is in a fixed position or in the process of moving, the target 3D texture can produce a real ambient light occlusion effect in the virtual environment, so that any virtual object close to the target virtual object will be affected by the target 3D texture. By splitting the rendering according to the model unit, it is also possible to achieve custom rendering of the ambient light occlusion effect of any model part of the virtual object to meet the personalized needs of game development.

[0073] 103. Obtain a target cube model of the target model unit. The target cube model is used to render a target three-dimensional texture. The size of the target cube model is the same as the size of the target three-dimensional texture.

[0074] For this embodiment, given that the target three-dimensional texture generated by this application corresponds to a texture information recorded in the form of a cube model, during the use phase of the target three-dimensional texture, the target three-dimensional texture can be rendered by a target cube model (such as Cube) of the same size as the target three-dimensional texture. Specifically, the target three-dimensional texture can be rendered to the back of the target cube model (such as Cube), wherein the back of the target cube model refers to the side of the cube model facing away from the viewport camera.

[0075] 104. Render the ambient occlusion effect of the target model unit according to the target cube model and the target three-dimensional texture.

[0076] For this embodiment, in the process of rendering the target three-dimensional texture, the rendering judgment of the pixel can be performed according to the sight direction depth map through the target cube model in the rendering stage, and whether there is a position intersection between the pixels of other virtual objects and the pixels inside the corresponding box of the target cube model. If it is determined that there are pixel points with intersecting positions, the world coordinate PW point where the sight line in the target cube model intersects with the surface of at least one virtual object in the virtual three-dimensional scene can be further calculated. Specifically, the world coordinate can be calculated using the screen ray difference method; and then the PW point is replaced with the local coordinate PL of the target cube model through the model matrix (Object2World) of the target cube model. Since the target 3D texture corresponds to the target cube model, both are applicable to the local coordinate system, and the minimum PL local coordinate of the target cube model is (-0.5,-0.5,-0.5), and the minimum UV coordinate of the 3D texture starts from (0,0,0), so the local coordinate needs to be added with (0.5,0.5,0.5) to obtain the 3D texture sampling UV value, and the coordinate conversion is performed to ensure the accuracy of the sampling result; finally, the ambient occlusion effect of the target model unit can be rendered according to the 3D texture sampling UV value.

[0077] Through the ambient occlusion processing method in this embodiment, the target model unit of the target virtual object to be processed for ambient occlusion can be first obtained, and then the target three-dimensional texture corresponding to the target model unit can be obtained, wherein the target three-dimensional texture is obtained by pre-baking the target model unit, and its size is related to the minimum bounding box size of the target model unit; further, the target cube model of the target model unit can be obtained, and the target three-dimensional texture can be rendered using the target cube model, and the ambient occlusion effect of the target model unit can be rendered according to the target cube model and the target three-dimensional texture. The technical solution in this application generates the target three-dimensional texture by pre-baking, and uses the volume information of the target three-dimensional texture to simulate the ambient occlusion effect of the model on the scene. While ensuring the real-time performance of the ambient occlusion effect, it can accelerate the subsequent three-dimensional texture rendering and ambient occlusion processing process, reduce the performance consumption of the server during ambient occlusion processing, reduce the game's requirements on the performance of the game player's device, so that low-end models can also run the game normally, and at the same time can improve the game running speed, creating a good game experience for game users.

[0078] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the implementation of this embodiment, this embodiment also provides another ambient light occlusion processing method, such as Figure 2 As shown, the method includes:

[0079] 201. Obtain a target model unit of a target virtual object, where the target model unit is a model unit to be subjected to ambient light occlusion processing, and a minimum bounding box is set for the target model unit.

[0080] 202. Obtain the target three-dimensional texture corresponding to the target model unit, determine the main bone position coordinates of the skeletal part corresponding to the target model unit, and map the pre-baked target three-dimensional texture to the target model unit according to the main bone position coordinates, so that the movement of the target three-dimensional texture is consistent with the movement of the target model unit.

[0081] Among them, the target three-dimensional texture is a three-dimensional texture obtained by pre-baking the target model unit, and the size of the target three-dimensional texture is related to the minimum bounding box size of the target model unit. Specifically, when pre-baking the target three-dimensional texture through the target model unit, the minimum bounding box Rmin of the target model unit can be determined first, and then the new AABB target bounding box Rmax is generated according to the X, Y, and Z axis extension E (assumed) distance of the minimum bounding box Rmin; according to the size of the target bounding box Rmax, the target model unit is baked into an initial three-dimensional texture of size Rmax; then the initial three-dimensional texture is blurred to produce an extension effect with blurred edges, the result is saved to the 3D texture, and the Rmax information is saved, and the target three-dimensional texture of the target model unit is pre-baked. That is, the size of the target three-dimensional texture is equal to the size of the target bounding box after the minimum bounding box of the target model unit is extended, and the target three-dimensional texture includes the model unit texture of the model unit, and the edge extension texture in the extension area of ​​the model unit.

[0082] Accordingly, when pre-baking the target three-dimensional texture, the implementation steps may specifically include: expanding the minimum bounding box set by the target model unit upward by a preset distance according to the X, Y, and Z axes respectively to obtain a target bounding box; pre-baking the target model unit to generate the initial three-dimensional texture; performing convolution blur processing on the initial three-dimensional texture to generate a target three-dimensional texture with a blurred extension effect in the extension area of ​​the target model unit. Among them, when performing convolution blur processing on the initial three-dimensional texture, it is necessary to perform convolution on the three axes X, Y, and Z corresponding to the target three-dimensional texture respectively. The specific convolution processing method is the same as the existing two-dimensional image edge blur processing method, which will not be described in detail here. For this implementation, the convolution blur processing of the three-dimensional texture is to expand the size of the three-dimensional texture, so that the ambient light occlusion effect of the target three-dimensional texture can affect the object in contact with the target virtual object (for example, when the target virtual object is against the wall, the edge extension texture of the target three-dimensional texture corresponding to the back of the target model unit will produce an ambient light occlusion effect on the wall).

[0083] For this embodiment, after obtaining the target three-dimensional texture corresponding to the target model unit, the main skeleton position coordinates of the skeletal part corresponding to the target model unit can be determined, and the pre-baked target three-dimensional texture can be mapped to the target model unit according to the main skeleton position coordinates, which is equivalent to creating a binding relationship between the target three-dimensional texture and the target model unit. Based on this binding relationship, the target three-dimensional texture can present a moving display effect consistent with the movement of the target model unit. By decoupling the baking of the target three-dimensional texture from the action of the target virtual object in this way, it is possible to reuse the baked target three-dimensional texture and improve the rendering efficiency of the target three-dimensional texture.

[0084] 203. Obtain a target cube model of the target model unit, and determine the world coordinates of the intersection point of the target cube model and at least one virtual object in the virtual three-dimensional scene, wherein the target cube model is used to render a target three-dimensional texture, and the size of the target cube model is the same as the size of the target three-dimensional texture, and they have a coordinate correspondence.

[0085] Among them, the world coordinates can be used to identify the world space position of each virtual object in the virtual environment. The coordinates are represented by X, Y, and Z, where Y represents the height of the virtual object from the bedrock layer, and X and Z represent the position of the virtual object on the plane.

[0086] In a specific application scenario, when determining the world coordinates of the intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene, the intersection point between the sight line in the target cube model and any virtual object other than the target virtual object in the virtual three-dimensional scene can be calculated based on the sight line direction depth map, and a screen ray is emitted from the corresponding point on the screen in the direction of the intersection point. The collision of the directional ray with other virtual objects is checked through the screen ray, and the world coordinates of the intersection point can be calculated based on the screen ray difference algorithm and the coordinates of the corresponding point on the screen. Accordingly, step 204 of the embodiment may specifically include: determining at least one intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene based on the sight line direction depth map; and calculating the world coordinates of the intersection point using the screen ray difference algorithm.

[0087] 204. Calculate the 3D texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence, and render the ambient occlusion effect of the target model unit according to the 3D texture sampling UV value, wherein the ambient occlusion effect matches the geometric shape of the target model unit.

[0088] In a specific application scenario, when calculating the three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence, step 204 of the embodiment may specifically include: using the model matrix of the target cube model to convert the world coordinates into the local coordinates of the target cube model; according to the coordinate correspondence, determining the three-dimensional texture sampling UV value corresponding to the local coordinate.

[0089] Among them, the model matrix can be an Object2World matrix, which is used to transform the vertex / direction vector from the world space to the model space of the target cube model. After the local coordinates of the target cube model are obtained by conversion, since the minimum coordinates of the PL local coordinates of the target cube model are (-0.5,-0.5,-0.5), and the minimum UV coordinates of the 3D texture start from (0,0,0), the local coordinates need to be added with (0.5,0.5,0.5) to obtain the three-dimensional texture sampling UV value, that is, the coordinate correspondence between the target cube model and the target three-dimensional texture is the coordinates of the target cube model plus (0.5,0.5,0.5) to obtain the coordinates of the target three-dimensional texture.

[0090] Correspondingly, when rendering the ambient light occlusion effect of the target model unit according to the UV value of the three-dimensional texture sampling, the embodiment step 204 may specifically include: obtaining the first pixel value of the target three-dimensional texture under the UV value of the three-dimensional texture sampling, and the second pixel value of at least one virtual object under the world coordinate; performing a multiplication process on the first pixel value and the second pixel value, and calculating the pixel occlusion value of at least one virtual object under the world coordinate; rendering at least one virtual object according to the pixel occlusion value to form the ambient light occlusion effect of the target model unit on the at least one virtual object. Among them, the multiplication method is a darkening mode with a high frequency of use. By mixing two homologous layers in the "multiplication" mode, the image will be darkened in a smooth but nonlinear way, and the effect obtained is like the object emerging from the darkness. Specifically, the pixel values ​​of the two colors can be multiplied and then divided by 255 to obtain the pixel value of the final color. Usually, the color after executing the multiplication mode is darker than the original two colors. Multiplying any color with black will still result in black, multiplying any color with white will keep the original color unchanged, and multiplying any color with other colors will produce the effect of lighting with that color in a dark room.

[0091] Accordingly, when rendering at least one virtual object according to the pixel occlusion value to form an ambient light occlusion effect of the target model unit on the at least one virtual object, the embodiment steps may specifically include: rendering the second virtual object according to the pixel occlusion value and the model of the second virtual object to form an ambient light occlusion effect on the second virtual object, wherein the darkened form of the ambient light occlusion effect matches the geometric form of the target model unit. For example, if the geometric form corresponding to the target model unit is the form of a foot, then the darkened form of the ambient light occlusion effect is the shape of the sole of the virtual object; if the geometric form corresponding to the target model unit is the shape of the back, then the darkened form of the ambient light occlusion effect is the shape of the back of the virtual object.

[0092] The present embodiment provides an ambient occlusion processing method, which can first obtain the target model unit of the target virtual object to be subjected to ambient occlusion processing, and then obtain the target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is obtained by pre-baking the target model unit, and its size is related to the minimum bounding box size of the target model unit; further, the target cube model of the target model unit can be obtained, and the target three-dimensional texture can be rendered using the target cube model, and the ambient occlusion effect of the target model unit can be rendered according to the target cube model and the target three-dimensional texture. The technical solution in the present application generates the target three-dimensional texture by pre-baking, and uses the volume information of the target three-dimensional texture to simulate the ambient occlusion effect of the model on the scene. While ensuring the real-time performance of the ambient occlusion effect, it can accelerate the subsequent three-dimensional texture rendering and ambient occlusion processing process, reduce the performance consumption of the server during ambient occlusion processing, reduce the game's requirements on the performance of the game player's device, so that low-end models can also run the game normally, and at the same time can improve the game running speed, creating a good game experience for game users.

[0093] Further, as Figure 1 The specific implementation of the method shown in the embodiment provides an ambient light occlusion processing device, such as Figure 3 As shown, the device includes: a first acquisition module 31, a second acquisition module 32, a third acquisition module 33, and a rendering module 34.

[0094] A first acquisition module 31, which can be used to acquire a target model unit of a target virtual object, where the target model unit is a model unit to be subjected to ambient light occlusion processing, and a minimum bounding box is set for the target model unit;

[0095] A second acquisition module 32, which can be used to acquire a target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is a pre-baked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a minimum bounding box size of the target model unit;

[0096] A third acquisition module 33, which can be used to acquire a target cube model of a target model unit, where the target cube model is used to render a target three-dimensional texture, and the size of the target cube model is the same as the size of the target three-dimensional texture;

[0097] The rendering module 34 may be used to render the ambient occlusion effect of the target model unit according to the target cube model and the target three-dimensional texture.

[0098] In specific application scenarios, in order to achieve pre-baking of the target 3D texture, such as Figure 4 As shown, the device further comprises: a pre-baking module 35;

[0099] The pre-baking module 35 can be used to expand the minimum bounding box set for the target model unit upward by a preset distance along the X, Y, and Z axes to obtain a target bounding box; generate an initial three-dimensional texture of the target model unit based on the pre-baking of the target bounding box; and perform convolution blur processing on the initial three-dimensional texture to generate a target three-dimensional texture with a blurred extension effect in the extension area of ​​the target model unit.

[0100] In specific application scenarios, such as Figure 4 As shown, the rendering module 34 may specifically include: a determination unit 341 and a rendering unit 342;

[0101] A determination unit 341 may be used to determine the world coordinates of an intersection point between a target cube model and at least one virtual object in a virtual three-dimensional scene, wherein the target cube model and the target three-dimensional texture have a coordinate correspondence relationship;

[0102] The rendering unit 342 can be used to calculate the three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence, and render the ambient light occlusion effect of the target model unit according to the three-dimensional texture sampling UV value, wherein the ambient light occlusion effect matches the geometric shape of the target model unit.

[0103] In a specific application scenario, the determination unit 341 can be specifically used to: determine at least one intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene based on the line of sight direction depth map; and calculate the world coordinates of the intersection point using a screen ray difference algorithm.

[0104] In a specific application scenario, when calculating the three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence, the rendering unit 342 can be specifically used to: use the model matrix of the target cube model to convert the world coordinates into the local coordinates of the target cube model; determine the three-dimensional texture sampling UV value corresponding to the local coordinate according to the coordinate correspondence.

[0105] In a specific application scenario, when rendering the ambient light occlusion effect of the target model unit according to the three-dimensional texture sampling UV value, the rendering unit 342 can be specifically used to: obtain the first pixel value of the target three-dimensional texture under the three-dimensional texture sampling UV value, and the second pixel value of at least one virtual object under the world coordinate; perform a positive film overlay process on the first pixel value and the second pixel value, and calculate the pixel occlusion value of at least one virtual object under the world coordinate; render at least one virtual object according to the pixel occlusion value to form the ambient light occlusion effect of the target model unit on the at least one virtual object.

[0106] In a specific application scenario, the second acquisition module 32 can be used to determine the main bone position coordinates of the skeletal part corresponding to the target model unit; according to the main bone position coordinates, the pre-baked target three-dimensional texture is mapped to the target model unit, so that the movement of the target three-dimensional texture is consistent with the movement of the target model unit.

[0107] It should be noted that for other corresponding descriptions of the functional units involved in the ambient light shielding processing device provided in this embodiment, reference can be made to Figure 1 to Figure 2 The corresponding description in the method will not be repeated here.

[0108] Based on the above Figure 1 to Figure 2 The method shown in the embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned Figure 1 to Figure 2 Ambient occlusion processing method shown.

[0109] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.

[0110] Based on the above Figure 1 to Figure 2 The method shown, and Figure 3 , Figure 4 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides an ambient light occlusion processing device, such as Figure 5 As shown, the ambient light shielding processing device includes a processor (processor) 41, a communication interface (Communications Interface) 42, a memory (memory) 43, and a communication bus 44. Among them: the processor 41, the communication interface 42, and the memory 43 communicate with each other through the communication bus 44. The communication interface 44 is used to communicate with other devices such as network elements of a client or other servers. The processor 41 is used to execute a program, and specifically can execute the relevant steps in the embodiment of the processing method of the above-mentioned front-end interface request. Specifically, the program may include a program code, and the program code includes computer operating instructions. The processor 41 may be a processor CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement an embodiment of the present invention.

[0111] Specifically, it can be a personal computer, a server, a smart phone, or other network device, etc. The device includes a storage medium and a processor; the storage medium is used to store computer programs; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 to Figure 2 Ambient occlusion processing method shown.

[0112] Optionally, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.

[0113] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.

[0114] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.

[0115] Through the description of the above implementation methods, the technicians in this field can clearly understand that the present application can be implemented by means of software plus necessary general hardware platforms, or by hardware. By applying the scheme of this embodiment, the target model unit of the target virtual object to be processed for ambient light occlusion can be first obtained, and then the target three-dimensional texture corresponding to the target model unit can be obtained, wherein the target three-dimensional texture is obtained by pre-baking the target model unit, and its size is related to the minimum bounding box size of the target model unit; further, the target cube model of the target model unit can be obtained, and the target three-dimensional texture is rendered using the target cube model, and the ambient light occlusion effect of the target model unit is rendered according to the target cube model and the target three-dimensional texture. The technical solution in this application generates the target three-dimensional texture by pre-baking, and uses the volume information of the target three-dimensional texture to simulate the ambient light occlusion effect of the model on the scene. While ensuring the real-time performance of the ambient light occlusion effect, it can accelerate the subsequent three-dimensional texture rendering and ambient light occlusion processing process, reduce the performance consumption of the server during the ambient light occlusion processing, reduce the game's requirements on the performance of the game player's device, so that low-end models can also run the game normally, and at the same time can improve the game running speed, creating a good game experience for game users.

[0116] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.

[0117] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.

Claims

1. A method for processing ambient light occlusion, characterized in that: include: Acquire a target model unit of a target virtual object, wherein the target model unit is a model unit to be subjected to ambient light occlusion processing, and the target model unit is provided with a minimum bounding box; Acquire a target three-dimensional texture corresponding to the target model unit, where the target three-dimensional texture is a pre-baked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a minimum bounding box size of the target model unit; Acquire a target cube model of the target model unit, wherein the target cube model is used to render the target three-dimensional texture, and a size of the target cube model is the same as a size of the target three-dimensional texture; The ambient occlusion effect of the target model unit is rendered according to the target cube model and the target three-dimensional texture.

2. The method according to claim 1, characterized in that Before obtaining the target three-dimensional texture corresponding to the target model unit, the method further includes: The minimum bounding box set by the target model unit is extended upward by a preset distance along the X, Y, and Z axes respectively to obtain a target bounding box; Pre-baking the target bounding box to generate an initial three-dimensional texture of the target model unit; The initial three-dimensional texture is subjected to convolution blur processing to generate a target three-dimensional texture having a blurred extension effect in an extension area of ​​the target model unit.

3. The method according to claim 1, characterized in that The step of rendering the ambient occlusion effect of the target model unit according to the target cube model and the target three-dimensional texture includes: Determining the world coordinates of the intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene, wherein the target cube model and the target three-dimensional texture have a coordinate corresponding relationship; The three-dimensional texture sampling UV value of the intersection point is calculated based on the world coordinates and the coordinate correspondence, and the ambient occlusion effect of the target model unit is rendered according to the three-dimensional texture sampling UV value, wherein the ambient occlusion effect matches the geometric shape of the target model unit.

4. The method according to claim 3, characterized in that The determining of the world coordinates of the intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene includes: Determining at least one intersection point between the target cube model and at least one virtual object in the virtual three-dimensional scene according to the sight direction depth map; The world coordinates of the intersection point are calculated using a screen ray interpolation algorithm.

5. The method according to claim 3, characterized in that: The calculating the three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence includes: Converting the world coordinates into local coordinates of the target cube model using a model matrix of the target cube model; According to the coordinate correspondence, a three-dimensional texture sampling UV value corresponding to the local coordinate is determined.

6. The method according to claim 3, characterized in that The rendering of the ambient occlusion effect of the target model unit according to the three-dimensional texture sampling UV value includes: Acquire a first pixel value of the target three-dimensional texture at the three-dimensional texture sampling UV value, and a second pixel value of the at least one virtual object at the world coordinate; Performing a multiplication process on the first pixel value and the second pixel value to calculate a pixel masking value of the at least one virtual object in the world coordinates; The at least one virtual object is rendered according to the pixel occlusion value to form an ambient occlusion effect of the target model unit on the at least one virtual object.

7. The method according to claim 1, characterized in that The step of obtaining the target three-dimensional texture corresponding to the target model unit includes: Determine the main bone position coordinates of the bone part corresponding to the target model unit; The pre-baked target three-dimensional texture is mapped to the target model unit according to the main skeleton position coordinates, so that the movement of the target three-dimensional texture is consistent with the movement of the target model unit.

8. An ambient light occlusion processing device, characterized in that: include: A first acquisition module is used to acquire a target model unit of a target virtual object, wherein the target model unit is a model unit to be subjected to ambient light occlusion processing, and the target model unit is provided with a minimum bounding box; A second acquisition module is used to acquire a target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is a pre-baked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a minimum bounding box size of the target model unit; A third acquisition module is used to acquire a target cube model of the target model unit, wherein the target cube model is used to render the target three-dimensional texture, and the size of the target cube model is the same as the size of the target three-dimensional texture; A rendering module is used to render the ambient occlusion effect of the target model unit according to the target cube model and the target three-dimensional texture.

9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An ambient light occlusion processing device, comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Processing method and device of ambient occlusion (AO)

    CN107633544A

  • Management method of voxel landform

    CN109745704A