CN114119831A - Snow accumulation model rendering method and device, electronic equipment and readable medium - Google Patents

Snow accumulation model rendering method and device, electronic equipment and readable medium Download PDF

Info

Publication number
CN114119831A
CN114119831A CN202111416763.0A CN202111416763A CN114119831A CN 114119831 A CN114119831 A CN 114119831A CN 202111416763 A CN202111416763 A CN 202111416763A CN 114119831 A CN114119831 A CN 114119831A
Authority
CN
China
Prior art keywords
snow
model
vertex
vertex coordinate
coordinate offset
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
CN202111416763.0A
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202111416763.0A priority Critical patent/CN114119831A/en
Publication of CN114119831A publication Critical patent/CN114119831A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts

Abstract

The embodiment of the invention provides a rendering method and device of an accumulated snow model, an electronic device and a computer readable medium, wherein in the embodiment of the invention, an accumulated snow adjusting parameter aiming at the accumulated snow model is determined; extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model; determining target vertex coordinates through the accumulated snow adjusting parameters and the vertex coordinate offset vectors; rendering the snow model according to the target vertex coordinates to adjust the snow thickness of the snow in the snow model; therefore, the situation that a plurality of snow models are loaded in a game scene is avoided, the snow models can be changed in the game scene, meanwhile, the snow models can be designed by developers, and the snow models are prevented from being vulnerable in the game scene.

Description

Snow accumulation model rendering method and device, electronic equipment and readable medium
Technical Field
The embodiment of the invention relates to the technical field of games, in particular to a rendering method of an accumulated snow model, a rendering device of the accumulated snow model, electronic equipment and a computer readable medium.
Background
In games involving snow scenes, it is often necessary to make snow models for the game scenes. Because the weather can change in the game scene, if only the static snow accumulation model is adopted, the snow accumulation on the building always has the same effect no matter how the weather in the game is, no matter whether the weather is heavy snow, light snow or fine, so that the reality sense of a player is brought by the game, and the user experience is improved by adjusting the snow accumulation model when the weather changes.
At present, the adjustment of the snow accumulation model in the game scene mostly adopts the following modes:
in the first mode, snow effects are displayed through a plurality of different models, so that snow scene changes are realized; in this way, although the picture effect is excellent, the amount of data to be loaded is huge, which results in excessive occupation of processor threads, and because the amount of data is large, the model that can be provided is relatively limited, and the dynamic picture is excessively unnatural during switching.
The snow scene change is realized by dynamically and gradually moving the snow accumulation model along the y-axis direction; although the data amount required to be processed by adopting the method is low, a snow scene picture in a game scene is easy to leak, for example, the snow model is directly adjusted on the y axis, although the thickness of snow can be changed along with the change of weather in the game scene, the length-width ratio of the snow model is different from the length-width ratio of other scenes in the game scene due to the fact that the snow model is adjusted only on the y axis, and further the spatial perspective rule of the snow model after being adjusted is not consistent with the spatial perspective rule of other scenes in the game scene. Nor can the designer adjust the model for changes in the amount of snow in the game scene.
Disclosure of Invention
The embodiment of the invention provides a snow accumulation model rendering method, a snow accumulation model rendering device, electronic equipment and a computer readable storage medium, and aims to solve the problem of how to reduce the rendering computation amount in a game scene and improve the continuity in the model change process.
The embodiment of the invention discloses a snow model rendering method, which provides a graphical user interface through terminal equipment, wherein the graphical user interface comprises a snow model, and the method can comprise the following steps:
determining a snow adjustment parameter for the snow model;
extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model;
determining target vertex coordinates through the accumulated snow adjusting parameters and the vertex coordinate offset vectors;
and rendering the snow cover model according to the target vertex coordinates so as to adjust the snow cover thickness of the snow cover in the snow cover model.
Optionally, the graphical user interface further includes a game scenario, and the determining the snow adjustment parameter for the snow model may include:
acquiring weather information in the game scene; the weather information may include temperature and snowfall amount;
determining a snow adjustment parameter for the snow model from the weather information.
Optionally, before the step of extracting vertex coordinate offset vectors from vertices of the snow cover model, the method may further include:
subtracting a first vertex coordinate of a vertex of the snow accumulation model from a second vertex coordinate of a vertex of another snow accumulation model with the same topological structure as the snow accumulation model, and solving a vertex coordinate offset vector between the first vertex coordinate and the second vertex coordinate;
converting the vertex coordinate offset vector to a color attribute format in which to store in vertices of the snow model.
Optionally, the topology is the same, that is, the number of vertexes, edges, and faces of the snow model and the other snow model are the same, and the vertexes, the edges, and the faces have the same relationship with each other.
Optionally, the step of determining target vertex coordinates by the snow cover adjustment parameter and the vertex coordinate offset vector may include:
multiplying the accumulated snow adjusting parameter and the vertex coordinate offset vector to obtain a product value;
and adding the product value and the first vertex coordinate to obtain a target vertex coordinate.
The embodiment of the invention also discloses a snow model rendering device, which provides a graphical user interface through terminal equipment, wherein the graphical user interface comprises a snow model, and the snow model rendering device can comprise:
a snow adjustment parameter determination module to determine a snow adjustment parameter for the snow model;
the vertex coordinate offset vector extraction module is used for extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model;
the target vertex coordinate determination module is used for determining target vertex coordinates through the accumulated snow adjustment parameters and the vertex coordinate offset vectors;
and the snow cover model rendering module is used for rendering the snow cover model according to the target vertex coordinates so as to adjust the snow cover thickness of the snow cover in the snow cover model.
Optionally, the graphical user interface further includes a game scene, and the snow cover adjustment parameter determining module may include:
the weather information acquisition submodule is used for acquiring weather information in the game scene; the weather information may include temperature and snowfall amount;
and the snow cover adjustment parameter determining submodule is used for determining a snow cover adjustment parameter aiming at the snow cover model according to the weather information.
Optionally, the apparatus may further include:
the vertex coordinate offset vector calculation module is used for subtracting a first vertex coordinate of a vertex of the snow accumulation model from a second vertex coordinate of a vertex of another snow accumulation model with the same topological structure as the snow accumulation model to obtain a vertex coordinate offset vector between the first vertex coordinate and the second vertex coordinate;
and the vertex coordinate offset vector storage module is used for converting the vertex coordinate offset vector into a color attribute format, and storing the color attribute format in the vertex of the snow cover model.
Optionally, the topology is the same, that is, the number of vertexes, edges, and faces of the snow model and the other snow model are the same, and the vertexes, the edges, and the faces have the same relationship with each other.
Optionally, the target vertex coordinate determination module may include:
and the target vertex coordinate calculation submodule is used for multiplying the accumulated snow adjusting parameters and the vertex coordinate offset vector to obtain a product value, and adding the product value and the first vertex coordinate to obtain a target vertex coordinate.
The embodiment of the invention also discloses electronic equipment which can comprise a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory finish mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method according to the embodiment of the present invention when executing the program stored in the memory.
Also disclosed are one or more computer-readable media having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform a method according to an embodiment of the invention.
Embodiments of the invention may include the following advantages:
in the embodiment of the invention, the snow cover adjusting parameters aiming at the snow cover model are determined; extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model; determining target vertex coordinates through the accumulated snow adjusting parameters and the vertex coordinate offset vectors; rendering the snow model according to the target vertex coordinates to adjust the snow thickness of the snow in the snow model; therefore, the situation that a plurality of snow models are loaded in a game scene is avoided, the snow models can be changed in the game scene, meanwhile, the snow models can be designed by developers, and the snow models are prevented from being vulnerable in the game scene.
Drawings
Fig. 1 is a flowchart illustrating steps of a method for rendering a snow model according to an embodiment of the present invention;
FIG. 2a is a schematic diagram of a game scene building provided in an embodiment of the invention;
FIG. 2b is a schematic view of a snow model provided in an embodiment of the present invention;
FIG. 2c is a schematic view of another snow model provided in an embodiment of the present invention;
FIG. 3 is a schematic diagram of a snow model corresponding to a snow adjustment parameter according to an embodiment of the present disclosure;
fig. 4 is a block diagram of a rendering apparatus for a snow cover model according to an embodiment of the present invention;
fig. 5 is a block diagram of an electronic device provided in an embodiment of the invention;
fig. 6 is a schematic diagram of a computer-readable medium provided in an embodiment of the invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The method for rendering the snow cover model in one embodiment of the invention can be run on a local terminal device or a server. When the rendering method of the snow model is executed on the server, the rendering method of the snow model can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system comprises the server and the client device.
In an optional embodiment, various cloud applications may be run under the cloud interaction system, for example: and (5) cloud games. Taking a cloud game as an example, a cloud game refers to a game mode based on cloud computing. In the cloud game operation mode, the game program operation main body and the game picture presentation main body are separated, the storage and the operation of the snow accumulation model rendering method are completed on the cloud game server, and the client device is used for receiving and sending data and presenting the game picture, for example, the client device can be a display device with a data transmission function close to a user side, such as a first terminal device, a television, a computer, a palm computer and the like; but the cloud game server of the cloud is used for rendering the snow cover model. When a game is played, a player operates the client device to send an operation instruction to the cloud game server, the cloud game server runs the game according to the operation instruction, data such as game pictures and the like are encoded and compressed, the data are returned to the client device through a network, and finally the data are decoded through the client device and the game pictures are output.
In an optional implementation manner, taking a game as an example, the local terminal device stores a game program and is used for presenting a game screen. The local terminal device is used for interacting with the player through a graphical user interface, namely, a game program is downloaded and installed and operated through an electronic device conventionally. The manner in which the local terminal device provides the graphical user interface to the player may include a variety of ways, for example, it may be rendered for display on a display screen of the terminal or provided to the player through holographic projection. For example, the local terminal device may include a display screen for presenting a graphical user interface including a game screen and a processor for running the game, generating the graphical user interface, and controlling display of the graphical user interface on the display screen.
Referring to fig. 1, a flowchart illustrating steps of a snow model rendering method provided in an embodiment of the present invention is shown, which may specifically include the following steps:
step 101, determining a snow cover adjustment parameter for the snow cover model;
102, extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model;
103, determining a target vertex coordinate through the accumulated snow adjusting parameter and the vertex coordinate offset vector;
and 104, rendering the snow accumulation model according to the target vertex coordinates so as to adjust the snow accumulation thickness of the snow accumulation in the snow accumulation model.
In a specific implementation, the embodiments of the present invention may be applied to a mobile terminal, for example, a mobile phone, a tablet computer, a personal digital assistant, a wearable device (such as a bracelet, glasses, a watch, and the like), and the like. The operating systems of these mobile terminals may include Android (Android), IOS, Windows phone, Windows, and the like.
In practical application, the mobile terminal of the embodiment of the invention can be loaded with a game application program, the game application program can be executed on a processor of the mobile terminal, and the terminal device can provide a graphical user interface, wherein the graphical user interface can comprise a game scene and a snow model.
The snow cover adjusting parameters can be used for adjusting the snow cover thickness of the snow cover model, so that the snow cover adjusting parameters can be determined firstly when the snow cover model in a game scene needs to change.
In an optional embodiment of the present invention, the topological structure is the same, which means that the number of vertices, edges, and faces of the snow model and other snow models are the same, and the relationships between the vertices, edges, and faces are the same.
In specific implementation, the embodiment of the invention does not need to load a plurality of snow models into a game scene, but only needs to design an initial snow model according to objects in a building or other game scenes in a game development stage, then can acquire each vertex of the initial snow model, manufacture other snow models having the same topological structure as the initial snow model according to each vertex of the initial snow model, after manufacturing other snow models, can determine vertex coordinate offset vectors between vertex coordinates of each vertex of the initial snow model and vertex coordinates of each vertex of other snow models, and store the vertex coordinate offset vectors in the vertices of the initial snow model, wherein the vertex coordinate offset vectors can be offset values between each vertex of the initial snow model and each vertex of other snow models, at this time, other snow models having the same topological structure as the initial snow model may be deleted, and it should be noted that, in the embodiment of the present invention, other snow models are not loaded into the game scene, but the initial snow model is loaded into the game scene, and vertex coordinate offset vectors associated with other snow models may be stored in advance in a vertex of the initial snow model, so that the embodiment of the present invention may directly extract the vertex coordinate offset vectors from the vertex of the snow model.
For example, as shown, fig. 2a is a schematic diagram of a game scene building provided in an embodiment of the present invention; FIG. 2b is a schematic view of a snow model provided in an embodiment of the present invention; FIG. 2c is a schematic view of another snow model provided in an embodiment of the present invention; first, an initial snow model 202 is designed and created from a construction error 201 in a virtual game scene, and when a new topology is maintained unchanged, that is, when vertices, edges, and faces of the model are not increased or decreased, only positions of vertices in the model are adjusted to create another snow model 203 having the same topology as the initial snow model, position information of each vertex of the initial snow model 202 and the other snow model 203 is acquired, vertex coordinate offset vectors between each vertex of the initial snow model 202 and each vertex of the other snow model 203 are obtained, the vertex coordinate offset vectors are stored in the vertices of the initial snow model 202, and the other snow model 203 having the same topology as the initial snow model is deleted.
In a specific implementation, after the terminal device determines the snow cover adjustment parameter, the embodiment of the present invention may read the vertex coordinate offset vector corresponding to the snow cover adjustment parameter, and calculate the target vertex coordinate according to the snow cover adjustment parameter and the vertex coordinate offset vector.
As an example, the terminal device may re-render the snow model according to the target vertex coordinates after calculating the target vertex coordinates to adjust the thickness of snow that stops bleeding in the snow model.
In the embodiment of the invention, the snow cover adjusting parameters aiming at the snow cover model are determined; extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model; determining target vertex coordinates through the accumulated snow adjusting parameters and the vertex coordinate offset vectors; rendering the snow model according to the target vertex coordinates to adjust the snow thickness of the snow in the snow model; therefore, the situation that a plurality of snow models are loaded in a game scene is avoided, the snow models can be changed in the game scene, meanwhile, the snow models can be designed by developers, and the snow models are prevented from being vulnerable in the game scene.
Furthermore, the embodiment of the invention not only can accurately control the modeling change of the snow model by research personnel, but also reduces the performance consumption caused by the dynamic change of the snow model, and enhances the game art performance with lower performance cost, thereby improving the user experience.
On the basis of the above-described embodiment, a modified embodiment of the above-described embodiment is proposed, and it is to be noted herein that, in order to make the description brief, only the differences from the above-described embodiment are described in the modified embodiment.
In an optional embodiment of the present invention, the graphical user interface may further include a game scenario, and the step 101 of determining a snow cover adjustment parameter for the snow cover model may include the following steps:
acquiring weather information in the game scene; the weather information comprises temperature and snowfall amount;
determining a snow adjustment parameter for the snow model from the weather information.
In practical application, the graphical user interface of the embodiment of the invention may further include an accumulated snow model, weather information may be preset in a game scene by a game developer in a game development process, the weather information may be temperature, snowfall amount and the like, and the accumulated snow model may change along with changes of the weather information.
In specific implementation, the weather information can correspond to the snow cover adjustment parameters one by one, after the weather information in the game scene is acquired, the snow cover adjustment parameters for the snow cover model can be determined according to the weather information, and the snow cover adjustment parameters can be used for adjusting the snow cover thickness of the snow cover model.
In an optional embodiment of the present invention, before the step of extracting vertex coordinate offset vectors from the vertices of the snow cover model in step 102, the method may further include the steps of:
and subtracting a first vertex coordinate of the vertex of the snow cover model from a second vertex coordinate of the vertex of other snow cover models with the same topological structure as the snow cover model, and solving a vertex coordinate offset vector between the first vertex coordinate and the second vertex coordinate.
Converting the vertex coordinate offset vector to a color attribute format in which to store in vertices of the snow model.
As an example, the topology is the same, which means that the number of vertexes, edges and faces of the snow model is the same as that of other snow models, and the relationship among the vertexes, edges and surfaces is the same, the snow accumulation model can be a high snow accumulation model with the largest snow accumulation thickness in a game scene, the other snow accumulation models with the same topological structure as the snow accumulation model can be low-snow-amount snow accumulation models with snow thickness lower than the snow accumulation model, the embodiment of the invention can respectively obtain the first vertex coordinates of each vertex of the high-snow-amount model and the second vertex coordinates of each vertex of the low-snow-amount model, and can respectively convert the first vertex coordinates of the vertex of the snow accumulation model, and, subtracting second vertex coordinates of vertices of other snow models having the same topology as the snow model, thereby finding vertex coordinate offset vectors, optionally, this step may be done off-line, and its processing for data processing may not be done during game play.
For example, the vertex coordinate offset vector SnowDelta is the first vertex coordinate SnowHigh — the second vertex coordinate SnowLow.
Of course, those skilled in the art may use other algorithms to find the vertex coordinate offset vector, and the embodiments of the present invention are not limited thereto.
In a specific implementation, the embodiment of the present invention may convert the coordinate axis value of the vertex coordinate offset vector X, Y, Z into a three-primary-color attribute format of red, green, and blue R, G, B, so that the xyz value of the vertex coordinate offset vector may be directly stored in the vertex by using the vertex color rgb attribute.
In practical applications, based on the GPU: the GPU of the terminal device needs to read color attributes when rendering the snow model, so that the embodiment of the present invention may convert the vertex coordinate offset vector into a color attribute format, and store the color attribute format in the vertex of the snow model, so that in the rendering for the snow model, the GPU may extract the vertex coordinate offset vector by reading the color attributes in each vertex of the snow model in the vertex.
In an optional embodiment of the present invention, the step 103 of determining the target vertex coordinates through the snow cover adjustment parameter and the vertex coordinate offset vector may include the following steps:
multiplying the accumulated snow adjusting parameter and the vertex coordinate offset vector to obtain a product value;
and adding the product value and the first vertex coordinate to obtain a target vertex coordinate.
As an example, the Shader on the GPU may be used for calculation related to object drawing in real-time rendering, including illumination, deformation, drawing position, drawing manner, and the like, and after extracting the vertex coordinate offset vector, the Shader may multiply the snow cover adjustment parameter and the vertex coordinate offset vector, and add a product obtained by multiplying the snow cover adjustment parameter and the vertex coordinate offset vector to the first vertex coordinate to obtain the target vertex coordinate.
For example, the vertex color SnowDelta is read, multiplied by the global snow adjustment parameter snowPercent, and added to the vertex position vertexPosition of the snow model to calculate the target vertex coordinates: vertexPosition ═ SnowDelta ═ snowPercent + vertexPosition; thus, the vertex deformation calculation of the snow accumulation model is completed, and then the calculated vertex position is continuously used for performing subsequent calculation of the shader. Of course, those skilled in the art may use other algorithms to obtain the target vertex coordinates, and the embodiment of the present invention is not limited thereto.
In an alternative embodiment of the invention, the snow adjustment parameter may be a ratio of a volume of the snow model to a volume of another snow model having the same topology as the snow model. For example, a snow adjustment parameter of an embodiment of the present invention may be a percentage between the volume of the high snow model and the volume of the low snow model.
For example, as shown in fig. 3, fig. 3 is a schematic diagram of an accumulated snow model corresponding to an accumulated snow adjustment parameter, where the accumulated snow adjustment parameter 301 corresponds to a plurality of other accumulated snow models 303 having the same topology as the accumulated snow model 302, and when the accumulated snow adjustment parameter 304 is 100%, the corresponding accumulated snow model 302 is the accumulated snow model with the highest snow amount, the other accumulated snow models 303 have the same topology as the accumulated snow model 302 with the highest snow amount, and when the accumulated snow adjustment parameter 3011 is 20%, the corresponding accumulated snow model 3031 is corresponding to the accumulated snow model 3011, that is, when the snow volume of the current accumulated snow model is 20% of the volume of the accumulated snow model with the highest snow amount, the accumulated snow adjustment parameter 3011 has the corresponding accumulated snow model 3031.
In order to better understand the embodiments of the present invention, a full example will be described below.
1. The original snow model (high snow amount) is copied, the top point of the original snow model is adjusted under the condition of keeping the topological structure of the original snow model, and a new snow model (low snow amount) with less snow is manufactured by research personnel. Therefore, when a research and development worker manufactures a low-snow model, the model design of the model can be completely and accurately controlled, so that the artistic expression effect is optimal, and the situation that the snow model has a leak in a game scene is avoided.
2. The vertex coordinate offset vector for each vertex of the new model (low snow volume) relative to the old model (high snow volume) is recorded in the vertex color. Because the topological structures of the new model and the old model are completely consistent, the vertexes have one-to-one correspondence, the two models only have a slight deformation relationship, and the coordinate deviation value of each vertex is not large. Since the offset values may be represented by three-dimensional vectors and the vertex colors may provide storage space for four-dimensional vectors, which are all floating point numbers float, the xyz values of the vertex coordinate offset vectors may be directly saved in the vertices using the vertex color rgb attribute. In this way, the data of the new model is only extracted from the difference part of the two models and stored in the old model, so that the data content required to be stored is reduced to the maximum extent, the use of system resources is reduced, and the game performance is saved.
3. When the snow accumulation model is rendered, the vertex color stored in advance is extracted from the vertex shader to be used as a vertex coordinate offset vector for increasing or decreasing snow accumulation, the vertex coordinate offset vector is multiplied by a snow accumulation adjusting parameter (which is equal to the percentage from the high snow accumulation model to the low snow accumulation model), and the product is added with the vertex coordinate of the high snow accumulation model, so that the effect of increasing or decreasing snow accumulation can be dynamically obtained. Since the position of the vertex of the computational model in the game scene space is the calculation that the vertex shader must complete, the step only needs to perform a multiplication and then an addition operation before the vertex coordinates are converted from the local space to the game scene space. Due to the structural design of the graphics card GPU, the operation of multiplication and addition can be completed by using one GPU instruction, so that the step only needs to add one instruction in the shader, and the system performance overhead is saved as much as possible.
4. Finally, the change of the weather information in the game is related to the thickness of the snow accumulation model on the building, and the size of the snow accumulation adjusting parameter is dynamically modified when the weather changes, so that the change of the snow accumulation thickness of the snow accumulation model can be controlled by using the variable of the snow accumulation adjusting parameter in the vertex loader of the snow accumulation model.
The embodiment of the invention can acquire the weather information in the game scene when the game is off-line; weather information includes temperature and snowfall amount; determining an accumulated snow adjusting parameter aiming at the accumulated snow model according to the weather information; subtracting a first vertex coordinate of a vertex of the snow accumulation model from a second vertex coordinate of a vertex of another snow accumulation model with the same topological structure as the snow accumulation model, and obtaining a vertex coordinate offset vector between the first vertex coordinate and the second vertex coordinate; the topological structures are the same, namely the number of vertexes, edges and surfaces of the snow accumulation model is the same as that of other snow accumulation models, and the relations among the vertexes, the edges and the surfaces are the same; converting the vertex coordinate offset vector into a color attribute format, and storing the color attribute format in the vertex of the snow cover model; extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures of the snow cover model and the snow cover model; multiplying the accumulated snow adjusting parameter and the vertex coordinate offset vector to obtain a product value; adding the product value and the first vertex coordinate to obtain a target vertex coordinate; by adopting the mode, the embodiment of the invention can accurately screen the vertex coordinate offset vector corresponding to the weather information by adopting the snow adjusting parameter when the weather information changes in the game process, can render a new snow model by adopting the snow adjusting parameter and the vertex coordinate offset vector, and can calculate the vertex coordinate offset vector when the game is off-line, thereby realizing dynamic change of the snow model when the weather information changes on the premise of not loading a plurality of snow models into a game scene, and meanwhile, the embodiment of the invention can also utilize the characteristic that a GPU needs to read the color attribute to render the snow model, and finish the calculation aiming at the vertex coordinate offset vector when the game is off-line in advance, and the calculation of the vertex coordinate offset vector is stored in the vertex of the snow cover model in advance in a color attribute format, so that the data operation amount in the rendering process is reduced.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 4, a block diagram of a structure of a rendering apparatus for a snow cover model provided in an embodiment of the present invention is shown, and specifically, the block diagram may include the following modules:
a snow adjustment parameter determination module 401 for determining a snow adjustment parameter for the snow model;
a vertex coordinate offset vector extraction module 402, configured to extract a vertex coordinate offset vector from a vertex of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model;
a target vertex coordinate determining module 403, configured to determine a target vertex coordinate through the snow cover adjustment parameter and the vertex coordinate offset vector;
a snow model rendering module 404, configured to render the snow model according to the target vertex coordinates, so as to adjust a snow thickness of snow in the snow model.
Optionally, the graphical user interface further includes a game scene, and the snow cover adjustment parameter determining module 401 may include:
the weather information acquisition submodule is used for acquiring weather information in the game scene; the weather information may include temperature and snowfall amount;
and the snow cover adjustment parameter determining submodule is used for determining a snow cover adjustment parameter aiming at the snow cover model according to the weather information.
Optionally, the apparatus may further include:
the vertex coordinate offset vector calculation module is used for subtracting a first vertex coordinate of a vertex of the snow accumulation model from a second vertex coordinate of a vertex of another snow accumulation model with the same topological structure as the snow accumulation model to obtain a vertex coordinate offset vector between the first vertex coordinate and the second vertex coordinate;
and the vertex coordinate offset vector storage module is used for converting the vertex coordinate offset vector into a color attribute format, and storing the color attribute format in the vertex of the snow cover model.
Optionally, the topology is the same, that is, the number of vertexes, edges, and faces of the snow model and the other snow model are the same, and the vertexes, the edges, and the faces have the same relationship with each other.
Optionally, the target vertex coordinate determining module 403 may include:
and the target vertex coordinate calculation submodule is used for multiplying the accumulated snow adjusting parameters and the vertex coordinate offset vector to obtain a product value, and adding the product value and the first vertex coordinate to obtain a target vertex coordinate.
In summary, in the embodiment of the present invention, by determining the snow cover adjustment parameter for the snow cover model; extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model; determining target vertex coordinates through the accumulated snow adjusting parameters and the vertex coordinate offset vectors; rendering the snow model according to the target vertex coordinates to adjust the snow thickness of the snow in the snow model; therefore, the situation that a plurality of snow models are loaded in a game scene is avoided, the snow models can be changed in the game scene, meanwhile, the snow models can be designed by developers, and the snow models are prevented from being vulnerable in the game scene.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
In addition, an embodiment of the present invention further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501 is configured to implement the snow model rendering method as described in the above embodiments when executing the program stored in the memory 503.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The memory may include a Random Access Memory (RAM), or may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The processor may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the integrated circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
In yet another embodiment provided by the present invention, as shown in fig. 6, there is further provided a computer-readable storage medium 601, which stores instructions that, when executed on a computer, cause the computer to execute the method for rendering a snow model described in the above embodiments.
In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method of rendering a snow model as described in the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (ssd)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A snow model rendering method is characterized in that a graphical user interface is provided through a terminal device, the graphical user interface comprises a snow model, and the method comprises the following steps:
determining a snow adjustment parameter for the snow model;
extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model;
determining target vertex coordinates through the accumulated snow adjusting parameters and the vertex coordinate offset vectors;
and rendering the snow cover model according to the target vertex coordinates so as to adjust the snow cover thickness of the snow cover in the snow cover model.
2. The method of claim 1, wherein the graphical user interface further includes a game scenario, and wherein determining the snow adjustment parameter for the snow model comprises:
acquiring weather information in the game scene; the weather information comprises temperature and snowfall amount;
determining a snow adjustment parameter for the snow model from the weather information.
3. The method of claim 1, further comprising, prior to the step of extracting vertex coordinate offset vectors from vertices of the snow model:
subtracting a first vertex coordinate of a vertex of the snow accumulation model from a second vertex coordinate of a vertex of another snow accumulation model with the same topological structure as the snow accumulation model, and solving a vertex coordinate offset vector between the first vertex coordinate and the second vertex coordinate;
converting the vertex coordinate offset vector to a color attribute format in which to store in vertices of the snow model.
4. The method according to claim 1 or 3, wherein the topological structures are the same, and the vertex, the edge and the face of the snow model and the other snow model are the same in number and have the same relationship with each other.
5. The method of claim 1, wherein the step of determining target vertex coordinates from the snow cover adjustment parameter and the vertex coordinate offset vector comprises:
multiplying the accumulated snow adjusting parameter and the vertex coordinate offset vector to obtain a product value;
and adding the product value and the first vertex coordinate to obtain a target vertex coordinate.
6. An apparatus for rendering a snow model, wherein a graphical user interface is provided through a terminal device, the graphical user interface includes the snow model, the apparatus comprises:
a snow adjustment parameter determination module to determine a snow adjustment parameter for the snow model;
the vertex coordinate offset vector extraction module is used for extracting vertex coordinate offset vectors from the vertexes of the snow model; the vertex coordinate offset vector is calculated based on other snow cover models with the same topological structures as the snow cover model;
the target vertex coordinate determination module is used for determining target vertex coordinates through the accumulated snow adjustment parameters and the vertex coordinate offset vectors;
and the snow cover model rendering module is used for rendering the snow cover model according to the target vertex coordinates so as to adjust the snow cover thickness of the snow cover in the snow cover model.
7. The apparatus of claim 6, wherein the graphical user interface further comprises a game scene, and wherein the snow cover adjustment parameter determining module comprises:
the weather information acquisition submodule is used for acquiring weather information in the game scene; the weather information comprises temperature and snowfall amount;
and the snow cover adjustment parameter determining submodule is used for determining a snow cover adjustment parameter aiming at the snow cover model according to the weather information.
8. The apparatus of claim 6, further comprising:
the vertex coordinate offset vector calculation module is used for subtracting a first vertex coordinate of a vertex of the snow accumulation model from a second vertex coordinate of a vertex of another snow accumulation model with the same topological structure as the snow accumulation model to obtain a vertex coordinate offset vector between the first vertex coordinate and the second vertex coordinate;
and the vertex coordinate offset vector storage module is used for converting the vertex coordinate offset vector into a color attribute format, and storing the color attribute format in the vertex of the snow cover model.
9. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor, when executing a program stored on the memory, implementing the method of any of claims 1-5.
10. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method of any of claims 1-5.
CN202111416763.0A 2021-11-25 2021-11-25 Snow accumulation model rendering method and device, electronic equipment and readable medium Pending CN114119831A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111416763.0A CN114119831A (en) 2021-11-25 2021-11-25 Snow accumulation model rendering method and device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111416763.0A CN114119831A (en) 2021-11-25 2021-11-25 Snow accumulation model rendering method and device, electronic equipment and readable medium

Publications (1)

Publication Number Publication Date
CN114119831A true CN114119831A (en) 2022-03-01

Family

ID=80373322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111416763.0A Pending CN114119831A (en) 2021-11-25 2021-11-25 Snow accumulation model rendering method and device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN114119831A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115146577A (en) * 2022-09-06 2022-10-04 合肥本源量子计算科技有限责任公司 Method, system, medium, and electronic device for aligning points of integrated circuit layout pattern

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115146577A (en) * 2022-09-06 2022-10-04 合肥本源量子计算科技有限责任公司 Method, system, medium, and electronic device for aligning points of integrated circuit layout pattern
CN115146577B (en) * 2022-09-06 2022-12-06 合肥本源量子计算科技有限责任公司 Method, system, medium, and electronic device for aligning points of integrated circuit layout pattern

Similar Documents

Publication Publication Date Title
US20230053462A1 (en) Image rendering method and apparatus, device, medium, and computer program product
CN109771951B (en) Game map generation method, device, storage medium and electronic equipment
WO2021164150A1 (en) Web terminal real-time hybrid rendering method and apparatus in combination with ray tracing, and computer device
CN111815755A (en) Method and device for determining shielded area of virtual object and terminal equipment
CN114820905B (en) Virtual image generation method and device, electronic equipment and readable storage medium
CN107578467B (en) Three-dimensional modeling method and device for medical instrument
CN111210497B (en) Model rendering method and device, computer readable medium and electronic equipment
CN114677467B (en) Terrain image rendering method, device, equipment and computer readable storage medium
CN111583378B (en) Virtual asset processing method and device, electronic equipment and storage medium
US20240087219A1 (en) Method and apparatus for generating lighting image, device, and medium
CN113724331B (en) Video processing method, video processing apparatus, and non-transitory storage medium
CN109697748B (en) Model compression processing method, model mapping processing method, model compression processing device, and storage medium
CN114119831A (en) Snow accumulation model rendering method and device, electronic equipment and readable medium
CN112419430B (en) Animation playing method and device and computer equipment
CN110378948B (en) 3D model reconstruction method and device and electronic equipment
CN115965735B (en) Texture map generation method and device
CN114022616B (en) Model processing method and device, electronic equipment and storage medium
CN115861510A (en) Object rendering method, device, electronic equipment, storage medium and program product
TW202312100A (en) Grid generation method, electronic device and computer-readable storage medium
CN114782611A (en) Image processing method, image processing device, storage medium and electronic equipment
CN108846897B (en) Three-dimensional model surface material simulation method and device, storage medium and electronic equipment
CN110363860B (en) 3D model reconstruction method and device and electronic equipment
CN111882631B (en) Model rendering method, device, equipment and storage medium
CN112184873B (en) Fractal graph creation method, fractal graph creation device, electronic equipment and storage medium
CN114373055B (en) BIM-based three-dimensional image generation method and device, electronic equipment and medium

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