Special effect rendering method and device, computer equipment and storage medium
By pre-setting the baking perspective and converting the image format, high-bit and low-bit information images are generated, which solves the problem of high performance load when rendering special effects and achieves efficient rendering and effect restoration.
Patent Information
- Application Number
- CN202511537264.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies have a high performance load when rendering special effects, resulting in high performance consumption and making it impossible to effectively optimize the layering effect.
The target effect is drawn on a blank image of the first image format by using a preset baking perspective, a texture image is generated, and high-bit information image and low-bit information image are determined based on the pixel values of the texture image, and these images are used for rendering.
It effectively reduces the performance consumption when rendering special effects, avoids performance loss caused by layering, and can fully restore the effect.
Smart Images

Figure CN121582431A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of special effect rendering, and in particular to a special effect rendering method and device, computer equipment and a storage medium. BACKGROUND
[0002] With the development of special effect rendering technology, special effects refer to the creation of visual effects and illusions that cannot be directly filmed in real life, are too dangerous or cost too high in media production such as movies, television, drama, video games, etc. through special technical means and skills. Special effect rendering refers to the process of using computer software to calculate all data in a three-dimensional scene (including models, textures, lights, animations, special effect simulations, etc.) to finally generate a static image or a dynamic sequence. The related technology often has the problem of heavy performance load in the process of rendering special effects.
[0003] Therefore, there is an urgent need for a solution to solve the problem of heavy performance load in rendering special effects in the related art. SUMMARY
[0004] Therefore, there is an urgent need for a solution to solve the problem of heavy performance load in rendering special effects in the related art.
[0005] In a first aspect, the present application provides a special effect rendering method. The method comprises: obtaining a target special effect to be rendered; the target special effect comprises a plurality of particles and attribute parameters corresponding to each particle; based on a preset baking view angle, drawing the target special effect on a blank image in a first image format to obtain a texture image; determining a high-bit information image in a second image format and a low-bit information image in a second image format according to the pixel values of each pixel in the texture image; and rendering the target special effect according to the high-bit information image and the low-bit information image.
[0006] In one embodiment, the attribute parameters include position parameters, color parameters and material parameters, and the drawing of the target special effect on a blank image in a first image format based on a preset baking view angle to obtain a texture image comprises: determining a maximum circumscribed rectangle based on the position parameters corresponding to each particle in the target special effect; determining a preset baking view angle according to the maximum circumscribed rectangle; and drawing the target special effect on a blank image in a first image format based on the preset baking view angle, the color parameters, position parameters and material parameters corresponding to each particle to obtain a texture image.
[0007] In one of the embodiments, the method further comprises: obtaining pixel values of each pixel in each row of the texture image; deleting a target row in the texture image if the target row exists in the texture image; the pixel values of each pixel in the target row are all preset pixel values; obtaining pixel values of each pixel in each column of the texture image; deleting a target column in the texture image if the target column exists in the texture image; the pixel values of each pixel in the target column are all preset pixel values.
[0008] In one of the embodiments, the determining the high-bit information image in the second image format and the low-bit information image in the second image format according to the pixel values of each pixel in the texture image comprises: determining a reference value according to the pixel values of each pixel in the texture image; the pixel values comprise a red pixel value, a green pixel value and a blue pixel value; generating the high-bit information image in the second image format according to the pixel values of each pixel in the texture image; generating the low-bit information image in the second image format according to the pixel values of each pixel in the texture image and the reference value.
[0009] In one of the embodiments, the generating the high-bit information image in the second image format according to the pixel values of each pixel in the texture image comprises: determining the red pixel value, the green pixel value and the blue pixel value corresponding to each pixel according to the pixel values of each pixel in the texture image; if the red pixel value of a first target pixel is greater than a preset threshold value, the red high-bit information of the first target pixel is the preset threshold value; if the red pixel value of the first target pixel is less than or equal to the preset threshold value, the red high-bit information of the first target pixel is the red pixel value; the first target pixel is any one of the plurality of pixels in the texture image; if the green pixel value of the first target pixel is greater than the preset threshold value, the green high-bit information of the first target pixel is the preset threshold value; if the green pixel value of the first target pixel is less than or equal to the preset threshold value, the green high-bit information of the first target pixel is the green pixel value; if the blue pixel value of the first target pixel is greater than the preset threshold value, the blue high-bit information of the first target pixel is the preset threshold value; if the blue pixel value of the first target pixel is less than or equal to the preset threshold value, the blue high-bit information of the first target pixel is the blue pixel value; generating the high-bit information image in the second image format according to the red high-bit information, the green high-bit information and the blue high-bit information corresponding to each pixel.
[0010] In one of the embodiments, the generating the low-bit information image in the second image format according to the pixel value of each pixel in the texture image and the reference value comprises: determining the red pixel value, the green pixel value and the blue pixel value corresponding to each pixel according to the pixel value of each pixel in the texture image; if the red pixel value of the first target pixel is greater than a preset threshold, subtracting the preset threshold from the red pixel value of the first target pixel to obtain a first difference value; dividing the first difference value by the reference value to obtain the red low-bit information of the first target pixel; if the red pixel value of the first target pixel is less than or equal to the preset threshold, the red low-bit information of the first target pixel is zero; if the green pixel value of the first target pixel is greater than a preset threshold, subtracting the preset threshold from the green pixel value of the first target pixel to obtain a second difference value; dividing the second difference value by the reference value to obtain the green low-bit information of the first target pixel; if the green pixel value of the first target pixel is less than or equal to the preset threshold, the green low-bit information of the first target pixel is zero; if the blue pixel value of the first target pixel is greater than a preset threshold, subtracting the preset threshold from the blue pixel value of the first target pixel to obtain a third difference value; dividing the third difference value by the reference value to obtain the blue low-bit information of the first target pixel; if the blue pixel value of the first target pixel is less than or equal to the preset threshold, the blue low-bit information of the first target pixel is zero; and generating the low-bit information image in the second image format according to the red low-bit information, the green low-bit information and the blue low-bit information corresponding to each pixel.
[0011] In one of the embodiments, the rendering the target special effect according to the high-bit information image and the low-bit information image comprises: obtaining the red pixel value according to the red low-bit information of the second target pixel, the reference value and the red high-bit information; obtaining the green pixel value according to the green low-bit information of the second target pixel, the reference value and the green high-bit information; obtaining the blue pixel value according to the blue low-bit information of the second target pixel, the reference value and the blue high-bit information; and obtaining the rendered target special effect according to the red pixel value, the green pixel value and the blue pixel value of each pixel.
[0012] In the second aspect, the present application further provides a special effect rendering device. The device comprises:
[0013] The obtaining module is configured to obtain a target special effect to be rendered; the target special effect comprises a plurality of particles and attribute parameters corresponding to each particle; the rendering module is configured to render the target special effect to a blank image in a first image format based on a preset baking perspective to obtain a texture image; the determining module is configured to determine a high-bit information image in a second image format and a low-bit information image in the second image format according to the pixel value of each pixel in the texture image; and the rendering module is configured to render the target special effect according to the high-bit information image and the low-bit information image.
[0014] In a third aspect, the present application also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement any method in the first aspect.
[0015] In a fourth aspect, the present application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement any method in the first aspect.
[0016] The special effect rendering method, device, computer device and storage medium, by obtaining a target special effect to be rendered, the target special effect comprising a plurality of particles and attribute parameters corresponding to each particle, and based on a preset baking perspective, rendering the target special effect on a blank image in a first image format to obtain a texture image, then determining a high-bit information image in a second image format and a low-bit information image in a second image format according to pixel values of each pixel in the texture image, and finally rendering the target special effect according to the high-bit information image and the low-bit information image, by pre-processing the target special effect to obtain the corresponding high-bit information image and the low-bit information image, when the target special effect needs to be rendered, the target special effect can be directly rendered according to the high-bit information image and the low-bit information image, thereby solving the problem of large performance load when rendering the special effect in the related art. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 An application environment diagram of the special effect rendering method in an embodiment;
[0018] Figure 2 A flowchart of the special effect rendering method in an embodiment;
[0019] Figure 3 A structural block diagram of the special effect rendering device in an embodiment;
[0020] Figure 4 An internal structure diagram of the computer device in an embodiment. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0022] With the development of special effects rendering technology, special effects often need to be layered to achieve better visual effects. For example, a dozen or even twenty layers of planar special effects may be layered to express a cool effect, which may lead to a large performance load when rendering special effects. Furthermore, for special effects in older versions, it is not possible to optimize the rendering of special effects by layering, which may result in the loss of HDR information of the special effects.
[0023] The special effects rendering method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Server 104 is used to execute the special effects rendering method. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0024] To address the aforementioned problems, in one embodiment of this application, such as Figure 2 As shown, a special effects rendering method is provided, including the following steps:
[0025] Step 201: Obtain the target effect to be rendered.
[0026] The target effect includes multiple particles and the corresponding attribute parameters for each particle.
[0027] It should be noted that the target special effect is the special effect that needs to be rendered. In this embodiment, steps 201 to 203 are the preprocessing process for the target special effect to be rendered. Special effects refer to the visual effects and illusions created in the production of media such as movies, television, dramas, and video games through special technical means and skills. These effects are either too dangerous or too costly to be directly filmed in real life. The target special effect includes multiple particles and the corresponding attribute parameters of each particle. The particle is the smallest basic unit that constitutes the target special effect. By using computer software, all data in the three-dimensional scene, including models, textures, lighting, animation, and special effect simulations, are processed through complex calculations to finally obtain the attribute parameters of each particle that makes up the target special effect. The attribute parameters include the particle's position parameters, color parameters, and material parameters. The position parameter is used to characterize the particle's position, the color parameter is used to characterize the particle's color, and the material parameter is used to characterize the particle's material.
[0028] Step 202: Based on the preset baking perspective, draw the target effect on a blank image in the first image format to obtain a texture image.
[0029] The preset baking view is a pre-set baking perspective, which can be used to draw the target effect. In this embodiment, the first image format is RGBAHalf format.
[0030] Specifically, based on a preset baking perspective and the attribute parameters corresponding to each particle, the target effect is drawn on a blank image in a first image format to obtain a texture image.
[0031] Baking, also known as "texture baking" or "light baking", is based on the idea of pre-calculating time-consuming and dynamic results and storing them on one or more texture maps so that these results can be quickly and directly called in the final rendering or real-time runtime without having to perform real-time calculations again.
[0032] A preset baking viewpoint serves as the baseline viewpoint for rendering the target effect. Based on this preset baking viewpoint and the attribute parameters of each particle, the rendering position of the target effect on the blank image is determined and then drawn, resulting in a texture image. The pixel value of each pixel in the texture image includes the red, green, and blue pixel values.
[0033] Step 203: Determine the high-bit information image and the low-bit information image of the second image format based on the pixel values of each pixel in the texture image.
[0034] In this embodiment, the second image format is RGBA32. Each pixel in the high-bit information image and the low-bit information image corresponds one-to-one with each pixel in the texture image.
[0035] It is understood that the high-bit information image, low-bit information image and texture image have the same pixel arrangement. For example, in a specific embodiment, the high-bit information image, low-bit information image and texture image are all 1920×1080 images, where 1920 is the number of pixels horizontally and 1080 is the number of pixels vertically.
[0036] For example, based on the known pixel values of the pixels in the first row and first column of the texture image, the high-bit information corresponding to the pixels in the first row and first column of the high-bit information image and the low-bit information corresponding to the pixels in the first row and first column of the low-bit information image can be determined according to the pixel values of the pixels in the first row and first column of the texture image.
[0037] The high-bit image is used to store the high-bit information of each pixel in the texture image. The low-bit image is used to store the low-bit information of each pixel in the texture image.
[0038] Based on the pixel values of each pixel in the texture image, the high-bit information and low-bit information of each pixel value are determined respectively. The high-bit information image is determined based on the high-bit information of each pixel value, and the low-bit information image is determined based on the low-bit information of each pixel value.
[0039] Step 204: Render the target effect based on the high-resolution image and the low-resolution image.
[0040] The target effect is rendered based on the high-bit information corresponding to each pixel in the high-bit information image and the low-bit information corresponding to each pixel in the low-bit information image.
[0041] In the above special effects rendering method, the target special effect to be rendered is obtained, which includes multiple particles and the attribute parameters corresponding to each particle. Based on a preset baking perspective, the target special effect is drawn on a blank image in a first image format to obtain a texture image. Then, based on the pixel values of each pixel in the texture image, a high-bit information image and a low-bit information image in a second image format are determined. Finally, the target special effect is rendered based on the high-bit information image and the low-bit information image.
[0042] It should be noted that the above-mentioned special effects rendering method applies to target special effects on a single plane. By pre-processing the target special effects, the corresponding high-bit information image and the low-bit information image are obtained. When it is necessary to render the target special effects, the target special effects can be rendered directly based on the high-bit information image and the low-bit information image, thereby solving the problem of high performance load when rendering special effects using related technologies.
[0043] It should be noted that the above special effects rendering method can directly avoid the performance consumption caused by layering and can completely restore the effect.
[0044] Based on a preset baking perspective, the target effect is drawn onto a blank image in the first image format, resulting in a texture image including:
[0045] Step 1: Determine the maximum bounding rectangle based on the position parameters of each particle in the target effect.
[0046] It should be noted that the maximum bounding rectangle is determined on the target effect, based on the position parameters of each particle in the target effect.
[0047] The maximum bounding rectangle is the maximum bounding rectangle that surrounds each particle in the target effect.
[0048] For example, the position parameters corresponding to each particle are traversed, the maximum and minimum values of each particle on the vertical coordinate axis and the maximum and minimum values of each particle on the horizontal coordinate axis are calculated, and then the maximum bounding rectangle is determined based on the maximum and minimum values of each particle on the horizontal and vertical coordinate axes.
[0049] For example, the target effect includes four particles with coordinates (1, 2), (3, 2), (5, 1), and (1, 3). The maximum and minimum values of each particle on the horizontal and vertical coordinate axes are calculated. For instance, the maximum value on the horizontal coordinate axis is 5, and the minimum value is 1. The maximum value on the vertical coordinate axis is 3, and the minimum value is 1. Therefore, the minimum bounding rectangle is the rectangle enclosed by lines X=1, X=5, Y=1, and Y=3.
[0050] Step 2: Determine the preset baking view based on the largest bounding rectangle.
[0051] The preset baking view is a top-view orthogonal view of the largest bounding rectangle, and can be determined based on the largest bounding rectangle. The preset baking view must include at least the largest bounding rectangle.
[0052] Step 3: Based on the preset baking perspective, the color parameters, position parameters, and material parameters of each particle, draw the target effect on a blank image in the first image format to obtain a texture image.
[0053] Based on a preset baking perspective, the position of each particle on the blank image of the first image format is determined according to the position parameters corresponding to each particle. The target effect is drawn according to the color parameters and material parameters corresponding to each particle, thereby obtaining a texture image.
[0054] For example, based on the position parameters of each particle, the corresponding pixel on the blank image is determined; based on the color parameters of each particle, the pixel value of the corresponding pixel is modified; and then based on the material parameters of each particle, the transparency of the corresponding pixel is modified, thereby obtaining a texture image. The pixel values include red pixel values, green pixel values, and blue pixel values.
[0055] In other embodiments of this application, the target effect is drawn by modifying the pixel value of the pixel corresponding to each particle to the corresponding color parameter according to the color parameter, and modifying the opacity of the pixel corresponding to each particle according to the material parameter, thereby obtaining the texture image efficiently and conveniently.
[0056] In other embodiments of this application, the special effects rendering method further includes:
[0057] Step 1: Obtain the pixel value of each pixel in each row of the texture image. If a target row exists in the texture image, delete the target row in the texture image. The pixel value of each pixel in the target row is a preset pixel value.
[0058] The pixel values included in the target behavior are all pixel rows with preset pixel values. The preset pixel values are pre-set pixel values, that is, the default values of each pixel in the blank image. For example, (0, 0, 0).
[0059] It should be noted that the pixel values of each pixel in the blank image above are preset pixel values. In the process of drawing the target effect on the blank image of the first image format to obtain the texture image, the pixel values of the pixels corresponding to each particle in the blank image will be modified.
[0060] Specifically, the process involves obtaining the pixel value of each pixel in each row of the texture image, sequentially determining whether the pixel value of each pixel in each row of the texture image is a preset pixel value, and if so, deleting the pixel row in which all pixels have the preset pixel value.
[0061] Step 2: Obtain the pixel value of each pixel in each column of the texture image. If a target column exists in the texture image, delete the target column from the texture image. The pixel value of each pixel in the target column is a preset pixel value.
[0062] The target column is a column of pixels whose pixel values are all preset pixel values.
[0063] Specifically, the process involves obtaining the pixel value of each pixel in each column of the texture image, sequentially determining whether the pixel value of each column of pixels in the texture image is a preset pixel value, and deleting the pixel column in which all pixels have the preset pixel value.
[0064] In other embodiments of this application, determining the high-bit information image and the low-bit information image of the second image format based on the pixel values of each pixel in the texture image includes:
[0065] Step 1: Determine the baseline value based on the pixel value of each pixel in the texture image.
[0066] The pixel values include red, green, and blue pixel values. The baseline value is the maximum value of the red, green, and blue pixel values of all pixels in the texture image.
[0067] For example, if a texture image includes three pixels with pixel values of (255, 111, 100), (143, 122, 111), and (198, 200, 123), then the base value is 255.
[0068] Step 2: Generate a high-bit information image in a second image format based on the pixel values of each pixel in the texture image.
[0069] Based on the red, green, and blue pixel values of each pixel in the texture image, the corresponding red high-bit information, green high-bit information, and blue high-bit information of each pixel are calculated to generate a high-bit information image in the second image format.
[0070] The red, green, and blue pixel values of each pixel in the texture image are compared with preset thresholds. If they are greater than the preset threshold, the red, green, or blue high-order information of the pixel is the preset threshold. If they are less than or equal to the preset threshold, the red, green, or blue high-order information of the pixel is the corresponding red, green, or blue pixel value.
[0071] After obtaining an initial high-resolution image in a preset second image format, the pixel values of each pixel in the initial high-resolution image are modified to the corresponding red, green, and blue high-resolution information, thereby generating a high-resolution image. The pixel values include red, green, and blue pixel values.
[0072] Step 3: Generate a low-bit information image in the second image format based on the pixel values of each pixel in the texture image and the reference value.
[0073] Based on the red, green, and blue pixel values and the baseline value of each pixel in the texture image, the red low-order information, green low-order information, and blue low-order information corresponding to each pixel are calculated respectively, thereby generating a low-order information image in the second image format.
[0074] The red, green, and blue pixel values of each pixel in the texture image are compared with preset thresholds. If the value is greater than the preset threshold, the red, green, or blue low-order information of the pixel is equal to the corresponding color pixel value minus the preset threshold divided by the baseline value. If the value is less than or equal to the preset threshold, the red, green, or blue low-order information of the pixel is equal to zero.
[0075] After obtaining an initial low-bit information image in a preset second image format, the pixel values of each pixel in the initial low-bit information image are modified to the corresponding red, green, and blue low-bit information, thereby generating a low-bit information image. The pixel values include red, green, and blue pixel values.
[0076] It should be noted that, in this embodiment, based on the pixel values of each pixel in the texture image, the high-bit information image and the low-bit information image of the second image format are determined, thereby storing the high-bit information and low-bit information of each pixel in the texture image, thus storing the color parameters of the texture image, laying the foundation for subsequent rendering of the target effect.
[0077] In other embodiments of this application, generating a high-bit information image in a second image format based on the pixel values of each pixel in the texture image includes:
[0078] Step 1: Based on the pixel values of each pixel in the texture image, determine the corresponding red, green, and blue pixel values for each pixel.
[0079] For example, a pixel has a value of (198, 200, 123), with a red pixel value of 198, a green pixel value of 200, and a blue pixel value of 123.
[0080] Step 2: If the red pixel value of the first target pixel is greater than the preset threshold, then the red high-order information of the first target pixel is the preset threshold; if the red pixel value of the first target pixel is less than or equal to the preset threshold, then the red high-order information of the first target pixel is the red pixel value.
[0081] For example, if the red pixel value of a certain pixel is 198 and the preset threshold is 1, then the red high-order information of that pixel is 1.
[0082] For example, if the red pixel value of a certain pixel is 0.5 and the preset threshold is 1, then the red high-order information of that pixel is 0.5.
[0083] The preset threshold is a pre-set threshold for pixel values. For example, the preset threshold is 1.
[0084] The first target pixel is any one of the multiple pixels in the texture image.
[0085] Step 3: If the green pixel value of the first target pixel is greater than the preset threshold, then the green high-order information of the first target pixel is the preset threshold; if the green pixel value of the first target pixel is less than or equal to the preset threshold, then the green high-order information of the first target pixel is the green pixel value.
[0086] For example, if the green pixel value of a certain pixel is 200 and the preset threshold is 1, then the green high-order information of that pixel is 1.
[0087] For example, if the green pixel value of a certain pixel is 0.6 and the preset threshold is 1, then the green high-order information of that pixel is 0.6.
[0088] Step 4: If the blue pixel value of the first target pixel is greater than the preset threshold, then the blue high-order information of the first target pixel is the preset threshold; if the blue pixel value of the first target pixel is less than or equal to the preset threshold, then the blue high-order information of the first target pixel is the blue pixel value.
[0089] For example, if the blue pixel value of a certain pixel is 101 and the preset threshold is 1, then the blue high-order information of that pixel is 1.
[0090] For example, if the blue pixel value of a certain pixel is 0.3 and the preset threshold is 1, then the blue high-order information of that pixel is 0.3.
[0091] It should be noted that although the relevant steps are only performed on the first target pixel in this embodiment, in real-world scenarios, the relevant steps will be performed on each pixel in the texture image.
[0092] Step 5: Generate a high-bit information image in the second image format based on the red, green, and blue high-bit information corresponding to each pixel.
[0093] Based on the red, green, and blue high-bit information corresponding to each pixel, according to the preset second image format of the initial high-bit information image, each pixel in the initial high-bit information image is matched with the red, green, and blue high-bit information corresponding to each pixel in the texture image, thereby generating a high-bit information image.
[0094] The initial high-bit information image is a pre-set second image format information image, and its pixel arrangement is the same as that of the texture image.
[0095] It should be noted that in this embodiment, by comparing the red, green, and blue pixel values of each pixel in the texture image with a preset threshold, if the values are greater than the preset threshold, the red, green, or blue high-bit information of the pixel is the corresponding red, green, or blue pixel value, thereby generating a high-bit information image in the second image format, which improves the efficiency of generating high-bit information images.
[0096] In other embodiments of this application, generating a low-bit information image in a second image format based on the pixel values of each pixel in the texture image and a reference value includes:
[0097] Step 1: Based on the pixel values of each pixel in the texture image, determine the corresponding red, green, and blue pixel values for each pixel.
[0098] Step 2: If the red pixel value of the first target pixel is greater than the preset threshold, subtract the preset threshold from the red pixel value of the first target pixel to obtain the first difference; divide the first difference by the reference value to obtain the red low-order information of the first target pixel; if the red pixel value of the first target pixel is less than or equal to the preset threshold, the red low-order information of the first target pixel is zero.
[0099] For example, the red pixel value of the first target pixel is 13, the preset threshold is 1, the base value is 24, the red pixel value of the first target pixel is greater than the preset threshold, so the first difference is 12, and the red low-order information of the first target pixel is 0.5.
[0100] For example, the red pixel value of the first target pixel is 0.5, the preset threshold is 1, the base value is 24, the red pixel value of the first target pixel is less than or equal to the preset threshold, so the red low-order information of the first target pixel is zero.
[0101] Step 3: If the green pixel value of the first target pixel is greater than the preset threshold, subtract the preset threshold from the green pixel value of the first target pixel to obtain the second difference; divide the second difference by the reference value to obtain the green low-order information of the first target pixel; if the green pixel value of the first target pixel is less than or equal to the preset threshold, the green low-order information of the first target pixel is zero.
[0102] For example, the green pixel value of the first target pixel is 7, the preset threshold is 1, the base value is 24, the green pixel value of the first target pixel is greater than the preset threshold, so the second difference is 6, and the green low-order information of the first target pixel is 0.25.
[0103] For example, the green pixel value of the first target pixel is 0.6, the preset threshold is 1, the base value is 24, the green pixel value of the first target pixel is less than or equal to the preset threshold, so the green low-order information of the first target pixel is zero.
[0104] Step 4: If the blue pixel value of the first target pixel is greater than the preset threshold, subtract the preset threshold from the blue pixel value of the first target pixel to obtain the third difference; divide the third difference by the reference value to obtain the blue low-order information of the first target pixel; if the blue pixel value of the first target pixel is less than or equal to the preset threshold, the blue low-order information of the first target pixel is zero.
[0105] For example, the blue pixel value of the first target pixel is 19, the preset threshold is 1, the base value is 24, the blue pixel value of the first target pixel is greater than the preset threshold, so the third value is 18, and the blue low-order information of the first target pixel is 0.75.
[0106] For example, the blue pixel value of the first target pixel is 0.3, the preset threshold is 1, the base value is 24, the blue pixel value of the first target pixel is less than or equal to the preset threshold, so the blue low-order information of the first target pixel is zero.
[0107] It should be noted that although the relevant steps are only performed on the first target pixel in this embodiment, in real-world scenarios, the relevant steps will be performed on each pixel in the texture image.
[0108] Step 5: Generate a low-bit information image in the second image format based on the red low-bit information, green low-bit information, and blue low-bit information corresponding to each pixel.
[0109] Based on the red, green, and blue low-bit information corresponding to each pixel, according to the preset second image format of the initial low-bit information image, each pixel in the initial low-bit information image is matched with the red, green, and blue low-bit information corresponding to each pixel in the texture image, thereby generating a low-bit information image.
[0110] The initial low-bit information image is a pre-set information image in a second image format, and its pixel arrangement is the same as that of the texture image.
[0111] In other embodiments of this application, rendering the target effect based on the high-bit information image and the low-bit information image includes:
[0112] Step 1: Obtain the red pixel value based on the red low-order information, reference value, and red high-order information of the second target pixel.
[0113] The red low-order information is multiplied by the reference value and added to the red high-order information to obtain the red pixel value.
[0114] For example, the red low-order information is zero, the base value is 24, the red high-order information is 0.5, zero is multiplied by the base value and added to 0.5 to get the red pixel value of 0.5.
[0115] For example, the red low-order information is 0.5, the base value is 24, the red high-order information is 1, 0.5 is multiplied by 24 and added to 1 to get the red pixel value of 13.
[0116] Step 2: Obtain the green pixel value based on the green low-order information, reference value, and green high-order information of the second target pixel.
[0117] The green low-order information is multiplied by the reference value and added to the green high-order information to obtain the green pixel value.
[0118] For example, the low-order green information is zero, the base value is 24, the high-order green information is 0.6, zero is multiplied by the base value and added to 0.6 to get the green pixel value of 0.6.
[0119] For example, the low-order green information is 0.25, the base value is 24, and the high-order green information is 1. 0.25 is multiplied by 24 and added to 1 to get a green pixel value of 7.
[0120] Step 3: Obtain the blue pixel value based on the blue low-order information, reference value, and blue high-order information of the second target pixel.
[0121] The blue low-order information is multiplied by the reference value and added to the blue high-order information to obtain the blue pixel value.
[0122] For example, the blue low-order information is zero, the base value is 24, the blue high-order information is 0.3, zero is multiplied by the base value and added to 0.3 to get the blue pixel value of 0.3.
[0123] For example, the blue low-order information is 0.75, the base value is 24, the blue high-order information is 1, 0.75 is multiplied by 24 and added to 1 to get the blue pixel value of 19.
[0124] It should be noted that although the relevant steps are only performed on the second target pixel in this embodiment, in real-world scenarios, the relevant steps will be performed on each pixel in the texture image.
[0125] Step 4: Based on the red, green, and blue pixel values of each pixel, obtain the rendered target effect.
[0126] The pixel value of each pixel is determined based on the red, green, and blue pixel values of each pixel, thus obtaining the target effect after rendering.
[0127] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0128] Based on the same inventive concept, this application also provides a special effects rendering apparatus for implementing the special effects rendering method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more special effects rendering apparatus embodiments provided below can be found in the limitations of the special effects rendering method described above, and will not be repeated here.
[0129] In one embodiment of this application, such as Figure 3 As shown, a special effects rendering device is provided, including:
[0130] Module 100 is used to acquire the target effect to be rendered; the target effect includes multiple particles and the attribute parameters corresponding to each particle.
[0131] The drawing module 200 is used to draw the target effect onto a blank image in a first image format based on a preset baking perspective to obtain a texture image;
[0132] The determining module 300 is used to determine the high-bit information image and the low-bit information image of the second image format based on the pixel values of each pixel in the texture image.
[0133] The rendering module 400 is used to render the target effect based on the high-bit information image and the low-bit information image.
[0134] The drawing module 200 is further configured to determine the maximum bounding rectangle based on the position parameters corresponding to each particle in the target effect; determine a preset baking viewpoint based on the maximum bounding rectangle; and draw the target effect on a blank image of a first image format based on the preset baking viewpoint, the color parameters, position parameters, and material parameters corresponding to each particle to obtain a texture image.
[0135] The acquisition module 100 is further configured to acquire the pixel value of each pixel in each row of the texture image; if a target row exists in the texture image, the target row is deleted from the texture image; the pixel value of each pixel in the target row is a preset pixel value; acquire the pixel value of each pixel in each column of the texture image; if a target column exists in the texture image, the target column is deleted from the texture image; the pixel value of each pixel in the target column is a preset pixel value.
[0136] The determining module 300 is further configured to determine a reference value based on the pixel values of each pixel in the texture image; the pixel values include: red pixel values, green pixel values, and blue pixel values; generate a high-bit information image of a second image format based on the pixel values of each pixel in the texture image; and generate a low-bit information image of a second image format based on the pixel values of each pixel in the texture image and the reference value.
[0137] The determining module 300 is further configured to determine the red pixel value, green pixel value, and blue pixel value corresponding to each pixel based on the pixel value of each pixel in the texture image; if the red pixel value of the first target pixel is greater than a preset threshold, then the red high-order information of the first target pixel is the preset threshold; if the red pixel value of the first target pixel is less than or equal to the preset threshold, then the red high-order information of the first target pixel is the red pixel value; the first target pixel is any one of the multiple pixels in the texture image; if the green pixel value of the first target pixel is greater than the preset threshold, then the green high-order information of the first target pixel is the preset threshold; if the green pixel value of the first target pixel is less than or equal to the preset threshold, then the green high-order information of the first target pixel is the green pixel value; if the blue pixel value of the first target pixel is greater than the preset threshold, then the blue high-order information of the first target pixel is the preset threshold; if the blue pixel value of the first target pixel is less than or equal to the preset threshold, then the blue high-order information of the first target pixel is the blue pixel value; and generate a high-order information image in a second image format based on the red high-order information, green high-order information, and blue high-order information corresponding to each pixel.
[0138] The determining module 300 is further configured to determine the red pixel value, green pixel value, and blue pixel value corresponding to each pixel based on the pixel value of each pixel in the texture image; if the red pixel value of the first target pixel is greater than a preset threshold, the red pixel value of the first target pixel is subtracted from the preset threshold to obtain a first difference; the first difference is divided by the reference value to obtain the red low-order information of the first target pixel; if the red pixel value of the first target pixel is less than or equal to the preset threshold, the red low-order information of the first target pixel is zero; if the green pixel value of the first target pixel is greater than the preset threshold, the green pixel value of the first target pixel is subtracted from the preset threshold to obtain a second difference; the second .... The green low-order information of the first target pixel is obtained by dividing the value by the reference value; if the green pixel value of the first target pixel is less than or equal to a preset threshold, the green low-order information of the first target pixel is zero; if the blue pixel value of the first target pixel is greater than the preset threshold, the blue pixel value of the first target pixel is subtracted from the preset threshold to obtain a third difference; the third difference is divided by the reference value to obtain the blue low-order information of the first target pixel; if the blue pixel value of the first target pixel is less than or equal to the preset threshold, the blue low-order information of the first target pixel is zero; based on the red low-order information, green low-order information and blue low-order information corresponding to each pixel, a low-order information image in a second image format is generated.
[0139] The rendering module 400 is also used to obtain red pixel values based on the red low-order information, reference value, and red high-order information of the second target pixel; to obtain green pixel values based on the green low-order information, reference value, and green high-order information of the second target pixel; to obtain blue pixel values based on the blue low-order information, reference value, and blue high-order information of the second target pixel; and to obtain the rendered target effect based on the red pixel values, green pixel values, and blue pixel values of each pixel.
[0140] Each module in the aforementioned special effects rendering device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0141] In one embodiment of this application, a computer device is provided, which may be a server, and its internal structure diagram may be as follows. Figure 4 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores all relevant data for executing special effects rendering methods. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a special effects rendering method.
[0142] In one embodiment of this application, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows. Figure 4As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a special effects rendering method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad located on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0143] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0144] In one embodiment of this application, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the special effects rendering method in the above embodiment.
[0145] In one embodiment of this application, a computer-readable storage medium is provided, on which a computer program is stored, the computer program being executed by a processor to implement the steps of the special effects rendering methods in the above-described method embodiments.
[0146] In one embodiment of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the special effects rendering methods in the above-described method embodiments.
[0147] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0148] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0149] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0150] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A special effects rendering method, characterized in that, The method includes: Obtain the target effect to be rendered; the target effect includes multiple particles and the attribute parameters corresponding to each particle. Based on a preset baking perspective, the target effect is drawn on a blank image in a first image format to obtain a texture image; Based on the pixel values of each pixel in the texture image, determine the high-bit information image and the low-bit information image of the second image format; The target effect is rendered based on the high-resolution image and the low-resolution image.
2. The special effects rendering method according to claim 1, characterized in that, The attribute parameters include position parameters, color parameters, and material parameters. The step of drawing the target effect onto a blank image in a first image format based on a preset baking perspective to obtain a texture image includes: Based on the position parameters of each particle in the target effect, determine the maximum bounding rectangle; Determine the preset baking angle based on the maximum bounding rectangle; Based on the preset baking perspective, the color parameters, position parameters, and material parameters corresponding to each particle, the target effect is drawn on a blank image in a first image format to obtain a texture image.
3. The special effects rendering method according to claim 2, characterized in that, The method further includes: Obtain the pixel value of each pixel in each row of the texture image; if a target row exists in the texture image, delete the target row in the texture image; the pixel value of each pixel in the target row is a preset pixel value. Obtain the pixel value of each pixel in each column of the texture image. If a target column exists in the texture image, delete the target column from the texture image. The pixel value of each pixel in the target column is a preset pixel value.
4. The special effects rendering method according to claim 1, characterized in that, The step of determining the high-bit information image and the low-bit information image of the second image format based on the pixel values of each pixel in the texture image includes: A baseline value is determined based on the pixel values of each pixel in the texture image; the pixel values include: red pixel values, green pixel values, and blue pixel values; Based on the pixel values of each pixel in the texture image, a high-bit information image in a second image format is generated; Based on the pixel values and reference values of each pixel in the texture image, a low-bit information image in a second image format is generated.
5. The special effects rendering method according to claim 4, characterized in that, The step of generating a high-bit information image in a second image format based on the pixel values of each pixel in the texture image includes: Based on the pixel values of each pixel in the texture image, determine the red pixel value, green pixel value, and blue pixel value corresponding to each pixel; If the red pixel value of the first target pixel is greater than a preset threshold, then the red high-order information of the first target pixel is the preset threshold; if the red pixel value of the first target pixel is less than or equal to the preset threshold, then the red high-order information of the first target pixel is the red pixel value; the first target pixel is any one of the multiple pixels in the texture image; If the green pixel value of the first target pixel is greater than a preset threshold, then the green high-order information of the first target pixel is the preset threshold; if the green pixel value of the first target pixel is less than or equal to the preset threshold, then the green high-order information of the first target pixel is the green pixel value. If the blue pixel value of the first target pixel is greater than a preset threshold, then the blue high-order information of the first target pixel is the preset threshold; if the blue pixel value of the first target pixel is less than or equal to the preset threshold, then the blue high-order information of the first target pixel is the blue pixel value. Based on the red, green, and blue high-bit information corresponding to each pixel, a high-bit information image in a second image format is generated.
6. The special effects rendering method according to claim 5, characterized in that, The step of generating a low-bit information image in a second image format based on the pixel values and reference values of each pixel in the texture image includes: Based on the pixel values of each pixel in the texture image, determine the red pixel value, green pixel value, and blue pixel value corresponding to each pixel; If the red pixel value of the first target pixel is greater than a preset threshold, the red pixel value of the first target pixel is subtracted from the preset threshold to obtain a first difference; the first difference is divided by the reference value to obtain the red low-order information of the first target pixel; if the red pixel value of the first target pixel is less than or equal to the preset threshold, the red low-order information of the first target pixel is zero. If the green pixel value of the first target pixel is greater than a preset threshold, the green pixel value of the first target pixel is subtracted from the preset threshold to obtain a second difference; the second difference is divided by the reference value to obtain the green low-order information of the first target pixel; if the green pixel value of the first target pixel is less than or equal to the preset threshold, the green low-order information of the first target pixel is zero. If the blue pixel value of the first target pixel is greater than a preset threshold, the blue pixel value of the first target pixel is subtracted from the preset threshold to obtain a third difference; the third difference is divided by the reference value to obtain the blue low-order information of the first target pixel; if the blue pixel value of the first target pixel is less than or equal to the preset threshold, the blue low-order information of the first target pixel is zero. Based on the red, green, and blue low-order information corresponding to each pixel, a low-order information image in a second image format is generated.
7. The special effects rendering method according to claim 6, characterized in that, The step of rendering the target effect based on the high-resolution image and the low-resolution image includes: The red pixel value is obtained based on the red low-order information, the reference value, and the red high-order information of the second target pixel; The green pixel value is obtained based on the low-order green information, the reference value, and the high-order green information of the second target pixel. The blue pixel value is obtained based on the blue low-order information, the reference value, and the blue high-order information of the second target pixel; The rendered target effect is obtained based on the red, green, and blue pixel values of each pixel.
8. A special effects rendering device, characterized in that, The device includes: The acquisition module is used to acquire the target effect to be rendered; the target effect includes multiple particles and the attribute parameters corresponding to each particle. The drawing module is used to draw the target effect onto a blank image in a first image format based on a preset baking perspective, thereby obtaining a texture image; The determining module is used to determine the high-bit information image and the low-bit information image of the second image format based on the pixel values of each pixel in the texture image. The rendering module is used to render the target effect based on the high-bit information image and the low-bit information image.
9. A computer device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.