Desk effect rendering method and device, electronic equipment and computer readable storage medium

By determining the height map and color map based on the impact position in computer graphics technology and rendering the impact position, the problems of high resource consumption and high computing cost in the prior art are solved, and real-time rendering effect on mobile devices is achieved.

CN119722895APending Publication Date: 2025-03-28BEIJING PIXEL SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411928158.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the existing computer graphics technology, when simulating the deformation effect of an object surface after being affected by external forces, it consumes high resources and has high calculation costs, making it difficult to realize real-time rendering on mobile devices.

Method used

By determining the matching height map and color map based on the impact position, using these maps to render the impact position, complex shader calculations are avoided.

Benefits of technology

Under the premise that resource consumption is controllable, the realistic dent effect is achieved, which reduces the computing cost and is suitable for the real-time rendering needs of mobile devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119722895A_ABST
    Figure CN119722895A_ABST
Patent Text Reader

Abstract

The invention relates to a computer graphic technology, and provides a dent effect rendering method and device, electronic equipment and a computer readable storage medium, and the method comprises the steps: determining an impact position according to an impact operation for a target object; a height map and a color map matched with the impact position are determined, the height map represents the sinking degree information, and the color map represents the color information of the target object in the sinking state; and according to the height map and the color map, performing dent effect rendering on the impact position. According to the invention, the lifelike dent effect can be realized with low calculation cost by matching the height and color map of the impact position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer graphics technology, and in particular to a dent effect rendering method, device, electronic device and computer-readable storage medium. Background Art

[0002] In the field of computer graphics, simulating the deformation effect of an object surface after being acted upon by external forces is an important means to enhance visual realism. Existing technologies mostly use complex shader calculations or rely on hardware characteristics. Although these methods can achieve relatively good results, they consume a lot of resources and have high calculation costs, and are not suitable for real-time rendering requirements of mobile devices. Summary of the invention

[0003] The present invention aims to provide a dent effect rendering method, device, electronic device and computer-readable storage medium, which can achieve realistic dent effects at a low computing cost under the premise of controllable resource consumption.

[0004] The embodiments of the present invention can be implemented as follows:

[0005] In a first aspect, the present invention provides a method for rendering a dent effect, the method comprising:

[0006] determining an impact position according to an impact operation performed on a target object;

[0007] Determine a height map and a color map that match the impact position, wherein the height map represents information about the degree of depression, and the color map represents color information of the target object in a depressed state;

[0008] The dent effect is rendered at the impact position according to the height map and the color map.

[0009] In an optional embodiment, a plurality of preset map groups are pre-stored, and different preset map groups correspond to different preset distance ranges. Each preset map group includes a height map and a color map within the corresponding preset distance range and within the field of view of the virtual camera. The step of determining the height map and the color map matching the impact position includes:

[0010] Calculating an interaction distance between the impact position and the virtual camera;

[0011] Determine, from the plurality of preset map groups, a target preset map group whose interaction distance is within a corresponding preset distance range;

[0012] The height map and the color map in the target preset map group are respectively used as the height map and the color map matching the impact position.

[0013] In an optional embodiment, the step of rendering the dent effect on the impact position according to the height map and the color map includes:

[0014] Constructing a target cube with the impact position as the center point and a preset length as the side length;

[0015] Determine the model space position of each pixel point in the screen area covered by the target cube in the model space of the target cube according to the preset depth map;

[0016] Determining a sampling position of each pixel point according to the height map and the model space position of each pixel point;

[0017] According to the sampling position of each pixel, sampling the color information of each pixel from the color map;

[0018] The color of each pixel at the model space position is rendered according to the color information of each pixel, and finally a dent effect at the impact position is obtained.

[0019] In an optional implementation, the step of determining the model space position of each pixel point in the screen area covered by the target cube in the model space of the target cube according to the preset depth map comprises:

[0020] Normalizing the pixel coordinates of each pixel to obtain the normalized coordinates of each pixel;

[0021] Acquire the depth value of each pixel from the preset depth map according to the normalized coordinates of each pixel;

[0022] Constructing a standard space position of each pixel point in a preset standard space according to the normalized coordinates of each pixel point and its depth value;

[0023] The model space position of each pixel is calculated according to the standard space position of each pixel and a preset conversion matrix, wherein the preset conversion matrix represents a mapping relationship between the preset standard space and the model space determined by the target cube.

[0024] In an optional implementation, the step of normalizing each pixel point to obtain the normalized coordinates of each pixel point includes:

[0025] Obtaining the screen pixel size and the pixel position of each pixel point in the screen area covered by the target cube;

[0026] The normalized coordinates of each pixel are calculated according to the pixel position of each pixel and the screen pixel size.

[0027] In an optional implementation, the step of determining the sampling position of each pixel point according to the height map and the model space position of each pixel point includes:

[0028] Determining the original sampling position of each pixel point according to the model space position of each pixel point;

[0029] Determining the offset of each pixel point according to the model space position of each pixel point and the height map;

[0030] The sampling position of each pixel is determined according to the original sampling position and the offset of each pixel.

[0031] In an optional embodiment, the model space position includes an X-axis coordinate and a Z-axis coordinate in a model space coordinate system, the model space coordinate system takes the center point of the target cube as the origin and the direction of the collision operation as the Y-axis, and the step of determining the original sampling position of each pixel point according to the model space position of each pixel point includes:

[0032] For any pixel point, the offset unit is determined according to the side length of the target cube;

[0033] The X-axis coordinate and the Z-axis coordinate of the pixel point are offset by the offset unit respectively to obtain the offset X-axis coordinate and the offset Z-axis coordinate of the pixel point;

[0034] The original sampling position of the pixel point is determined according to the offset X-axis coordinate and the offset Z-axis coordinate of the pixel point.

[0035] In a second aspect, the present invention provides a device for rendering a dent effect, the device comprising:

[0036] A determination module, used to determine an impact position according to an impact operation performed on a target object;

[0037] The determination module is further used to determine a height map and a color map that match the impact position, wherein the height map represents information about the degree of depression, and the color map represents color information of the target object in a depressed state;

[0038] A rendering module is used to render a dent effect on the impact position according to the height map and the color map.

[0039] In a third aspect, the present invention provides an electronic device, including a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement a method for rendering a dent effect as described in any one of the aforementioned embodiments when executing the program.

[0040] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for rendering a dent effect as described in any one of the aforementioned embodiments.

[0041] Compared with the prior art, the present invention has the following beneficial effects:

[0042] The present invention determines a height map and a color map that match the impact position according to the impact position, and renders the dent effect at the impact position according to the height map and the color map, thereby avoiding high resource consumption and high cost caused by complex shader calculations, and achieving a realistic dent effect at a lower computing cost while controlling resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 An example of the process of the dent effect rendering method provided in this embodiment Figure 1 .

[0045] Figure 2 An example of the process of the dent effect rendering method provided in this embodiment Figure 2 .

[0046] Figure 3 This is a block diagram of an example of a device for rendering a dent effect provided in this embodiment.

[0047] Figure 4 An example block diagram of an electronic device provided in this embodiment.

[0048] Icons: 10 - electronic device; 11 - processor; 12 - memory; 13 - bus; 100 - dent effect rendering device; 110 - determination module; 120 - rendering module. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0050] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0052] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0053] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.

[0054] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0055] In shader-based rendering, during the vertex rendering stage, the displacement map is sampled to obtain the vertex offset and applied to the original vertex position to achieve a realistic bump effect or to use another color map to blend with the original map.

[0056] This method of using displacement maps has relatively high requirements on the number of model faces, and mobile devices such as mobile phones have inconsistent support for texture sampling at the vertex stage. The solution of using color maps to mix with original maps has relatively poor performance.

[0057] In view of this, the present embodiment provides a dent effect rendering method, device, electronic device and computer-readable storage medium, which can not only obtain a better rendering effect, but also reduce resource consumption and computing cost, which will be described in detail below.

[0058] Please refer to Figure 1 , Figure 1 An example of the process of the dent effect rendering method provided in this embodiment Figure 1 , the method comprises the following steps:

[0059] Step S101 : determining an impact position according to an impact operation performed on a target object.

[0060] In this embodiment, the target object may be a character, object, or NPC (Non-Player Character) in the game scene. The collision operation may be a skill released by a game player in the game, or a collision operation performed by a user on a target object in a virtual reality scene. The collision position may be determined according to the direction of the collision operation, or according to the direction and intensity of the collision operation. For example, in a game scene, the collision position may be determined according to the direction of the skill released, or according to the direction and intensity level of the skill released.

[0061] Step S102, determining a height map and a color map that match the impact position, wherein the height map represents information about the degree of depression, and the color map represents color information of the target object in a depressed state.

[0062] In this embodiment, due to the different degrees of depression, different height visions are visually presented, and different degrees of depression can be represented by the pixel value of each pixel of the height map, and the pixel value of each pixel of the height map ranges from 0 to 1, 1 represents no depression, and 0 represents the maximum degree of depression. The color map represents the color and texture detail information of the concave surface of the target object, and the color value of each pixel in the color map directly corresponds to the color of the corresponding position on the surface of the 3D model.

[0063] Step S103, rendering a dent effect at the impact position according to the height map and the color map.

[0064] In this embodiment, since the height map can represent information about the degree of the dent, and the color map can represent information such as the texture and color of the dent, rendering based on the height map and the color map can obtain a more realistic dent effect at the impact position.

[0065] The above method provided in this embodiment renders the dent effect at the impact position according to the height map and the color map, thereby avoiding high resource consumption and high cost caused by complex shader calculations, and achieving realistic dent effects at a lower computing cost while controllable resource consumption.

[0066] In an optional implementation, the distance between the impact operation and the target object is different, which will affect the visual effect of the dent on the target object. For example, the closer the distance between the two is, the clearer the color and texture of the dent will be, and vice versa. In order to render a dent effect that matches the distance according to the change in the distance between the impact operation and the target object, and further improve the realism of the dent effect, this embodiment provides a method for determining a height map and a color map that match the impact position:

[0067] First, the interaction distance between the impact position and the virtual camera is calculated;

[0068] In this embodiment, the virtual camera is used to capture and display the perspective of the virtual world. In the game scene, the virtual camera is an object with properties such as position, direction and field of view, which not only determines the content seen by the player, but also affects the immersion and interactive experience of the game.

[0069] In this embodiment, the dent effect seen from the perspective of the game player will be different due to different interaction distances.

[0070] Secondly, determining a target preset map group whose interaction distance is within a corresponding preset distance range from the plurality of preset map groups;

[0071] In this embodiment, LOD (Level Of Detail) can be determined according to the needs of the actual scene. For each LOD level, multiple preset map groups can be pre-stored. Different preset map groups correspond to different preset distance ranges. Each preset map group includes a height map and a color map within the corresponding preset distance range and within the field of view of the virtual camera.

[0072] Finally, the height map and color map in the target preset map group are used as the height map and color map that match the impact position respectively.

[0073] In an optional implementation manner, in order to minimize the amount of calculation, this embodiment is based on Figure 1 , provides a way to render the dent effect at the impact position based on the height map and color map, please refer to Figure 2 , Figure 2 An example of the process of the dent effect rendering method provided in this embodiment Figure 2 , step S103 includes the following sub-steps:

[0074] Sub-step S1031, constructing a target cube with the impact position as the center point and a preset length as the side length;

[0075] In this embodiment, the preset length can be set according to actual needs. For example, the preset length is 1, and the unit of the side length can be set according to the proportional relationship between the actual game scene and the real world.

[0076] Sub-step S1032, determining the model space position of each pixel point in the screen area covered by the target cube in the model space of the target cube according to the preset depth map;

[0077] In this embodiment, the pixel value of each pixel in the preset depth map represents the depth information of the pixel in the image of the scene to be rendered. As an implementation method, the image of the scene to be rendered displayed on the screen can be obtained, and then the depth information can be estimated by a preset depth estimation algorithm, and the preset depth map corresponding to the image can be obtained according to the depth information.

[0078] In this embodiment, in order to render a more realistic three-dimensional effect, it is necessary to convert the two-dimensional pixel position of each pixel point in the screen area covered by the target cube into a three-dimensional model space position in the model space of the target cube.

[0079] Sub-step S1033, determining the sampling position of each pixel point according to the height map and the model space position of each pixel point;

[0080] In this embodiment, different degrees of depression, different angles and different directions of depression will cause the color of the depressed state after the impact to be shifted compared to the color before the impact. The sampling position is used to locate the position of the color corresponding to the model space position when sampling.

[0081] Sub-step S1034, sampling the color information of each pixel from the color map according to the sampling position of each pixel;

[0082] Sub-step S1035 , rendering the color of each pixel at the model space position according to the color information of each pixel, and finally obtaining the dent effect at the impact position.

[0083] In an optional implementation manner, in order to accurately determine the model space position of each pixel point in the model space of the target cube, this embodiment provides an implementation method:

[0084] First, the pixel coordinates of each pixel are normalized to obtain the normalized coordinates of each pixel;

[0085] In this embodiment, the normalized coordinates are NDC (Normalized Device Coordinates, NDC normalized device coordinates) coordinates. NDC is a standardized coordinate system ranging from (-1, -1) to (1, 1), and the origin of the NDC coordinate system is at the center of the screen.

[0086] One normalization implementation method is: obtain the screen pixel size and the pixel position of each pixel in the screen area covered by the target cube; calculate the normalized coordinates of each pixel according to the pixel position of each pixel and the screen pixel size. For any pixel, the normalized coordinates can be calculated using the following formula:

[0087] x_NDC=(x_Screen / width)*2–1

[0088] y_NDC=(y_Screen / height)*2-1

[0089] Where x_Screen and y_Screen are the x and y components of the pixel position of the pixel, and width and height are the width and height of the screen pixel size, respectively.

[0090] Secondly, the depth value of each pixel is obtained from the preset depth map according to the normalized coordinates of each pixel;

[0091] Third, construct the standard spatial position of each pixel in the preset standard space according to the normalized coordinates of each pixel and its depth value;

[0092] In this embodiment, since the normalized coordinates are coordinates in a two-dimensional space, by adding the depth value, three-dimensional coordinates in a three-dimensional preset standard space can be constructed.

[0093] Finally, the model space position of each pixel is calculated according to the standard space position of each pixel and the preset transformation matrix, and the preset transformation matrix represents the mapping relationship between the preset standard space and the model space determined by the target cube.

[0094] In this embodiment, the preset conversion matrix may be an inverse matrix of the MVP matrix, and the MVP matrix is ​​usually obtained by multiplying a model matrix (Model Matrix), a view matrix (View Matrix) and a projection matrix (Projection Matrix).

[0095] In an optional implementation manner, in order to more quickly determine the sampling position of each pixel point, this embodiment provides an implementation method:

[0096] (1) Determine the original sampling position of each pixel point according to the model space position of each pixel point;

[0097] In this embodiment, the model space position includes the X-axis coordinate and the Z-axis coordinate in the model space coordinate system. The model space coordinate system takes the center point of the target cube as the origin and the direction of the collision operation as the Y-axis. This embodiment uses any pixel point to illustrate the method of determining the original sampling position:

[0098] The offset unit is determined according to the side length of the target cube; the X-axis coordinate and the Z-axis coordinate of the pixel point are offset by the determined offset units to obtain the offset X-axis coordinate and the offset Z-axis coordinate of the pixel point; the original sampling position of the pixel point is determined according to the offset X-axis coordinate and the offset Z-axis coordinate of the pixel point.

[0099] In this embodiment, if the side length of the target cube is 1, the offset unit is 0.5, and the offset X-axis coordinate and the offset Z-axis coordinate can be obtained by adding 0.5 to the X-axis coordinate and the Z-axis coordinate, respectively. As an implementation method, the offset X-axis coordinate and the offset Z-axis coordinate can be used as the U coordinate in the U direction and the V coordinate in the V direction in the texture coordinate system. The texture coordinate system usually ranges from (0,0) to (1,1). These coordinates are used to locate specific pixels in the texture image. U direction: represents the horizontal direction of the texture image. V direction: represents the vertical direction of the texture image. The coordinate position determined by the U coordinate and the V coordinate is used as the original sampling position.

[0100] (2) Determine the offset of each pixel based on the model space position and height map of each pixel;

[0101] In this embodiment, the direction vector of the virtual camera can be determined first, the height value of each pixel in the height map can be obtained, and the offset of each pixel can be determined according to the direction vector of the virtual camera and the height value of each pixel.

[0102] It should be noted that in order to more realistically simulate the depression effects corresponding to different impact forces, the force of the impact operation can also be obtained, such as obtaining the different force levels of the skills released by the player. Different force levels correspond to different amplification factors. According to the different force levels, the height values ​​obtained from the height map are amplified according to the corresponding amplification factors, so that the final depression effect matches the force, so that the depression effect can be dynamically adjusted according to the force level, which is more realistic.

[0103] (3) Determine the sampling position of each pixel based on the original sampling position and offset of each pixel.

[0104] In order to perform the corresponding steps in the above embodiment and each possible implementation method, a method for implementing the dent effect rendering device 100 is provided below. Figure 3 , Figure 3 This is a block diagram of the dent effect rendering device provided in this embodiment. It should be noted that the basic principle and technical effects of the dent effect rendering device 100 provided by the present invention are the same as those of the corresponding above-mentioned embodiments, which are not mentioned in this embodiment for the sake of brief description.

[0105] The dent effect rendering apparatus 100 includes a determining module 110 and a rendering module 120 .

[0106] A determination module 110, configured to determine an impact position according to an impact operation performed on a target object;

[0107] The determination module 110 is further used to determine a height map and a color map that match the impact position, the height map represents the information of the degree of depression, and the color map represents the color information of the target object in the depressed state;

[0108] The rendering module 120 is used to render the dent effect at the impact position according to the height map and the color map.

[0109] In an optional embodiment, a plurality of preset map groups are pre-stored, and different preset map groups correspond to different preset distance ranges. Each preset map group includes a height map and a color map within the corresponding preset distance range and within the field of view of the virtual camera. The determination module 110 is specifically used to:

[0110] Calculate the interaction distance between the impact position and the virtual camera;

[0111] Determine a target preset map group whose interaction distance is within a corresponding preset distance range from a plurality of preset map groups;

[0112] Use the height map and color map in the target preset map group as the height map and color map respectively that match the impact position.

[0113] In an optional implementation manner, the rendering module 120 is specifically configured to:

[0114] Construct a target cube with the impact position as the center point and the preset length as the side length;

[0115] Determine the model space position of each pixel point in the screen area covered by the target cube in the model space of the target cube according to the preset depth map;

[0116] Determine the sampling position of each pixel point according to the height map and the model space position of each pixel point;

[0117] According to the sampling position of each pixel, the color information of each pixel is sampled from the color map;

[0118] The color of each pixel at the model space position is rendered according to the color information of each pixel, and finally the dent effect at the impact position is obtained.

[0119] In an optional implementation, when the rendering module 120 is used to determine the model space position of each pixel point in the screen area covered by the target cube in the model space of the target cube according to the preset depth map, it is specifically used to:

[0120] Normalizing the pixel coordinates of each pixel to obtain the normalized coordinates of each pixel;

[0121] Obtain the depth value of each pixel from the depth map according to the normalized coordinates of each pixel;

[0122] Constructing the standard spatial position of each pixel in a preset standard space according to the normalized coordinates of each pixel and its depth value;

[0123] The model space position of each pixel is calculated according to the standard space position of each pixel and the preset conversion matrix, and the preset conversion matrix represents the mapping relationship between the preset standard space and the model space determined by the target cube.

[0124] In an optional implementation manner, when the rendering module 120 is used to perform normalization processing on each pixel point to obtain the normalized coordinates of each pixel point, it is specifically used to:

[0125] Get the screen pixel size and the pixel position of each pixel in the screen area covered by the target cube;

[0126] The normalized coordinates of each pixel are calculated according to the pixel position of each pixel and the screen pixel size.

[0127] In an optional implementation, the rendering module 120 is further configured to: determine the sampling position of each pixel point according to the height map and the model space position of each pixel point;

[0128] According to the model space position of each pixel, determine the original sampling position of each pixel;

[0129] Determine the offset of each pixel based on the model space position and height map of each pixel;

[0130] The sampling position of each pixel is determined according to the original sampling position and the offset of each pixel.

[0131] In an optional embodiment, the model space position includes an X-axis coordinate and a Z-axis coordinate in a model space coordinate system, the model space coordinate system takes the center point of the target cube as the origin, and takes the direction of the collision operation as the Y-axis, and the rendering module 120 is used to determine the original sampling position of each pixel point according to the model space position of each pixel point, and is specifically used to:

[0132] For any pixel, the offset unit is determined according to the side length of the target cube;

[0133] The X-axis coordinate and the Z-axis coordinate of the pixel point are offset by the offset unit respectively to obtain the offset X-axis coordinate and the offset Z-axis coordinate of the pixel point;

[0134] The original sampling position of the pixel is determined according to the offset X-axis coordinate and the offset Z-axis coordinate of the pixel.

[0135] The embodiment of the present invention also provides a block diagram of an electronic device 10. The electronic device 10 implements the dent effect rendering method of the above embodiment. Figure 4 , Figure 4 This is a block diagram of an electronic device 10 provided in this embodiment. The electronic device 10 includes a processor 11, a memory 12 and a bus 13. The processor 11 and the memory 12 are connected via the bus 13.

[0136] The processor 11 may be an integrated circuit chip with signal processing capability. In the implementation process, each step of the dent effect rendering method of the above embodiment may be completed by an integrated logic circuit of hardware in the processor 11 or by instructions in the form of software. The above processor 11 may be a general-purpose processor, including a CPU (Central Processing Unit), a NP (Network Processor), etc.; it may also be a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Logic Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0137] The memory 12 is used to store a program for implementing the dent effect rendering method. The program may be a software function module stored in the memory 12 in the form of software or firmware or solidified in the OS (Operating System) of the xx10.

[0138] After receiving the execution instruction, the processor 11 executes the program to implement the dent effect rendering method of the aforementioned embodiment.

[0139] The electronic device 10 may be a game client such as a mobile phone, a tablet computer, a personal computer, a game terminal, or the like, or may be a server running a game.

[0140] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for rendering a dent effect as described in the aforementioned embodiment is implemented.

[0141] In summary, the embodiments of the present invention provide a dent effect rendering method, device, electronic device and computer-readable storage medium, the method comprising: determining an impact position based on an impact operation performed on a target object; determining a height map and a color map matching the impact position, the height map representing information on the degree of depression, and the color map representing color information of the target object in a depressed state; rendering a dent effect on the impact position based on the height map and the color map. Compared with the prior art, this embodiment has at least the following advantages: (1) the dent effect is rendered at the impact position based on the height map and the color map, avoiding the high resource consumption and high cost caused by complex shader calculations, so as to achieve a realistic dent effect at a low computing cost under the premise of controllable resource consumption; (2) it can respond to the behavior of the impact operation in real time and provide dynamic visual effects; (3) the method provided by this embodiment has a high degree of portability and can be applied not only in a virtual reality environment but also in an electronic game. In a virtual reality environment, the user simulates a boxing action to hit the wall through a controller, and the system adjusts the parallax map of the wall in real time by detecting the position and strength of the punch to generate the dent effect caused by the punch; in an electronic game, the vehicle driven by the player hits the ground, and according to the strength and position of the impact, the system dynamically updates the parallax map of the ground to simulate the potholes caused by the impact.

[0142] The above are only various embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for rendering a dent effect, characterized in that: The method comprises: determining an impact position according to an impact operation performed on a target object; Determine a height map and a color map that match the impact position, wherein the height map represents information about the degree of depression, and the color map represents color information of the target object in a depressed state; The dent effect is rendered at the impact position according to the height map and the color map.

2. The method for rendering a dent effect according to claim 1, characterized in that: A plurality of preset map groups are pre-stored, and different preset map groups correspond to different preset distance ranges. Each preset map group includes a height map and a color map within the corresponding preset distance range and within the field of view of the virtual camera. The step of determining the height map and the color map matching the impact position includes: Calculating an interaction distance between the impact position and the virtual camera; Determine, from the plurality of preset map groups, a target preset map group whose interaction distance is within a corresponding preset distance range; The height map and the color map in the target preset map group are respectively used as the height map and the color map matching the impact position.

3. The method for rendering a dent effect according to claim 1, characterized in that: The step of rendering the dent effect on the impact position according to the height map and the color map comprises: Constructing a target cube with the impact position as the center point and a preset length as the side length; Determine the model space position of each pixel point in the screen area covered by the target cube in the model space of the target cube according to the preset depth map; Determining a sampling position of each pixel point according to the height map and the model space position of each pixel point; According to the sampling position of each pixel, sampling the color information of each pixel from the color map; The color of each pixel at the model space position is rendered according to the color information of each pixel, and finally a dent effect at the impact position is obtained.

4. The method for rendering a dent effect according to claim 3, characterized in that: The step of determining the model space position of each pixel point in the screen area covered by the target cube in the model space of the target cube according to the preset depth map comprises: Normalizing the pixel coordinates of each pixel to obtain the normalized coordinates of each pixel; Acquire the depth value of each pixel from the preset depth map according to the normalized coordinates of each pixel; Constructing a standard space position of each pixel point in a preset standard space according to the normalized coordinates of each pixel point and its depth value; The model space position of each pixel is calculated according to the standard space position of each pixel and a preset conversion matrix, wherein the preset conversion matrix represents a mapping relationship between the preset standard space and the model space determined by the target cube.

5. The method for rendering a dent effect according to claim 4, characterized in that: The step of performing normalization processing on each pixel point to obtain the normalized coordinates of each pixel point comprises: Obtaining the screen pixel size and the pixel position of each pixel point in the screen area covered by the target cube; The normalized coordinates of each pixel are calculated according to the pixel position of each pixel and the screen pixel size.

6. The method for rendering a dent effect according to claim 3, characterized in that: The step of determining the sampling position of each pixel point according to the height map and the model space position of each pixel point comprises: Determining the original sampling position of each pixel point according to the model space position of each pixel point; Determining the offset of each pixel point according to the model space position of each pixel point and the height map; The sampling position of each pixel is determined according to the original sampling position and the offset of each pixel.

7. The method for rendering a dent effect according to claim 6, characterized in that: The model space position includes an X-axis coordinate and a Z-axis coordinate in a model space coordinate system, the model space coordinate system takes the center point of the target cube as the origin and the direction of the collision operation as the Y-axis, and the step of determining the original sampling position of each pixel point according to the model space position of each pixel point includes: For any pixel point, the offset unit is determined according to the side length of the target cube; The X-axis coordinate and the Z-axis coordinate of the pixel point are offset by the offset unit respectively to obtain the offset X-axis coordinate and the offset Z-axis coordinate of the pixel point; The original sampling position of the pixel point is determined according to the offset X-axis coordinate and the offset Z-axis coordinate of the pixel point.

8. A dent effect rendering device, characterized in that: The device comprises: A determination module, used to determine an impact position according to an impact operation performed on a target object; The determination module is further used to determine a height map and a color map that match the impact position, wherein the height map represents information about the degree of depression, and the color map represents color information of the target object in a depressed state; A rendering module is used to render a dent effect on the impact position according to the height map and the color map.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement the dent effect rendering method according to any one of claims 1 to 7 when executing the program.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the dent effect rendering method according to any one of claims 1 to 7 is implemented.