CN114832375A - Ambient light shielding processing method, device and equipment - Google Patents

Ambient light shielding processing method, device and equipment Download PDF

Info

Publication number
CN114832375A
CN114832375A CN202210510129.1A CN202210510129A CN114832375A CN 114832375 A CN114832375 A CN 114832375A CN 202210510129 A CN202210510129 A CN 202210510129A CN 114832375 A CN114832375 A CN 114832375A
Authority
CN
China
Prior art keywords
target
dimensional texture
model unit
ambient light
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210510129.1A
Other languages
Chinese (zh)
Inventor
程庆宝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Perfect Time And Space Software Co ltd
Original Assignee
Shanghai Perfect Time And Space Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Perfect Time And Space Software Co ltd filed Critical Shanghai Perfect Time And Space Software Co ltd
Priority to CN202210510129.1A priority Critical patent/CN114832375A/en
Publication of CN114832375A publication Critical patent/CN114832375A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/06Ray-tracing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/40Hidden part removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/506Illumination models
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images
    • A63F2300/6646Methods for processing data by generating or executing the game program for rendering three dimensional images for the computation and display of the shadow of an object or character

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • General Physics & Mathematics (AREA)
  • Geometry (AREA)
  • Multimedia (AREA)
  • Computing Systems (AREA)
  • Image Generation (AREA)

Abstract

The application discloses an ambient light shielding processing method, an ambient light shielding processing device and ambient light shielding processing equipment, relates to the technical field of game shadow processing, and can solve the technical problems that the calculation pressure of a server is increased and the game experience of a user is easily influenced when ambient light shielding processing is carried out at present. The method comprises the following steps: acquiring a target model unit of a target virtual object, wherein the target model unit is a model unit to be subjected to ambient light shielding treatment and is provided with a minimum bounding box; acquiring a target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is a prebaked three-dimensional texture of the target model unit, and the size of the target three-dimensional texture is related to the size of a minimum bounding box of the target model unit; acquiring a target cube model of a target model unit, wherein the target cube model is used for rendering a target three-dimensional texture, and the size of the target cube model is the same as that of the target three-dimensional texture; and rendering the ambient light shielding effect of the target model unit according to the target cube model and the target three-dimensional texture.

Description

Ambient light shielding processing method, device and equipment
Technical Field
The present application relates to the field of game light and shadow processing technologies, and in particular, to a method, an apparatus, and a device for processing ambient light shielding.
Background
Ambient light shading (AO) is a technical mode for realizing the reality of partial object local illumination and shadows in global illumination, can generate important visual bright and dark effects, can better capture details in a scene by describing shadows generated by shading among objects, can solve the problems of light leakage, floating shadows and the like, improves the problems of unclear shadows and the like of fine objects such as corners, gears, cracks and the like in the scene, and enhances the depth and the stereoscopic impression of the scene. With the development of computer graphics technology, players have higher and higher requirements on the fidelity of game picture graphics, and in order to improve game quality, in addition to static illumination baking of Ambient Occlusion on a scene, Ambient Occlusion processing is also required for dynamic virtual objects in a game scene.
At present, when Ambient light shielding processing is performed, Ambient Occlusion processing on a dynamic virtual object can be realized based on a screen space post-processing scheme, however, the screen space post-processing scheme requires multiple sampling and real-time calculation, which increases the calculation pressure of a server, slows down the game running speed, and further affects the game experience of a user.
Disclosure of Invention
In view of this, the present application discloses an ambient light shielding processing method, an ambient light shielding processing device, and an ambient light shielding processing apparatus, which can solve the technical problems that when ambient light shielding processing is performed at present, the computing pressure of a server is increased, the game running speed is slowed, and the game experience of a user is easily affected.
According to an aspect of the present application, there is provided an ambient light shielding processing method, including:
the method comprises the steps of obtaining a target model unit of a target virtual object, wherein the target model unit is a model unit to be subjected to ambient light shielding processing and is provided with a minimum bounding box;
acquiring a target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is a prebaked three-dimensional texture of the target model unit, and the size of the target three-dimensional texture is related to the size of a minimum bounding box of the target model unit;
acquiring a target cube model of the target model unit, wherein the target cube model is used for rendering the target three-dimensional texture, and the size of the target cube model is the same as that of the target three-dimensional texture;
and rendering the ambient light shielding effect of the target model unit according to the target cube model and the target three-dimensional texture.
Preferably, before obtaining the target three-dimensional texture corresponding to the target model unit, the method further includes:
respectively extending the minimum bounding box set by the target model unit upwards and outwards by preset distances according to X, Y and Z axes to obtain a target bounding box;
generating an initial three-dimensional texture of the target model unit according to the target bounding box pre-baking;
and carrying out convolution fuzzy processing on the initial three-dimensional texture to generate a target three-dimensional texture with fuzzy extension effect in the extension area of the target model unit.
Preferably, the rendering the ambient light masking effect of the target model unit according to the target cube model and the target three-dimensional texture comprises:
determining world coordinates of an intersection point of the 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 corresponding relation;
and calculating a three-dimensional texture sampling UV value of the intersection point based on the world coordinate and the coordinate corresponding relation, and rendering an ambient light shielding effect of the target model unit according to the three-dimensional texture sampling UV value, wherein the ambient light shielding effect is matched with the geometric form of the target model unit.
Preferably, the determining world coordinates of the intersection of the target cube model and at least one virtual object in the virtual three-dimensional scene comprises:
determining at least one intersection point of the target cube model and at least one virtual object in the virtual three-dimensional scene according to the sight direction depth map;
and calculating the world coordinates of the intersection points by using a screen ray difference algorithm.
Preferably, the calculating a three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence includes:
converting the world coordinates to local coordinates of the target cube model using a model matrix of the target cube model;
and determining a three-dimensional texture sampling UV value corresponding to the local coordinate according to the coordinate corresponding relation.
Preferably, the rendering of the ambient light shading effect of the object model unit according to the three-dimensional texture sample UV values comprises:
acquiring a first pixel value of the target three-dimensional texture under the three-dimensional texture sampling UV value and a second pixel value of the at least one virtual object under the world coordinate;
performing positive film bottom-folding processing on the first pixel value and the second pixel value, and calculating a pixel shading value of the at least one virtual object under the world coordinate;
rendering the at least one virtual object according to the pixel shading value to form an ambient light shading effect of the target model unit on the at least one virtual object.
Preferably, the obtaining of the target three-dimensional texture corresponding to the target model unit includes:
determining main skeleton position coordinates of the skeleton part corresponding to the target model unit;
and mapping the target three-dimensional texture obtained by prebaking to the target model unit according to the main skeleton position coordinates so as to enable the movement of the target three-dimensional texture to be consistent with the movement of the target model unit.
According to another aspect of the present application, there is provided an ambient light shield processing apparatus, the apparatus comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a target model unit of a target virtual object, the target model unit is a model unit to be subjected to ambient light shielding treatment, and the target model unit is provided with a minimum bounding box;
a second obtaining module, configured to obtain a target three-dimensional texture corresponding to the target model unit, where the target three-dimensional texture is a prebaked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a size of a minimum bounding box of the target model unit;
a third obtaining module, configured to obtain 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;
and the rendering module is used for rendering the ambient light shielding effect of the target model unit according to the target cube model and the target three-dimensional texture.
Preferably, the apparatus further comprises: a pre-baking module;
the prebaking module is used for extending the minimum bounding box set by the target model unit upwards and outwards by preset distances according to X, Y and Z axes to obtain a target bounding box; generating an initial three-dimensional texture of the target model unit according to the target bounding box pre-baking; and carrying out convolution fuzzy processing on the initial three-dimensional texture to generate a target three-dimensional texture with fuzzy extension effect in the extension area of the target model unit.
Preferably, the rendering module includes: a determining unit and a rendering unit;
the determining unit is used for determining world coordinates of an intersection point of the 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 corresponding relation;
and the rendering unit is used for calculating a three-dimensional texture sampling UV value of the intersection point based on the world coordinate and the coordinate corresponding relation, and rendering an ambient light shielding effect of the target model unit according to the three-dimensional texture sampling UV value, wherein the ambient light shielding effect is matched with the geometric form of the target model unit.
Preferably, the determining unit is specifically configured to:
determining at least one intersection point of the target cube model and at least one virtual object in the virtual three-dimensional scene according to the sight direction depth map;
and calculating the world coordinates of the intersection points by using a screen ray difference algorithm.
Preferably, when calculating the three-dimensional texture sampling UV value of the intersection point based on the world coordinate and the coordinate correspondence, the rendering unit is specifically configured to:
converting the world coordinates to local coordinates of the target cube model using a model matrix of the target cube model;
and determining a three-dimensional texture sampling UV value corresponding to the local coordinate according to the coordinate corresponding relation.
Preferably, when rendering the ambient light masking effect of the target model unit according to the three-dimensional texture sampling UV value, the rendering unit is specifically configured to:
acquiring a first pixel value of the target three-dimensional texture under the three-dimensional texture sampling UV value and a second pixel value of the at least one virtual object under the world coordinate;
performing positive film bottom-folding processing on the first pixel value and the second pixel value, and calculating a pixel shading value of the at least one virtual object under the world coordinate;
rendering the at least one virtual object according to the pixel shading value to form an ambient light shading effect of the target model unit on the at least one virtual object.
Preferably, the second obtaining module is specifically configured to:
determining main skeleton position coordinates of the skeleton part corresponding to the target model unit;
and mapping the target three-dimensional texture obtained by prebaking to the target model unit according to the main skeleton position coordinates so as to enable the movement of the target three-dimensional texture to be consistent with the movement of the target model unit.
According to yet another aspect of the present application, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described ambient light masking processing method.
According to yet another aspect of the present application, there is provided an ambient light shield processing apparatus, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, the processor implementing the above-mentioned ambient light shield processing method when executing the program.
By means of the technical scheme, the application provides an ambient light shielding processing method, an ambient light shielding processing device and ambient light shielding processing equipment, a target model unit of a target virtual object to be subjected to ambient light shielding processing can be obtained firstly, and then a target three-dimensional texture corresponding to the target model unit is obtained, wherein the target three-dimensional texture is obtained by pre-baking the target model unit, and the size of the target three-dimensional texture is related to the size of a minimum bounding box of the target model unit; further, a target cube model of the target model unit may be acquired, the target three-dimensional texture may be rendered using the target cube model, and an ambient light shielding effect of the target model unit may be rendered according to the target cube model and the target three-dimensional texture. According to the technical scheme, the target three-dimensional texture is generated through prebaking, the influence of the model on the ambient light shielding of a scene is simulated by utilizing the volume information of the target three-dimensional texture, the real-time performance of the ambient light shielding effect can be ensured, the processes of subsequent three-dimensional texture rendering and ambient light shielding processing are accelerated, the performance consumption of the server during the ambient light shielding processing is reduced, the requirement of a game on the performance of game player equipment is reduced, the game can be normally run by using a low-profile machine, the running speed of the game can be increased, and good game experience is created for game users.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart illustrating an ambient light shielding processing method according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating another ambient light shielding processing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram illustrating an ambient light shielding processing apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of another ambient light shielding processing apparatus provided in an embodiment of the present application;
fig. 5 is a schematic physical structure diagram of an ambient light shielding processing device according to an embodiment of the present invention.
Detailed Description
The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
In order to solve the technical problems that the game running speed is slowed down and the game experience of a user is easily affected due to increased computing pressure of a server when the ambient light shielding processing is performed at present, the application provides an ambient light shielding processing method, as shown in fig. 1, the method comprises the following steps:
101. and acquiring a target model unit of the target virtual object, wherein the target model unit is a model unit to be subjected to ambient light shielding treatment and is provided with a minimum bounding box.
The target virtual object refers to a three-dimensional fixed object or a three-dimensional movable object in a virtual game scene, and the three-dimensional fixed object can be a virtual landform (such as a mountain and gravels), a fixed virtual article (such as a building, furniture and a statue) and the like; the three-dimensional movable object can be a virtual character, a virtual animal, a virtual vehicle (such as an automobile and a trolley), a movable virtual article (such as a sweeping robot and a fan) and the like; the target model unit is any model part of the target virtual object corresponding to the complete model, which needs to be rendered to generate the ambient light shielding effect, and can be understood as various head, back or leg parts of the virtual character.
In a specific application scenario, the target model units of each target virtual object to be subjected to the ambient light shielding processing may be preset according to the virtual object display requirements in the virtual game scene, for example, only one target model unit (e.g., a back) required to generate the ambient light shielding effect may be set in the virtual character, or a plurality of target model units (e.g., a back and a leg) required to generate the ambient light shielding effect may 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 the rendering of the ambient light shielding effect corresponding to the target model unit included in the target virtual object is further realized by performing the subsequent embodiment steps 102 to 104. When a plurality of target model units are simultaneously set for the same target virtual object, the rendering priorities of the plurality of target model units can be set according to the position composition of the model, and the rendering of the ambient light shielding effect of the target model units is sequentially executed according to the sequence of the rendering priorities from large to small, wherein the rendering priorities can be set according to user definition, and no specific limitation is performed.
The execution main body of the application can be a game client or a server, and can acquire the target three-dimensional texture corresponding to the target model unit after acquiring the target model unit of the target virtual object to be subjected to the ambient light shielding treatment; and then obtaining a target cube model of the target model unit, rendering the target three-dimensional texture by using the target cube model, and rendering the ambient light shielding effect of the target model unit according to the target cube model and the target three-dimensional texture.
102. And acquiring a target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is a prebaked three-dimensional texture of the target model unit, and the size of the target three-dimensional texture is related to the size of the minimum bounding box of the target model unit.
The three-dimensional texture of the target is in a three-dimensional form and is characterized in that the texture information of a target model unit is recorded and is different from two-dimensional textures in a picture form, the recording form of the texture information corresponding to the three-dimensional texture of the target is a cube model, the texture information of the three-dimensional texture of the target comprises two parts, one part is a model unit texture with the same size as the target model unit, the other part is an edge extension texture of the target model unit, and the edge extension texture has a fuzzy extension effect in an extension area of the target model unit.
In a specific application scenario, after at least one target model unit of a target virtual object, which needs to generate an ambient light shielding effect, is determined, before the step of this embodiment is executed, at least one target model unit needs to be pre-baked to generate a static target three-dimensional texture, and specifically, a static target three-dimensional texture with a fuzzy extension effect is generated by setting a minimum bounding box corresponding to the target model unit and baking the minimum bounding box according to a bone joint of the target model unit.
Correspondingly, as an optional mode, after the target three-dimensional texture is generated, in order to realize resource reuse of the generated three-dimensional texture, a mapping relation between the pre-baked target three-dimensional texture and the target model unit may be created, and the target three-dimensional texture and the mapping relation are stored in the target texture atlas library. Correspondingly, for the embodiment, the target three-dimensional texture of the target virtual object corresponding to the at least one target model unit can be retrieved from 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 the method of splitting the target virtual object according to the model unit, respectively performing texture prebaking, and binding the three-dimensional texture generated by prebaking to the target model unit, the subsequent three-dimensional texture rendering and ambient light shielding processing can be accelerated. Rendering from scratch may take a significant amount of time, and therefore, some portions of the rendering are "baked" ahead of time for the selected target virtual object through the pre-baking process. Then, when the rendering is clicked on, the rendering of the entire scene will be faster, since the colors of these target virtual objects do not need to be recalculated. In addition, by generating the edge extension texture with the fuzzy extension effect and binding the edge extension texture to the target model unit, the target three-dimensional texture can generate a real ambient light shielding effect in a virtual environment when the target virtual object is at a fixed position or in a moving process, so that any virtual object close to the target virtual object can be influenced by the target three-dimensional texture. By means of splitting rendering according to the model units, custom rendering of the ambient light shielding effect of any model part of the virtual object can be achieved, and personalized requirements of game development are met.
103. And acquiring a target cube model of the target model unit, wherein the target cube model is used for rendering a target three-dimensional texture, and the size of the target cube model is the same as that of the target three-dimensional texture.
For the embodiment, since the recording form of the texture information corresponding to the target three-dimensional texture generated by the present application is a Cube model, in the using stage of the target three-dimensional texture, the target three-dimensional texture may be rendered by a target Cube model (e.g., Cube) having the same size as the target three-dimensional texture, and specifically, the target three-dimensional texture may be rendered to the back of the target Cube model (e.g., Cube), where the back of the target Cube model refers to a side of the Cube model facing away from the viewport camera.
104. And rendering the ambient light shielding effect of the target model unit according to the target cube model and the target three-dimensional texture.
For this embodiment, in the process of rendering the target three-dimensional texture, in the rendering stage, the target cube model may perform rendering determination on pixels according to the depth map of the view direction, and determine whether there is a crossing between the pixels of other virtual objects and the pixels inside the box corresponding to the target cube model. If the pixel points with crossed positions exist, world coordinates PW points of the interior sight of the target cube model and the surface of at least one virtual object in the virtual three-dimensional scene can be further calculated, and the world coordinates can be calculated by a screen ray difference method; the PW point is then converted into the local coordinates PL of the target cube model by the model matrix (Object2World) of the target cube model. Because the target three-dimensional texture has a corresponding relation with the target cube model and is suitable for a local coordinate system, the minimum coordinate of the PL local coordinate of the target cube model is (-0.5, -0.5, -0.5), and the minimum UV coordinate of the 3D texture is from (0,0,0), the local coordinate needs to be converted by (0.5,0.5,0.5) to obtain a three-dimensional texture sampling UV value, and the accuracy of a sampling result is ensured through coordinate conversion; and finally, rendering the ambient light shielding effect of the target model unit according to the three-dimensional texture sampling UV value.
By the ambient light shielding processing method in the embodiment, a target model unit of a target virtual object to be subjected to ambient light shielding processing can be obtained first, and then a target three-dimensional texture corresponding to the target model unit is obtained, wherein the target three-dimensional texture is obtained by prebaking the target model unit, and the size of the target three-dimensional texture is related to the size of a minimum bounding box of the target model unit; further, a target cube model of the target model unit may be acquired, the target three-dimensional texture may be rendered using the target cube model, and an ambient light shielding effect of the target model unit may be rendered according to the target cube model and the target three-dimensional texture. According to the technical scheme, the target three-dimensional texture is generated through prebaking, the influence of the model on the ambient light shielding of a scene is simulated by utilizing the volume information of the target three-dimensional texture, the real-time performance of the ambient light shielding effect can be ensured, the processes of subsequent three-dimensional texture rendering and ambient light shielding processing are accelerated, the performance consumption of the server during the ambient light shielding processing is reduced, the requirement of a game on the performance of game player equipment is reduced, the game can be normally run by using a low-profile machine, the running speed of the game can be increased, and good game experience is created for game users.
Further, as a refinement and an extension of the specific implementation of the foregoing embodiment, in order to fully describe the implementation of this embodiment, this embodiment further provides another ambient light shielding processing method, as shown in fig. 2, where the method includes:
201. and acquiring a target model unit of the target virtual object, wherein the target model unit is a model unit to be subjected to ambient light shielding treatment and is provided with a minimum bounding box.
202. And acquiring a target three-dimensional texture corresponding to the target model unit, determining main skeleton position coordinates of a skeleton part corresponding to the target model unit, and mapping the target three-dimensional texture obtained by pre-baking to the target model unit according to the main skeleton position coordinates so as to enable the movement of the target three-dimensional texture to be consistent with the movement of the target model unit.
The target three-dimensional texture is obtained by pre-baking the target model unit, and the size of the target three-dimensional texture is related to the size of the minimum bounding box of the target model unit. Specifically, when the target three-dimensional texture is prebaked through the target model unit, the minimum bounding box Rmin of the target model unit can be determined first, and further a new AABB target bounding box Rmax is generated according to the respective external extension E (assumed) distances in the X, Y, and Z axes of the minimum bounding box Rmin; baking the target model unit into an initial three-dimensional texture with the size of Rmax according to the size of the target bounding box Rmax; and then, carrying out fuzzy operation on the initial three-dimensional texture to generate an outer rubbing effect with fuzzy edges, storing the result into the 3D texture, storing Rmax information, and completing the prebaking of the target three-dimensional texture of the target model unit. Namely, 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 comprises the model unit texture of the model unit and the edge extension texture of the extension area of the model unit.
Correspondingly, when the target three-dimensional texture is pre-baked, the embodiment steps may specifically include: respectively extending the minimum bounding box set by the target model unit upwards and outwards by preset distances according to X, Y and Z axes to obtain a target bounding box; generating an initial three-dimensional texture of the target model unit according to the target bounding box through prebaking; and carrying out convolution fuzzy processing on the initial three-dimensional texture to generate the target three-dimensional texture with fuzzy extension effect in the extension area of the target model unit. When convolution blurring processing is performed on the initial three-dimensional texture, convolution needs to be performed on three axes, namely X, Y and Z, corresponding to the target three-dimensional texture, and a specific convolution processing mode is the same as that of an existing two-dimensional image edge blurring processing mode, which is not described in detail herein. For the implementation, the convolution blurring processing is performed on the three-dimensional texture to expand the size of the three-dimensional texture, so that the ambient light shielding effect of the target three-dimensional texture can affect an object in contact with the target virtual object (for example, when the target virtual object is close to a wall, the back of the target model unit generates an ambient light shielding effect on the wall corresponding to the edge extension texture of the target three-dimensional texture).
For the embodiment, after the target three-dimensional texture corresponding to the target model unit is obtained, the main skeleton position coordinates of the skeleton part corresponding to the target model unit can be determined, and the target three-dimensional texture obtained by pre-baking is mapped to the target model unit according to the main skeleton position coordinates, that is, the creating of the binding relationship between the target three-dimensional texture and the target model unit is equivalent. The target three-dimensional texture can present a movement display effect consistent with the movement of the target model unit based on the binding relationship. By the method for decoupling the baking of the target three-dimensional texture from the action of the target virtual object, the baked target three-dimensional texture can be multiplexed, and the rendering efficiency of the target three-dimensional texture is improved.
203. The method comprises the steps of obtaining a target cube model of a target model unit, and determining world coordinates of an intersection point of the target cube model and at least one virtual object in a virtual three-dimensional scene, wherein the target cube model is used for rendering a target three-dimensional texture, the size of the target cube model is the same as that of the target three-dimensional texture, and the target cube model has a coordinate corresponding relation.
The world coordinates can be used to identify the world space position in the virtual environment where each virtual object is located, and the coordinates are represented by X, Y, Z, where Y represents the height of the virtual object from the base rock layer, and X and Z represent the position of the virtual object on the plane.
In a specific application scene, when determining the world coordinates of the intersection point of a target cube model and at least one virtual object in a virtual three-dimensional scene, the intersection point of a sight line in the target cube model and any virtual object except the target virtual object in the virtual three-dimensional scene can be calculated according to a sight line direction depth map, a screen ray is emitted from a corresponding point on a screen to the direction of the intersection point, the collision of a directional ray and other virtual objects is checked through the screen ray, and the world coordinates of the intersection point can be calculated based on a screen ray difference algorithm and the coordinates of the corresponding point on the screen. Correspondingly, the embodiment step 204 may specifically include: determining at least one intersection point of 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 are calculated using a screen ray difference algorithm.
204. And calculating a three-dimensional texture sampling UV value of the intersection point based on the world coordinate and the coordinate corresponding relation, and rendering an ambient light shielding effect of the target model unit according to the three-dimensional texture sampling UV value, wherein the ambient light shielding effect is matched with the geometric form of the target model unit.
In a specific application scenario, when calculating a three-dimensional texture sampling UV value of an intersection point based on a world coordinate and a coordinate correspondence, embodiment step 204 may specifically include: converting the world coordinates into local coordinates of the target cube model by using a model matrix of the target cube model; and determining a three-dimensional texture sampling UV value corresponding to the local coordinate according to the corresponding relation of the coordinates.
Wherein the model matrix may be an Object2World matrix for transforming the vertex/direction vectors from the World space to the model space of the target cube model. After the local coordinates of the target cube model are obtained through 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 converted by (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.
Correspondingly, when rendering the ambient light shielding effect of the target model unit according to the three-dimensional texture sampled UV value, embodiment step 204 may specifically include: acquiring a first pixel value of a target three-dimensional texture under a three-dimensional texture sampling UV value and a second pixel value of at least one virtual object under a world coordinate; performing positive film bottom-folding processing on the first pixel value and the second pixel value, and calculating a pixel shading value of at least one virtual object under world coordinates; rendering the at least one virtual object according to the pixel shading value to form an ambient light shading effect of the target model unit on the at least one virtual object. The positive film-on-bottom method is a darkening mode with high frequency, two homologous layers are mixed in a positive film-on-bottom mode, an image can be darkened in a smooth but nonlinear mode, and the obtained effect is that an object appears from the dark. Specifically, the pixel values of the two colors may be multiplied and then divided by 255 to obtain the pixel value of the final color. The negative copy-on-back mode is typically performed in a darker color than both of the original colors. Any color and black positive stack will get any black, any color and white positive stack will remain the same, and performing this mode with other colors will produce the effect of lighting in the darkroom with this color.
Correspondingly, when rendering at least one virtual object according to the pixel shading value to form the ambient light shading effect of the target model unit on the at least one virtual object, the embodiment steps may specifically include: rendering the second virtual object in dependence on the pixel shading values and a model of the second virtual object to form an ambient light shading effect on the second virtual object, wherein a dimmed version of the ambient light shading effect matches a geometric version of the target model cell. For example, the geometric shape corresponding to the target model unit is the foot shape, and the darkening shape of the ambient light shading effect is the sole shape of the virtual object; the geometry corresponding to the target model unit is the back shape, so the darkened shape of the ambient light shielding effect is the back shape of the virtual object.
In the method for processing ambient light shielding provided by this embodiment, a target model unit of a target virtual object to be processed by ambient light shielding may be first obtained, and then a target three-dimensional texture corresponding to the target model unit is obtained, where the target three-dimensional texture is obtained by pre-baking the target model unit, and the size of the target three-dimensional texture is related to the size of a minimum bounding box of the target model unit; further, a target cube model of the target model unit may be acquired, the target three-dimensional texture may be rendered using the target cube model, and an ambient light shielding effect of the target model unit may be rendered according to the target cube model and the target three-dimensional texture. According to the technical scheme, the target three-dimensional texture is generated through prebaking, the influence of the model on the ambient light shielding of a scene is simulated by utilizing the volume information of the target three-dimensional texture, the real-time performance of the ambient light shielding effect can be ensured, the processes of subsequent three-dimensional texture rendering and ambient light shielding processing are accelerated, the performance consumption of the server during the ambient light shielding processing is reduced, the requirement of a game on the performance of game player equipment is reduced, the game can be normally run by using a low-profile machine, the running speed of the game can be increased, and good game experience is created for game users.
Further, as a specific implementation of the method shown in fig. 1, this embodiment provides an ambient light shielding processing apparatus, as shown in fig. 3, the apparatus includes: a first acquisition module 31, a second acquisition module 32, a third acquisition module 33, and a rendering module 34.
The first obtaining module 31 may be configured to 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 shielding processing, and the target model unit is provided with a minimum bounding box;
a second obtaining module 32, configured to obtain a target three-dimensional texture corresponding to a target model unit, where the target three-dimensional texture is a prebaked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a size of a minimum bounding box of the target model unit;
a third obtaining module 33, configured to obtain a target cube model of the 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 that of the target three-dimensional texture;
and a rendering module 34, configured to render the ambient light masking effect of the target model unit according to the target cube model and the target three-dimensional texture.
In a specific application scenario, to implement the pre-baking process on the target three-dimensional texture, as shown in fig. 4, the apparatus further includes: a pre-bake module 35;
the prebaking module 35 is configured to extend the minimum bounding box set in the target model unit upward and outward by a preset distance according to the X, Y, and Z axes, respectively, to obtain a target bounding box; generating an initial three-dimensional texture of the target model unit according to the target bounding box through prebaking; and carrying out convolution fuzzy processing on the initial three-dimensional texture to generate the target three-dimensional texture with fuzzy extension effect in the extension area of the target model unit.
In a specific application scenario, as shown in fig. 4, the rendering module 34 may specifically include: a determination unit 341, a rendering unit 342;
a determining unit 341, configured to determine world coordinates of an intersection point of a target cube model and at least one virtual object in a virtual three-dimensional scene, where the target cube model and the target three-dimensional texture have a coordinate correspondence;
the rendering unit 342 is configured to calculate a three-dimensional texture sampling UV value of the intersection point based on the world coordinates and the coordinate correspondence, and render an ambient light shielding effect of the target model unit according to the three-dimensional texture sampling UV value, where the ambient light shielding effect matches a geometric form of the target model unit.
In a specific application scenario, the determining unit 341 is specifically configured to determine at least one intersection point of the target cube model and at least one virtual object in the virtual three-dimensional scene according to the gaze direction depth map; the world coordinates of the intersection are calculated using a screen ray difference algorithm.
In a specific application scenario, when calculating a three-dimensional texture sampling UV value of an intersection point based on a world coordinate and a coordinate correspondence, the rendering unit 342 may be specifically configured to: converting the world coordinates into local coordinates of the target cube model by using a model matrix of the target cube model; and determining a three-dimensional texture sampling UV value corresponding to the local coordinate according to the coordinate corresponding relation.
In a specific application scenario, when rendering the ambient light shielding effect of the target model unit according to the three-dimensional texture sampled UV value, the rendering unit 342 may be specifically configured to: acquiring a first pixel value of a target three-dimensional texture under a three-dimensional texture sampling UV value and a second pixel value of at least one virtual object under a world coordinate; performing positive film bottom-folding processing on the first pixel value and the second pixel value, and calculating a pixel shading value of at least one virtual object under world coordinates; rendering the at least one virtual object according to the pixel shading value to form an ambient light shading effect of the target model unit on the at least one virtual object.
In a specific application scenario, the second obtaining module 32 may be specifically configured to determine main skeleton position coordinates of a skeleton part corresponding to the target model unit; and mapping the target three-dimensional texture obtained by pre-baking to a target model unit according to the main skeleton position coordinates so as to enable the movement of the target three-dimensional texture to be consistent with the movement of the target model unit.
It should be noted that other corresponding descriptions of the functional units related to the ambient light shielding processing apparatus provided in this embodiment may refer to the corresponding descriptions in the methods in fig. 1 to fig. 2, and are not repeated herein.
Based on the method shown in fig. 1 to fig. 2, correspondingly, the present embodiment further provides a storage medium, on which a computer program is stored, and the program, when executed by a processor, implements the ambient light shielding processing method shown in fig. 1 to fig. 2.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method of the embodiments of the present application.
Based on the methods shown in fig. 1 to fig. 2 and the virtual device embodiments shown in fig. 3 and fig. 4, in order to achieve the above object, an embodiment of the present application further provides an ambient light shielding processing apparatus, as shown in fig. 5, which includes a processor (processor)41, a communication Interface (communication Interface)42, a memory (memory)43, and a communication bus 44. Wherein: the processor 41, the communication interface 42, and the memory 43 communicate with each other via a communication bus 44. A communication interface 44 for communicating with network elements of other devices, such as clients or other servers. The processor 41 is configured to execute a program, and may specifically execute relevant steps in the foregoing method for processing a front-end interface request. In particular, the program may include program code comprising computer operating instructions. The processor 41 may be a processor CPU or an application Specific Integrated circuit asic or one or more Integrated circuits configured to implement embodiments of the present invention.
Specifically, the device may be a personal computer, a server, a smart phone, or other network devices, and the like, and the device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program to implement the above-described ambient light shielding processing method as shown in fig. 1 to 2.
Optionally, the entity device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface may include a Display screen (Display), an input unit such as a keypad (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 (e.g., WI-FI interface), etc.
It will be understood by those skilled in the art that the above-described physical device structure provided in the present embodiment does not constitute a limitation to the physical device, and may include more or fewer components, or combine some components, or arrange different components.
The storage medium may further 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-described physical devices, and supports the operation of the information processing program as well as other software and/or programs. The network communication module is used for realizing communication among components in the storage medium and communication with other hardware and software in the information processing entity device.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and can also be implemented by hardware. By applying the scheme of the embodiment, a target model unit of a target virtual object to be subjected to ambient light shielding processing can be obtained firstly, and then a target three-dimensional texture corresponding to the target model unit is obtained, wherein the target three-dimensional texture is obtained by pre-baking the target model unit, and the size of the target three-dimensional texture is related to the size of the minimum bounding box of the target model unit; further, a target cube model of the target model unit may be acquired, the target three-dimensional texture may be rendered using the target cube model, and an ambient light shielding effect of the target model unit may be rendered according to the target cube model and the target three-dimensional texture. According to the technical scheme, the target three-dimensional texture is generated through prebaking, the influence of the model on the ambient light shielding of a scene is simulated by utilizing the volume information of the target three-dimensional texture, the real-time performance of the ambient light shielding effect can be ensured, the processes of subsequent three-dimensional texture rendering and ambient light shielding processing are accelerated, the performance consumption of the server during the ambient light shielding processing is reduced, the requirement of a game on the performance of game player equipment is reduced, the game can be normally run by using a low-profile machine, the running speed of the game can be increased, and good game experience is created for game users.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.

Claims (10)

1. An ambient light shield processing method, comprising:
the method comprises the steps of obtaining a target model unit of a target virtual object, wherein the target model unit is a model unit to be subjected to ambient light shielding processing and is provided with a minimum bounding box;
acquiring a target three-dimensional texture corresponding to the target model unit, wherein the target three-dimensional texture is a prebaked three-dimensional texture of the target model unit, and the size of the target three-dimensional texture is related to the size of a minimum bounding box of the target model unit;
acquiring a target cube model of the target model unit, wherein the target cube model is used for rendering the target three-dimensional texture, and the size of the target cube model is the same as that of the target three-dimensional texture;
and rendering the ambient light shielding effect of the target model unit according to the target cube model and the target three-dimensional texture.
2. The method according to claim 1, further comprising, before obtaining the target three-dimensional texture corresponding to the target model unit:
respectively extending the minimum bounding box set by the target model unit upwards and outwards by preset distances according to X, Y and Z axes to obtain a target bounding box;
generating an initial three-dimensional texture of the target model unit according to the target bounding box pre-baking;
and carrying out convolution fuzzy processing on the initial three-dimensional texture to generate a target three-dimensional texture with fuzzy extension effect in the extension area of the target model unit.
3. The method of claim 1, wherein said rendering an ambient light masking effect of said target model unit from said target cube model and said target three-dimensional texture comprises:
determining world coordinates of an intersection point of the 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 corresponding relation;
and calculating a three-dimensional texture sampling UV value of the intersection point based on the world coordinate and the coordinate corresponding relation, and rendering an ambient light shielding effect of the target model unit according to the three-dimensional texture sampling UV value, wherein the ambient light shielding effect is matched with the geometric form of the target model unit.
4. The method of claim 3, wherein determining world coordinates of an intersection of the target cube model and at least one virtual object in a virtual three-dimensional scene comprises:
determining at least one intersection point of the target cube model and at least one virtual object in the virtual three-dimensional scene according to the sight direction depth map;
and calculating the world coordinates of the intersection points by using a screen ray difference algorithm.
5. The method of claim 3, wherein said calculating three-dimensional texture sample UV values for said intersection points based on said world coordinates and said coordinate correspondence comprises:
converting the world coordinates to local coordinates of the target cube model using a model matrix of the target cube model;
and determining a three-dimensional texture sampling UV value corresponding to the local coordinate according to the coordinate corresponding relation.
6. The method of claim 3, wherein the rendering the ambient light masking effect of the object model unit according to the three-dimensional texture sampled UV value comprises:
acquiring a first pixel value of the target three-dimensional texture under the three-dimensional texture sampling UV value and a second pixel value of the at least one virtual object under the world coordinate;
performing positive film bottom-folding processing on the first pixel value and the second pixel value, and calculating a pixel shading value of the at least one virtual object under the world coordinate;
rendering the at least one virtual object according to the pixel shading value to form an ambient light shading effect of the target model unit on the at least one virtual object.
7. The method according to claim 1, wherein the obtaining of the target three-dimensional texture corresponding to the target model unit comprises:
determining main skeleton position coordinates of the skeleton part corresponding to the target model unit;
and mapping the target three-dimensional texture obtained by prebaking to the target model unit according to the main skeleton position coordinates so as to enable the movement of the target three-dimensional texture to be consistent with the movement of the target model unit.
8. An ambient light shield processing apparatus, comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a target model unit of a target virtual object, the target model unit is a model unit to be subjected to ambient light shielding treatment, and the target model unit is provided with a minimum bounding box;
a second obtaining module, configured to obtain a target three-dimensional texture corresponding to the target model unit, where the target three-dimensional texture is a prebaked three-dimensional texture of the target model unit, and a size of the target three-dimensional texture is related to a size of a minimum bounding box of the target model unit;
a third obtaining module, configured to obtain 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;
and the rendering module is used for rendering the ambient light shielding effect of the target model unit according to the target cube model and the target three-dimensional texture.
9. A storage medium on which a computer program is stored, characterized in that the program, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. An ambient light shield processing device comprising a storage medium, a processor and a computer program stored on the storage medium and executable on the processor, characterized in that the processor, when executing the program, implements the method of any one of claims 1 to 7.
CN202210510129.1A 2022-05-11 2022-05-11 Ambient light shielding processing method, device and equipment Pending CN114832375A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210510129.1A CN114832375A (en) 2022-05-11 2022-05-11 Ambient light shielding processing method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210510129.1A CN114832375A (en) 2022-05-11 2022-05-11 Ambient light shielding processing method, device and equipment

Publications (1)

Publication Number Publication Date
CN114832375A true CN114832375A (en) 2022-08-02

Family

ID=82569840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210510129.1A Pending CN114832375A (en) 2022-05-11 2022-05-11 Ambient light shielding processing method, device and equipment

Country Status (1)

Country Link
CN (1) CN114832375A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116416364A (en) * 2022-10-25 2023-07-11 北京大学 Data acquisition and estimation method and device for urban scene space variable environment illumination

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116416364A (en) * 2022-10-25 2023-07-11 北京大学 Data acquisition and estimation method and device for urban scene space variable environment illumination
CN116416364B (en) * 2022-10-25 2023-11-03 北京大学 Data acquisition and estimation method and device for urban scene space variable environment illumination

Similar Documents

Publication Publication Date Title
CN110196746B (en) Interactive interface rendering method and device, electronic equipment and storage medium
CN112241993B (en) Game image processing method and device and electronic equipment
CN110378947B (en) 3D model reconstruction method and device and electronic equipment
CN111968215A (en) Volume light rendering method and device, electronic equipment and storage medium
CN112734896B (en) Environment shielding rendering method and device, storage medium and electronic equipment
US20230249070A1 (en) Terrain deformation method and device, and non-transitory computer-readable storage medium
CN113436343A (en) Picture generation method and device for virtual studio, medium and electronic equipment
CN113658316B (en) Rendering method and device of three-dimensional model, storage medium and computer equipment
US20230230311A1 (en) Rendering Method and Apparatus, and Device
CN111583378B (en) Virtual asset processing method and device, electronic equipment and storage medium
CN114832375A (en) Ambient light shielding processing method, device and equipment
CN116664752B (en) Method, system and storage medium for realizing panoramic display based on patterned illumination
CN110378948B (en) 3D model reconstruction method and device and electronic equipment
CN112516595A (en) Magma rendering method, device, equipment and storage medium
CN115970275A (en) Projection processing method and device for virtual object, storage medium and electronic equipment
CN115487495A (en) Data rendering method and device
CN114219888A (en) Method and device for generating dynamic silhouette effect of three-dimensional character and storage medium
CN112473135B (en) Real-time illumination simulation method, device and equipment for mobile game and storage medium
CN110363860B (en) 3D model reconstruction method and device and electronic equipment
CN114288649A (en) Shadow edge determination and rendering method, storage medium and electronic device
CN110689606B (en) Method and terminal for calculating raindrop falling position in virtual scene
CN113332714A (en) Light supplementing method and device for game model, storage medium and computer equipment
JP2001283254A (en) Three-dimensional graphic plotting device and its method
US11875445B2 (en) Seamless image processing of a tiled image region
CN113908542A (en) Method and device for processing terrain data in game

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination