Collapse effect generation method, apparatus, device, and computer-readable storage medium
By obtaining the collapse effect control map and using pixel information to control the vertex offset of the model, the problems of low efficiency and large memory consumption in traditional model collapse schemes are solved, and the collapse effect is generated efficiently without increasing memory consumption.
Patent Information
- Application Number
- CN202310813748.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-04
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-07-04
AI Technical Summary
Traditional model collapse schemes rely on human experience, and the crushing process is cumbersome and inefficient, increasing the model's memory usage.
By obtaining the collapse effect control map, the degree of collapse of the model vertices is controlled by pixel information. After mapping processing, the target collapse offset information is determined, and the model vertex offset is directly controlled to generate the collapse effect.
It improves the efficiency of generating collapse effects and reduces the model's memory usage.
Smart Images

Figure CN116863048B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to a method, apparatus, device, and computer-readable storage medium for generating a collapse effect, wherein the device is a computer device. Background Technology
[0002] Traditional model collapse schemes require breaking the model within a fracturing engine to generate a fragmented model, which then contributes to the collapse effect. This process relies heavily on the operator's experience in model fracturing and is tedious, requiring adjustments to the number of fragments and the materials used in each fragment. Consequently, the generation of the collapse effect is inefficient. Furthermore, traditional methods add a fragmented model to the existing model, increasing memory usage. Summary of the Invention
[0003] This application provides a method, apparatus, device, and computer-readable storage medium for generating collapse effects, which can improve the efficiency of generating collapse effects and reduce memory usage.
[0004] The first aspect of this application provides a method for generating a collapse effect, comprising:
[0005] Obtain a collapse effect control map of the target object model, wherein the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model;
[0006] The collapse effect control map is mapped to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model.
[0007] The target collapse offset information of the model vertex is determined based on the current collapse progress and the pixel information of the matched pixels;
[0008] The model vertices of the target object model are offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0009] Secondly, embodiments of this application also provide a collapse effect generation device, comprising:
[0010] The acquisition unit is used to acquire a collapse effect control map of the target object model, wherein the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model;
[0011] The mapping unit is used to map the collapse effect control map to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model.
[0012] The determining unit is used to determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixel;
[0013] The offset unit is used to control the model vertices of the target object model to offset according to the target collapse offset information, so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0014] Thirdly, in a corresponding aspect, this application also provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any of the collapse effect generation methods provided in this application.
[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium for storing a computer program, which is loaded by a processor to execute any of the collapse effect generation methods provided in embodiments of this application.
[0016] This application embodiment obtains a collapse effect control map of the target object model, and uses the pixel information of the collapse effect control map to control the degree of collapse of points on the target object model; maps the collapse effect control map to the target object model to obtain matching pixels in the collapse effect control map that correspond to the model vertices of the target object model; determines the target collapse offset information of the model vertices based on the current collapse progress and the pixel information of the matching pixels; and controls the model vertices of the target object model to offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0017] This application embodiment controls the position of the model vertices of the target object model through a collapse effect control chart. By modifying the position of the model vertices through the collapse effect control chart, the target object model can present a collapse effect without creating a broken model of the target object model. This can improve the generation efficiency of the collapse effect and reduce the model's memory usage. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of the collapse effect generation method provided in the embodiments of this application;
[0020] Figure 2This is a schematic diagram of the collapse effect generation device provided in the embodiments of this application;
[0021] Figure 3 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] This application provides a method, apparatus, computer device, and computer-readable storage medium for generating collapse effects. The collapse effect generation apparatus can be integrated into a computer device, which can be a server, a terminal, or other similar device.
[0024] The terminal may include mobile phones, wearable smart devices, tablets, laptops, personal computers (PCs), and in-vehicle computers, etc.
[0025] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0026] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0027] This embodiment will be described from the perspective of a collapse effect generation device, which can be integrated into a computer device, such as a server or a terminal.
[0028] This application provides a method for generating collapse effects, such as... Figure 1 As shown, the specific process of generating this collapse effect can be as follows:
[0029] 101. Obtain the collapse effect control map of the target object model. The pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model.
[0030] The pixel information of the pixels in the collapse effect control map can be used to control the degree of collapse of the corresponding points on the target object model. The collapse effect control map can be a mask map, a texture map, or other images.
[0031] The target object model can be a model in a 3D scene, such as houses, mountains, tall buildings, and other models in a game scene, with the model vertices being points on the target object model.
[0032] 102. Map the collapse effect control map to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model.
[0033] For example, the coordinates of the target object model in the world coordinate system can be obtained, and the coordinates (XYZ) in the world coordinate system can be mapped to the coordinates in the two-dimensional coordinate system corresponding to the collapse effect control chart. Then, the matching pixels corresponding to the model vertices of the target object model in the collapse effect control chart can be determined based on the coordinates in the two-dimensional coordinate system.
[0034] Because the collapse effects of structures at the same horizontal position are usually synchronous during the collapse process—for example, for a pillar in a house, there are a series of coordinate points on the pillar that differ only in height—the parts at the same horizontal position usually sink or collapse as a whole. Therefore, the horizontal plane coordinates (XY) of the target object model in the world coordinate system can be mapped to the coordinates in the two-dimensional coordinate system corresponding to the collapse effect control map. Then, the matching pixels corresponding to the model vertices of the target object model in the collapse effect control map can be determined based on the coordinates in the two-dimensional coordinate system. That is, model points with the same XY coordinates have the same pixels in the collapse effect control map, so as to achieve the collapse effect control map being laid flat on the target object model. In one embodiment, the step "mapping the collapse effect control map with the target object model to obtain the matching pixels corresponding to the model vertices of the target object model in the collapse effect control map" can specifically include:
[0035] Determine the texture coordinates corresponding to the model vertices based on the coordinates of the model vertices on the horizontal plane in the target object model;
[0036] Based on texture coordinates, the matching pixels in the collapse effect control map are determined to correspond to the model vertices of the target object model.
[0037] For example, the collapse effect control map can be considered as a texture map or a mask map. The coordinates of the model vertices of the target object model on the horizontal plane, that is, the coordinates on the X and Y axes, are mapped to the coordinates of the model points on the horizontal plane as texture coordinates, so as to obtain the texture coordinates corresponding to the model vertices.
[0038] The matching pixels corresponding to the model vertices are determined in the collapse effect control map based on the texture coordinates corresponding to the model vertices.
[0039] 103. Determine the target collapse offset information of the model vertices based on the current collapse progress and the pixel information of the matching pixels.
[0040] The pixel information may include the pixel values of the matching pixels, such as the color values of different color channels of the matching pixels. If the matching pixel has only one color channel, the pixel information may be the value of that channel.
[0041] The collapse progress can represent the progress of the collapse process of the target object model. For example, the collapse progress can be represented by a value between 0 and 1, where 0 indicates that the target object model has not yet collapsed, and 1 indicates that the target object model has collapsed. Values greater than 0 and less than 1 can represent the collapse process between the start of collapse and the completion of collapse.
[0042] The target collapse offset information can include the collapse depth of the model vertex and the depth of the sinking into the model midpoint. The collapse depth can be considered as a depression, and the sinking into the midpoint can be considered as a concavity.
[0043] For example, in one embodiment, the pixel value of the matching pixel can represent the position of the corresponding model vertex after collapse, the pixel value of the matching pixel can be regarded as the degree of collapse, and the current collapse progress can be regarded as the weight for adjusting the current degree of collapse.
[0044] In another embodiment, the current collapse progress can indicate the current degree of collapse of the target object model. For example, the current collapse progress can indicate that the target object model needs to collapse to 80%, and the pixel value of the matching pixel can be regarded as the weight for adjusting the collapse progress.
[0045] The pixel value can be the channel value of at least one channel in the collapse effect control chart. For example, the collapse effect control chart can include at least one color channel, through which the degree of collapse can be adjusted, or the degree of collapse can be adjusted based on the color values of at least two color channels.
[0046] The collapse effect diagram can also be a grayscale image. The degree of collapse is adjusted according to the color values of the grayscale channels. That is, in one embodiment, the collapse effect control diagram is a grayscale image. The step "determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels" can specifically include:
[0047] The collapse weight is determined based on the grayscale value of the matching pixels in the collapse effect control image.
[0048] The current collapse progress is adjusted according to the collapse weight to obtain the target collapse progress of the model vertex;
[0049] The target collapse offset information of the model vertices is determined based on the target collapse progress.
[0050] For example, a mapping relationship between grayscale values and collapse weights can be pre-set. Based on the mapping relationship, the grayscale values of the matching pixels corresponding to the model vertices in the collapse effect control map and the corresponding collapse weights can be determined. Then, the current collapse progress can be adjusted according to the collapse weights to obtain the target collapse progress of the model vertices. Finally, the target collapse offset information of the model vertices can be determined based on the target collapse progress.
[0051] In one embodiment, the target collapse offset information is the collapse depth of the model vertex. The collapse depth can refer to the height of the model vertex after collapse at the corresponding collapse progress. Before the collapse begins, the model vertex has an initial height. During the collapse process, the model vertex gradually sinks to or below the ground. Therefore, the height of the model vertex at the current collapse progress can be determined based on the current collapse progress. Then, the height of the model vertex at the current collapse progress is adjusted according to the pixel value of the matching pixel to obtain the target offset information of the model vertex.
[0052] Assuming the initial height is h0, k can represent the collapse progress, and k∈[1,0], then the initial height h0 of the model vertex under the current collapse progress can be calculated as shown in the following formula. The collapse progress and the model vertex can have other relationships, which are not limited here.
[0053] h1=(1-k)h0
[0054] The target offset information can be the target height of the model vertex under the collapse progress. The target height h2 can be calculated as shown in the following formula, where p can be the pixel value of the matching pixel or a weight parameter determined based on the pixel value of the matching pixel.
[0055] h2 = h0 - kph0; or h2 = (1 - k)ph0.
[0056] Optionally, the height of the target object model can be determined and used as the initial height. Then, the target height can be calculated using the above method. Based on the height difference between the initial height and the target height, the sinking depth of the target object model can be calculated and used as the collapse depth to control the sinking of the target object model and present a collapse effect.
[0057] In another embodiment, the target collapse offset information is the concavity depth of the model vertex. The concavity depth can refer to the distance that the model vertex moves towards the midpoint of the target object model at the corresponding collapse progress. For example, a force pointing towards the center of the model can be applied to the model vertex, and the distance that the model vertex moves towards the midpoint of the model at the current collapse progress can be determined under the action of the force.
[0058] Optionally, before controlling the model vertices to concave towards the model center, the model vertices can be sampled, and the sampled model vertices can be controlled to concave inward to present the effect that some structures in the target object model are broken while others are not. If the target object model is a house, it can present the effect that some pillars in the house are broken towards the model center while others are not broken.
[0059] Optionally, in addition to controlling the model's endpoint to be recessed towards the model's vertex, you can also control the model's vertex to shift outward, creating an outward break effect.
[0060] In one embodiment, the collapse of model vertices in different directions can be controlled simultaneously, such as collapsing downwards, concave into the model, or bulging outwards. The pixel value of the matching pixel can include the color values of at least two color channels (such as RGB color channels). Each color channel can control the collapse effect in one direction. The degree of collapse in the corresponding direction can be adjusted according to the channel value of different color channels. That is, the collapse offset information can include the target offset distance in different directions. The offset distance of the model vertex in each direction can be determined according to the current collapse progress. Then, the offset distance is adjusted according to the color value of the color channel corresponding to the matching pixel to obtain the target offset distance in each direction.
[0061] In one embodiment, the collapse offset information may include the downward collapse distance, which is the distance of collapse towards the center point of the model, i.e., the target collapse depth and the target depression depth offset towards the center point of the target object model. The step "determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels" may specifically include:
[0062] Determine the collapse depth and depression depth of the model vertices of the target object model based on the current collapse progress;
[0063] Candidate depression depths are obtained by weighting the depression depths based on the pixel values of the matched pixels.
[0064] The candidate depression depth is adjusted based on the height information of the model vertices to obtain the target depression depth;
[0065] The target collapse depth of the model vertex is obtained by weighting the collapse depth based on the pixel values of the matched pixels.
[0066] Since the target object model will gradually sink to the ground during the collapse, the collapse depth of the model's vertices can be determined based on the height of the target object model. The distance from the model's vertices to the model's midpoint can be determined based on the width of the target object model and the position of the model's midpoint after the collapse.
[0067] Therefore, based on the current collapse progress, the current collapse depth and depression depth of each model vertex in the target object model can be determined. Combined with the pixel values of the matching pixels, the current collapse depth and depression depth of the target object model can be dynamically controlled.
[0068] For example, a collapse effect control map can have at least two color channels. Different color channels are used to control the collapse effect in different directions. The color value of one color channel is used to control the collapse depth, and the other color channel is used to control the depression depth.
[0069] Optionally, the collapse effect control map is a grayscale image with only one color channel. The color value of this channel can control both the collapse depth and the depression depth. Optionally, there can be two collapse effect control maps, one for controlling the collapse depth and the other for controlling the depression depth.
[0070] Generally, the higher the position, the easier it is to collapse. Therefore, the height of the model vertex can be used to control the degree of inward indentation of the model vertex. For example, the height of the model vertex can be mapped to the interval [0,1], and the indentation depth can be adjusted according to the mapped value. Since the bottom height of the target object model is 0, the foundation of the target object model can remain unchanged, and the higher the height of other parts, the more obvious the indentation effect.
[0071] In some scenarios, if the collapse of the target object model is caused by an impact or other external force on a certain part, then the stressed part should have a more severe collapse effect. Since the collapse effect control chart can control the degree of collapse of the target object model, the collapse effect control chart can be adjusted to make the collapse at the stressed location more severe. That is, in one embodiment, before the step "determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels", the collapse effect generation method provided in this application embodiment may further include:
[0072] Identify the target collapse area that caused the target object model to collapse;
[0073] The pixel values of the image region corresponding to the target collapse area in the collapse effect control map are enhanced to improve the collapse effect of the target collapse area.
[0074] The target collapse area can be the part of the target object model that causes the collapse. In the collapse effect control chart, the image area corresponding to the target collapse area is determined. The pixel values of the pixels in the image area are enhanced so that the degree of collapse of the target collapse area can be enhanced based on the processed pixel values, and the collapse effect of the target collapse area is more obvious.
[0075] 104. Based on the target collapse offset information, control the model vertices of the target object model to offset, so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0076] For example, the model vertices can be offset based on the target collapse offset information, so that the target object model appears to have collapsed vertices. For example, by controlling the model vertices to move downwards, when some of the model vertices of the target object model move downwards, the model can appear to collapse.
[0077] The target object model may also exhibit a shaking effect during or between collapses. Therefore, in one embodiment, the collapse effect generation method provided in this application may further include:
[0078] Determine the model rotation angle at the current moment;
[0079] Based on the height information of the model vertices and the model rotation angle, determine the target rotation angle of the target object model at different heights at the current moment;
[0080] Based on the target rotation angle at different heights, the target object model is controlled to rotate around the vertical axis to make the target object model appear to sway.
[0081] The model rotation angle can be considered a parameter that controls the shaking effect of the target object model. The model rotation angle can be time-dependent. For example, sin(t) can be used to control the rotation angle of the target object model at different times, or multiple Asin(at+c) and Bcos(bt+d) can be superimposed to control the rotation angle of the target object model at different times. Specifically, it can be that the model rotation angle at the current time is determined, and then the model vertices of the target object model are controlled to rotate around the vertical axis (i.e., the Z-axis) based on the rotation angle.
[0082] Optionally, the rotation angle can be adjusted according to the height of the model vertex to obtain the target rotation angle of the model parts at different heights of the target object model.
[0083] Then, the target object model is rotated by controlling the target rotation angle corresponding to different heights, so as to present the effect that the foundation of the target object model is stationary, and the higher the part is, the more violently it shakes.
[0084] Optionally, the target object model can also be controlled to offset in the horizontal direction. That is, in one embodiment, the collapse effect generation method provided in this application embodiment may further include;
[0085] Determine the model offset distance at the current moment;
[0086] The current offset distance is adjusted based on the height information of the model vertices of the target object model to obtain the target offset distance of the model vertices;
[0087] The offset distance controls the offset of the model vertices of the target object model on the horizontal plane, so that the target object model appears to sway.
[0088] Among them, the model offset distance can be regarded as a parameter that controls the shaking effect of the target object model. The model offset distance can be related to time. For example, the offset distance of the target object model at different times can be controlled by sin(t), and the offset distance of the target object model at different times can also be controlled by superimposing multiple Asin(at+c) and Bcos(bt+d).
[0089] For example, it could be to determine the model offset distance at the current moment, and then control the model vertices of the target object model to offset left or right, or forward or backward, based on the model offset distance.
[0090] Optionally, the model offset distance can be adjusted according to the model vertex height to obtain the target model offset distance at different heights of the target object model.
[0091] Then, the target object model is offset by the target model offset distance corresponding to different heights, so as to present the effect that the foundation of the target object model is stationary, and the higher the part is, the more violently it shakes.
[0092] As can be seen from the above, the embodiments of this application obtain a collapse effect control map of the target object model, and the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model; the collapse effect control map and the target object model are mapped to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model; the target collapse offset information of the model vertices is determined based on the current collapse progress and the pixel information of the matching pixels; the model vertices of the target object model are offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0093] This application embodiment controls the position of the model vertices of the target object model through a collapse effect control chart. By modifying the position of the model vertices through the collapse effect control chart, the target object model can present a collapse effect without creating a broken model of the target object model. This can improve the generation efficiency of the collapse effect and reduce the model's memory usage.
[0094] To facilitate better implementation of the collapse effect generation method provided in this application embodiment, a collapse effect generation device is also provided in one embodiment. The meanings of the terms used are the same as in the collapse effect generation method described above, and specific implementation details can be found in the description of the method embodiment.
[0095] The collapse effect generation device can be integrated into a computer device, such as... Figure 2 As shown, the collapse effect generation device may include: an acquisition unit 301, a mapping unit 302, a determination unit 303, and an offset unit 304, as detailed below:
[0096] (1) Acquisition unit 301: used to acquire the collapse effect control map of the target object model. The pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model.
[0097] (2) Mapping unit 302: used to map the collapse effect control map to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model.
[0098] In one embodiment, the mapping unit 302 includes:
[0099] Coordinate Determination Subunit: Used to determine the texture coordinates corresponding to the model vertices based on the coordinates of the model vertices on the horizontal plane in the target object model;
[0100] Pixel Determination Subunit: Used to determine the matching pixels corresponding to the model vertices of the target object model in the collapse effect control map based on texture coordinates.
[0101] (3) Determine unit 303: used to determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels.
[0102] In one embodiment, the collapse offset information includes the target collapse depth and the target depression depth offset towards the center point of the target object model. The determining unit 303 includes:
[0103] Depth Determination Sub-unit: Used to determine the collapse depth and depression depth of the model vertices of the target object model based on the current collapse progress;
[0104] First weighted subunit: used to weight the indentation depth based on the pixel value of the matching pixel to obtain the candidate indentation depth;
[0105] Depth Adjustment Subunit: Used to adjust the depth of candidate depressions based on the height information of model vertices to obtain the target depression depth;
[0106] The second weighted sub-unit is used to weight the collapse depth based on the pixel values of the matched pixels to obtain the target collapse depth of the model vertices.
[0107] In one embodiment, the collapse effect control chart is a grayscale image, and the determining unit 303 may include:
[0108] Weight determination sub-unit: used to determine the collapse weight by controlling the grayscale value of matching pixels in the image based on the collapse effect;
[0109] Progress adjustment subunit: used to adjust the current collapse progress according to the collapse weight to obtain the target collapse progress of the model vertex;
[0110] The target collapse offset information of the model vertices is determined based on the target collapse progress.
[0111] In one embodiment, the collapse effect generating device may further include:
[0112] Region Determination Unit: Used to determine the target collapse region that causes the target object model to collapse;
[0113] Effect Enhancement Unit: Used to enhance the pixel values of the image region corresponding to the target collapse area in the collapse effect control chart, so as to enhance the collapse effect of the target collapse area.
[0114] (4) Offset unit 304: Used to control the model vertices of the target object model to offset according to the target collapse offset information, so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0115] In one embodiment, the collapse effect generating device may further include:
[0116] Angle determination unit: used to determine the model rotation angle at the current moment;
[0117] Angle adjustment unit: used to determine the target rotation angle of the target object model at different heights at the current moment based on the height information of the model vertices and the model rotation angle;
[0118] Shaking and rotating unit: Used to control the rotation of the target object model around the vertical axis based on the target rotation angle at different heights, so that the target object model presents a shaking effect.
[0119] In one embodiment, the collapse effect generating device may further include:
[0120] Distance determination unit: used to determine the model offset distance at the current moment;
[0121] Distance adjustment unit: used to adjust the current offset distance based on the height information of the model vertices of the target object model, so as to obtain the target offset distance of the model vertices;
[0122] Shaking offset unit: Used to control the offset distance of the model vertices of the target object model on the horizontal plane, so that the target object model presents a shaking effect.
[0123] As can be seen from the above, the collapse effect generation device in this embodiment of the application acquires the collapse effect control map of the target object model through the acquisition unit 301. The pixel information of the collapse effect control map is used to control the degree of collapse of the points on the target object model. The mapping unit 302 performs mapping processing on the collapse effect control map and the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model. The determining unit 303 determines the target collapse offset information of the model vertices based on the current collapse progress and the pixel information of the matching pixels. The offset unit 304 controls the model vertices of the target object model to offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0124] This application embodiment controls the position of the model vertices of the target object model through a collapse effect control chart. By modifying the position of the model vertices through the collapse effect control chart, the target object model can present a collapse effect without creating a broken model of the target object model. This can improve the generation efficiency of the collapse effect and reduce the model's memory usage.
[0125] Accordingly, embodiments of this application also provide a computer device, which can be a terminal. For example... Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 and the memory 502 are electrically connected. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0126] The processor 501 is the control center of the computer device 500. It connects various parts of the computer device 500 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, it performs various functions of the computer device 500 and processes data, thereby monitoring the computer device 500 as a whole.
[0127] In this embodiment, the processor 501 in the computer device 500 loads the instructions corresponding to the processes of one or more applications into the memory 502 according to the following steps, and the processor 501 runs the applications stored in the memory 502 to achieve various functions:
[0128] Obtain a collapse effect control map of the target object model, wherein the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model;
[0129] The collapse effect control map is mapped to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model.
[0130] The target collapse offset information of the model vertex is determined based on the current collapse progress and the pixel information of the matched pixels;
[0131] The model vertices of the target object model are offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0132] In one embodiment, the above-mentioned method for generating the collapse effect further includes:
[0133] Determine the model rotation angle at the current moment;
[0134] Based on the height information of the model vertices and the model rotation angle, determine the target rotation angle of the target object model at different heights at the current moment;
[0135] Based on the target rotation angle at different heights, the target object model is controlled to rotate around the vertical axis to make the target object model appear to sway.
[0136] In one embodiment, the above-mentioned method for generating the collapse effect further includes:
[0137] Determine the model offset distance at the current moment;
[0138] The current offset distance is adjusted based on the height information of the model vertices of the target object model to obtain the target offset distance of the model vertices;
[0139] The offset distance controls the offset of the model vertices of the target object model on the horizontal plane, so that the target object model appears to sway.
[0140] In one embodiment, the collapse offset information includes the target collapse depth and the target depression depth offset towards the center point of the target object model. The step "determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels" includes:
[0141] Determine the collapse depth and depression depth of the model vertices of the target object model based on the current collapse progress;
[0142] Candidate depression depths are obtained by weighting the depression depths based on the pixel values of the matched pixels.
[0143] The candidate depression depth is adjusted based on the height information of the model vertices to obtain the target depression depth;
[0144] The target collapse depth of the model vertex is obtained by weighting the collapse depth based on the pixel values of the matched pixels.
[0145] In one embodiment, the step "mapping the collapse effect control map with the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model" includes:
[0146] Determine the texture coordinates corresponding to the model vertices based on the coordinates of the model vertices on the horizontal plane in the target object model;
[0147] Based on texture coordinates, the matching pixels in the collapse effect control map are determined to correspond to the model vertices of the target object model.
[0148] In one embodiment, the collapse effect control map is a grayscale image, and the step "determine the target collapse offset information of the model vertices based on the current collapse progress and the pixel information of the matching pixels" includes:
[0149] The collapse weight is determined based on the grayscale value of the matching pixels in the collapse effect control image.
[0150] The current collapse progress is adjusted according to the collapse weight to obtain the target collapse progress of the model vertex;
[0151] The target collapse offset information of the model vertices is determined based on the target collapse progress.
[0152] In one embodiment, before the step of "determining the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels", the above-mentioned collapse effect generation method further includes:
[0153] Identify the target collapse area that caused the target object model to collapse;
[0154] The pixel values of the image region corresponding to the target collapse area in the collapse effect control map are enhanced to improve the collapse effect of the target collapse area.
[0155] As can be seen from the above, the embodiments of this application obtain a collapse effect control map of the target object model, and the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model; the collapse effect control map and the target object model are mapped to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model; the target collapse offset information of the model vertices is determined based on the current collapse progress and the pixel information of the matching pixels; the model vertices of the target object model are offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0156] This application embodiment controls the position of the model vertices of the target object model through a collapse effect control chart. By modifying the position of the model vertices through the collapse effect control chart, the target object model can present a collapse effect without creating a broken model of the target object model. This can improve the generation efficiency of the collapse effect and reduce the model's memory usage.
[0157] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0158] Optional, such as Figure 3 As shown, the computer device 500 also includes: a touch screen display 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen display 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507. Those skilled in the art will understand that... Figure 3 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0159] The touch display screen 503 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 503 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 501. It can also receive and execute commands from the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 503 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 503 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 503 can also be used as part of the input unit 506 to achieve input functions.
[0160] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other computer devices, and to transmit and receive signals with network devices or other computer devices.
[0161] Audio circuitry 505 can be used to provide an audio interface between a user and a computer device via a speaker and a microphone. Audio circuitry 505 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 505, converted back into audio data, and output to processor 501 for processing. The audio data is then transmitted via radio frequency circuitry 504 to, for example, another computer device, or output to memory 502 for further processing. Audio circuitry 505 may also include an earphone jack to facilitate communication between peripheral headphones and the computer device.
[0162] The input unit 506 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0163] Power supply 507 is used to supply power to various components of computer device 500. Optionally, power supply 507 can be logically connected to processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 507 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0164] although Figure 3 As not shown in the diagram, the computer device 500 may also include a camera, sensors, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0165] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0166] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0167] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute the steps in any of the virtual item marking methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0168] Obtain a collapse effect control map of the target object model, wherein the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model;
[0169] The collapse effect control map is mapped to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model.
[0170] The target collapse offset information of the model vertex is determined based on the current collapse progress and the pixel information of the matched pixels;
[0171] The model vertices of the target object model are offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0172] In one embodiment, the above-mentioned method for generating the collapse effect further includes:
[0173] Determine the model rotation angle at the current moment;
[0174] Based on the height information of the model vertices and the model rotation angle, determine the target rotation angle of the target object model at different heights at the current moment;
[0175] Based on the target rotation angle at different heights, the target object model is controlled to rotate around the vertical axis to make the target object model appear to sway.
[0176] In one embodiment, the above-mentioned method for generating the collapse effect further includes:
[0177] Determine the model offset distance at the current moment;
[0178] The current offset distance is adjusted based on the height information of the model vertices of the target object model to obtain the target offset distance of the model vertices;
[0179] The offset distance controls the offset of the model vertices of the target object model on the horizontal plane, so that the target object model appears to sway.
[0180] In one embodiment, the collapse offset information includes the target collapse depth and the target depression depth offset towards the center point of the target object model. The step "determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels" includes:
[0181] Determine the collapse depth and depression depth of the model vertices of the target object model based on the current collapse progress;
[0182] Candidate depression depths are obtained by weighting the depression depths based on the pixel values of the matched pixels.
[0183] The candidate depression depth is adjusted based on the height information of the model vertices to obtain the target depression depth;
[0184] The target collapse depth of the model vertex is obtained by weighting the collapse depth based on the pixel values of the matched pixels.
[0185] In one embodiment, the step "mapping the collapse effect control map with the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model" includes:
[0186] Determine the texture coordinates corresponding to the model vertices based on the coordinates of the model vertices on the horizontal plane in the target object model;
[0187] Based on texture coordinates, the matching pixels in the collapse effect control map are determined to correspond to the model vertices of the target object model.
[0188] In one embodiment, the collapse effect control map is a grayscale image, and the step "determine the target collapse offset information of the model vertices based on the current collapse progress and the pixel information of the matching pixels" includes:
[0189] The collapse weight is determined based on the grayscale value of the matching pixels in the collapse effect control image.
[0190] The current collapse progress is adjusted according to the collapse weight to obtain the target collapse progress of the model vertex;
[0191] The target collapse offset information of the model vertices is determined based on the target collapse progress.
[0192] In one embodiment, before the step of "determining the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels", the above-mentioned collapse effect generation method further includes:
[0193] Identify the target collapse area that caused the target object model to collapse;
[0194] The pixel values of the image region corresponding to the target collapse area in the collapse effect control map are enhanced to improve the collapse effect of the target collapse area.
[0195] As can be seen from the above, the embodiments of this application obtain a collapse effect control map of the target object model, and the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model; the collapse effect control map and the target object model are mapped to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model; the target collapse offset information of the model vertices is determined based on the current collapse progress and the pixel information of the matching pixels; the model vertices of the target object model are offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
[0196] This application embodiment controls the position of the model vertices of the target object model through a collapse effect control chart. By modifying the position of the model vertices through the collapse effect control chart, the target object model can present a collapse effect without creating a broken model of the target object model. This can improve the generation efficiency of the collapse effect and reduce the model's memory usage.
[0197] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0198] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0199] The above provides a detailed description of a method, apparatus, computer device, and computer storage medium for generating a collapse effect according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating a collapse effect, characterized in that, include: Obtain a collapse effect control map of the target object model, wherein the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model; The collapse effect control map is mapped to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model. The target collapse offset information of the model vertex is determined based on the current collapse progress and the pixel information of the matched pixels; The model vertices of the target object model are offset according to the target collapse offset information so that the target object model presents the collapse effect corresponding to the current collapse progress.
2. The method according to claim 1, characterized in that, The method further includes: Determine the model rotation angle at the current moment; Based on the height information of the model vertices and the rotation angle of the model, determine the target rotation angle of the target object model at different heights at the current moment; Based on the target rotation angle at different heights, the target object model is controlled to rotate around a vertical axis to make the target object model appear to sway.
3. The method according to claim 1, characterized in that, The method further includes: Determine the model offset distance at the current moment; The current offset distance is adjusted based on the height information of the model vertices of the target object model to obtain the target offset distance of the model vertices; Based on the target offset distance, the model vertices of the target object model are offset on the horizontal plane to make the target object model appear to sway.
4. The method according to claim 1, characterized in that, The target collapse offset information includes the target collapse depth and the target indentation depth offset towards the center point of the target object model. Determining the target collapse offset information of the model vertices based on the current collapse progress and the pixel information of the matching pixels includes: The collapse depth and depression depth of the model vertices of the target object model are determined based on the current collapse progress. The indentation depth is weighted according to the pixel value of the matching pixel to obtain the candidate indentation depth; The candidate depression depth is adjusted based on the height information of the model vertices to obtain the target depression depth; The collapse depth is weighted based on the pixel values of the matched pixels to obtain the target collapse depth of the model vertex.
5. The method according to claim 1, characterized in that, The step of mapping the collapse effect control map to the target object model to obtain the matching pixels in the collapse effect control map corresponding to the model vertices of the target object model includes: Based on the coordinates of the model vertices in the target object model on the horizontal plane, determine the texture coordinates corresponding to the model vertices; Based on the texture coordinates, determine the matching pixels corresponding to the model vertices of the target object model in the collapse effect control map.
6. The method according to claim 1, characterized in that, The collapse effect control map is a grayscale image. The determination of the target collapse offset information of the model vertices based on the current collapse progress and the pixel information of the matched pixels includes: The collapse weight is determined based on the grayscale value of the matching pixels in the collapse effect control diagram. The current collapse progress is adjusted according to the collapse weight to obtain the target collapse progress of the model vertex; The target collapse offset information of the model vertex is determined based on the target collapse progress.
7. The method according to any one of claims 1-6, characterized in that, Before determining the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixels, the method further includes: Identify the target collapse area that caused the target object model to collapse; The pixel values of the image region corresponding to the target collapse area in the collapse effect control diagram are enhanced to improve the collapse effect of the target collapse area.
8. A device for generating a collapse effect, characterized in that, include: The acquisition unit is used to acquire a collapse effect control map of the target object model, wherein the pixel information of the collapse effect control map is used to control the degree of collapse of points on the target object model; The mapping unit is used to map the collapse effect control map to the target object model to obtain the matching pixels in the collapse effect control map that correspond to the model vertices of the target object model. The determining unit is used to determine the target collapse offset information of the model vertex based on the current collapse progress and the pixel information of the matching pixel; The offset unit is used to control the model vertices of the target object model to offset according to the target collapse offset information, so that the target object model presents the collapse effect corresponding to the current collapse progress.
9. A computer device, characterized in that, It includes a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to perform the collapse effect generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, which is loaded by a processor to execute the collapse effect generation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Building falling simulation method on basis of two-dimensional image
CN102708584A
Building seismic damage information extraction method and device
CN107527035A
