A method, apparatus, and electronic device for rendering a streamer effect

CN116740259BActive Publication Date: 2026-11-20NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310571230.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-18
Publication Date
2026-11-20
Estimated Expiration
2043-05-18

Smart Images

  • Figure CN116740259B_ABST
    Figure CN116740259B_ABST
Patent Text Reader

Abstract

The application discloses a rendering method and device of a streamer effect, electronic equipment and a computer readable storage medium. The method comprises the following steps: determining a first point and a second point on a to-be-rendered region of a model; determining position information of the to-be-rendered point in a model coordinate system, wherein the model coordinate system is a coordinate system with the first point as the origin; calculating relevant parameters of the to-be-rendered point and a first characteristic line according to the position information of the to-be-rendered point in the model coordinate system, wherein the first characteristic line is a connecting line of the first point and the second point; and calculating color information of the to-be-rendered point at an nth rendering time according to the relevant parameters and a time value corresponding to the nth rendering time. The method establishes a relationship between the position information and the color information of the points and the time change based on the geometric spatial relationship of the points on the to-be-rendered region of the model, and realizes a multi-axis dynamic streamer effect on the surface of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for rendering a light-flowing effect. Background Technology

[0002] Flowing light effects are an indispensable rendering technique in virtual projects such as games, providing users with a more dazzling visual experience. Currently, some virtual projects use multi-axial dynamic flowing light effects on the surface of 3D models to enhance the quality of the project. Cube lightboxes, as a commonly used model for constructing virtual scenes, are often given dynamic flowing light effects.

[0003] In related technologies, the dynamic flowing light effect of cube light boxes is mostly uniaxial flow or pseudo-multiaxial flow. Among them, uniaxial flow is easier to achieve, but the effect is monotonous and lacks dynamism. Pseudo-multiaxial flow requires special processing of the model's texture image, and obvious break marks will appear at the seams on the model's surface.

[0004] Therefore, how to provide a rendering method for flowing light effects that is low in production cost, has good flowing light effects, and has a strong sense of dynamism has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] This application provides a rendering method, apparatus, electronic device, and computer-readable storage medium for a flowing light effect, in order to solve the technical problems of existing flowing light effect rendering methods, such as the single flowing light effect, poor dynamic sense, the need for special processing of model texture images, and the appearance of obvious breakage marks at the seams of the model surface.

[0006] In a first aspect, embodiments of this application provide a method for rendering a flowing light effect, the method comprising:

[0007] A first point and a second point are determined on the rendering region of the model to be rendered, wherein the rendering region is at least a part of the model surface of the model to be rendered, and the first point and the second point are different points within the rendering region.

[0008] Determine the position information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the region to be rendered, and the model coordinate system is a coordinate system with the first point as the origin;

[0009] Based on the position information of the point to be rendered in the model coordinate system, calculate the relevant parameters of the point to be rendered and the first feature line, where the first feature line is the connecting line between the first point and the second point.

[0010] Based on the relevant parameters and the time value corresponding to the nth rendering time, calculate the color information of the point to be rendered at the nth rendering time, where n is a positive integer greater than or equal to 1.

[0011] Secondly, embodiments of this application provide a rendering apparatus for a flowing light effect, the apparatus comprising: a site determination unit, a position information determination unit, a related parameter calculation unit, and a color information calculation unit;

[0012] The site determination unit is used to determine a first site and a second site on the rendering area of ​​the model to be rendered, wherein the rendering area is at least a part of the model surface of the model to be rendered, and the first site and the second site are different sites within the rendering area.

[0013] The location information determination unit is used to determine the location information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the region to be rendered, and the model coordinate system is a coordinate system with the first point as the origin;

[0014] The relevant parameter calculation unit is used to calculate the relevant parameters between the site to be rendered and the first feature line based on the position information of the site to be rendered in the model coordinate system. The first feature line is the line connecting the first site and the second site.

[0015] The color information calculation unit is used to calculate the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time, where n is a positive integer greater than or equal to 1.

[0016] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0017] The memory is used to store one or more computer instructions;

[0018] The processor is configured to execute one or more computer instructions to implement the above method.

[0019] Fourthly, embodiments of this application provide a computer-readable storage medium storing one or more computer instructions that, when executed by a processor, perform the method described above.

[0020] Compared with existing technologies, the rendering method for the flowing light effect provided in this application includes: determining a first point and a second point on the rendering area of ​​the model to be rendered, wherein the rendering area is at least a portion of the surface of the model to be rendered, and the first point and the second point are different points within the rendering area; determining the position information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the rendering area, and the model coordinate system is a coordinate system with the first point as the origin; calculating the relevant parameters between the point to be rendered and a first feature line based on the position information of the point to be rendered in the model coordinate system, wherein the first feature line is the connecting line between the first point and the second point; and calculating the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time, wherein n is a positive integer greater than or equal to 1. This method establishes the relationship between the position information and color information of each point within the rendering area of ​​the model surface as they change over time, based on the geometric spatial relationship between each point, thereby achieving a multi-axial dynamic flowing light effect on the model surface. The rendering method for the flowing light effect provided in this application uses the geometric spatial relationship of various points on the model surface as the basis for rendering the flowing light effect. Therefore, no special processing of the model and its UVs is required, and there is no breakage in the flowing light effect. Furthermore, the rendering method for the flowing light effect provided in this application treats each point on the model surface as an independent point to be rendered, and calculates the color information of each consecutive point on the model surface at each consecutive rendering moment. Therefore, the obtained flowing light effect is multi-axial and has a strong sense of dynamism. In summary, the rendering method for the flowing light effect provided in this application solves the technical problems of existing flowing light effect rendering methods, such as a single flowing light effect, poor dynamism, the need for special processing of the model texture image, and the appearance of obvious breakage marks at the seams of the model surface. Attached Figure Description

[0021] Figure 1 This is an application system diagram of a rendering method for a flowing light effect provided in an embodiment of this application;

[0022] Figure 2 This is a flowchart of the rendering method for the flowing light effect provided in the first embodiment of this application;

[0023] Figure 3 This is a schematic diagram illustrating the calculation of relevant parameters for the site to be rendered, provided in the first embodiment of this application;

[0024] Figure 4 This is a schematic diagram of rendering a flowing light effect on a cube lightbox provided in the second embodiment of the application;

[0025] Figure 5This is another schematic diagram of rendering a flowing light effect on a cube lightbox provided in the second embodiment of the application;

[0026] Figure 6 This is another schematic diagram of rendering a flowing light effect on a cube lightbox provided in the second embodiment of the application;

[0027] Figure 7 This is a schematic diagram of the structure of the rendering device for the flowing light effect provided in the third embodiment of this application;

[0028] Figure 8 This is a schematic diagram of the structure of the electronic device provided in the fourth embodiment of this application. Detailed Implementation

[0029] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.

[0030] To facilitate understanding, the technical terms that may be involved in the embodiments of this application will be briefly introduced first.

[0031] 1. Flowing light effect

[0032] A flowing light effect is a graphic effect commonly used in design, animation, video, and game production. It creates a flowing, shimmering effect by generating a series of parallel and intersecting colored stripes in an image or video, giving the user a sense of depth and dynamism. The flowing light effect can be applied to various business projects such as web design, game design, product demonstrations, and advertising design to enhance the user's visual experience.

[0033] Light trailing effects can be divided into two types: uniaxial light trailing effects and multiaxial light trailing effects. Uniaxial light trailing effects typically appear as linear comb-like patterns in one direction, while multiaxial light trailing effects are more like complex grid or lattice-like patterns, composed of multiple intersecting colored lines moving in different directions. In addition, there is a "pseudo-multiaxial light trailing effect" that falls between the two, which appears to be composed of light rays intersecting in multiple axes (i.e., different directions), but in reality only uses a single light source.

[0034] 2. Uniaxial flowing light effect

[0035] The uniaxial flowing light effect creates a sense of flow and three-dimensionality by adding gradient color changes in a certain direction of the model, making it look like it is moving or deforming in that direction.

[0036] 3. Multi-axial flowing light effect

[0037] Multi-axial flowing light effect is similar to single-axial flowing light effect, but it adds gradient color changes in multiple directions to create a more three-dimensional and dynamic effect. Compared with single-axial flowing light effect, multi-axial flowing light effect can better express the three-dimensionality and movement of the model.

[0038] 4. Pseudo-multiaxial flowing light effect

[0039] The pseudo-multiaxial flowing light effect creates a flowing, shimmering effect by creating a series of parallel and intersecting colored stripes on the model surface, giving it a three-dimensional and dynamic feel. It looks like it is composed of intersecting light rays from multiple axes (i.e. different directions), but in reality, it only uses a single light source.

[0040] 5. Dot product

[0041] The dot product is an operation between two vectors, also known as the inner product or scalar product. It is the sum of the products of corresponding components of the two vectors and can be represented by the symbol "·". For example, the dot product of vectors a and b is: a·b = a1b1 + a2b2 + ... + a n b n The dot product and the angle between vectors have the following relationship: a·b=|a|×|b|×cos(θ), where a and b represent vectors a and b respectively, |a| and |b| represent the magnitudes of vectors a and b respectively, and θ represents the angle between vectors a and b. The larger the dot product between two vectors, the smaller the angle.

[0042] 6. Mapping

[0043] A mapping is an operation that establishes a one-to-one correspondence between elements in one set and elements in another set, often used to describe relationships between key-value pairs. A mapping is also a function, where each element in the domain uniquely corresponds to an element in the range.

[0044] 7. Frac function

[0045] The Frac function is a commonly used mathematical function that returns the decimal part of a real number. That is, for a real number x, Frac(x) equals the decimal part of x (the part remaining after removing the integer part). For example, Frac(6.82) equals 0.82.

[0046] 8. Lerp function

[0047] The Lerp (Linear Interpolation) function is a commonly used function in computer graphics, which is used to perform interpolation calculation between two known points to obtain a new point at a certain position between the two points. The calculation formula is: Lerp(A,B,C)=A×(1-C)+B×C, where A and B represent two known points, and C is a number between 0 and 1, representing the positional relationship of the new point relative to point A and point B. When C=0, the Lerp function returns A; when C=1, the Lerp function returns B; when 0<C<1, the Lerp function returns the interpolation result between A and B, for example: when C is 0.5, the Lerp function returns the mean value of A and B.

[0048] 9. Model UV

[0049] Model UV refers to the texture coordinates on a 3D model, also known as UV coordinates. These coordinates are used to map a 2D texture image onto the surface of the 3D model to achieve a texture mapping effect. In the UV coordinate system, each vertex has a corresponding UV coordinate, usually expressed in the form of (u,v). Using UV coordinates allows developers to precisely control the display position and orientation of the texture image on the model surface.

[0050] With the development of computer technology, virtual service projects such as games no longer only consider the usability of the project, but also pay attention to the quality of the project. Among them, the light stream effect is an indispensable rendering special effect for improving the project quality, and projects with the light stream effect can often bring users a more gorgeous visual experience.

[0051] The light stream effect is usually rendered on the model surface, that is, high-brightness reflection is rendered on the model surface, making the model look as if it is surrounded or covered by colored, flowing light. A cubic light box is a model commonly used to construct virtual scenes. Most of the dynamic light stream effects on traditional cubic light boxes are uniaxial or pseudo-multiaxial. Among them, the uniaxial light stream effect production method is simple, and the common practice is to make a light-sweeping texture map, combine it with the UV coordinates of the model surface, and realize the light stream of texture movement by continuously updating the position of the light-sweeping texture. However, the light stream effect rendered on the stereoscopic light box by this method has the problems of single effect and poor dynamic sense. The production method of the pseudo-multiaxial light stream effect is relatively complex, which requires generating multiple light stream maps in different directions, and performing special processing on the model UV, and controlling multiple light stream effects in different directions through the multiple light stream maps, so that the light stream presents different intensities and speeds in different directions. However, since the UV coordinates at the seams of each face of the model are discontinuous, the light stream map will produce a discontinuous effect at the seams, thus showing obvious fracture traces.

[0052] In view of this, this application provides a rendering method for a flowing light effect that does not require special processing of the model's UVs or the creation of additional flowing light maps. It uses the geometric spatial relationship of the model as the basis for rendering the flowing light effect, and establishes the relationship between the position information and color information of each point on the model's surface as they change over time. This achieves a multi-axial dynamic flowing light effect on the model's surface, solving the technical problems of existing flowing light effect rendering methods, such as the single flowing light effect, poor dynamic sense, the need for special processing of the model's UVs, and the appearance of obvious breakage marks at the seams of the model's surface.

[0053] The rendering method, apparatus, electronic device, and computer-readable storage medium for the flowing light effect described in this application will be further described in detail below with reference to specific embodiments and accompanying drawings.

[0054] This is an application system diagram of a rendering method for a flowing light effect provided in an embodiment of this application. For example... Figure 1 As shown, the system includes a user node 101 and a service node 102. The user node 101 can be any device such as a smartphone, tablet, laptop, desktop computer, or personal digital assistant (PDA). The service node 102 can be a processing model within the user node 101, a processing device electrically connected to the user node 101, or a server communicatively connected to multiple user nodes 101. The service node 102 is equipped with the rendering method for the flowing light effect provided in this application. When a user issues a rendering request for a model through the user node 101, the rendering method for the flowing light effect provided in this application is executed to render the model and present it to the user through the user node 101.

[0055] The first embodiment of this application provides a method for rendering a flowing light effect.

[0056] Figure 2 This is a flowchart of the rendering method for the flowing light effect provided in this embodiment. The following is combined with... Figure 2 The rendering method for the flowing light effect provided in this embodiment will be described in detail. The embodiments described below are used to explain the technical solutions of this application and are not intended to limit actual use.

[0057] like Figure 2 As shown, the rendering method for the flowing light effect provided in this embodiment includes the following steps S210 to S240.

[0058] Step S210: Determine a first point and a second point on the rendering area of ​​the model to be rendered, wherein the rendering area is at least a part of the model surface of the model to be rendered, and the first point and the second point are different points within the rendering area.

[0059] The term "site point" refers to a discrete point on the surface of a 3D model. In one optional implementation of this embodiment, pixels on the surface of the model to be rendered are used as the basic unit of the flowing light rendering; that is, a pixel on the model surface is a site point on the model surface. The higher the pixel count and the denser the pixels of the model to be rendered, the better the model clarity, and the more delicate and better the flowing light effect will be.

[0060] The area to be rendered refers to the part or all of the surface of the model to be rendered, where a flowing light effect is desired. That is, if the designer wants to display a flowing light effect on the entire area of ​​the model to be rendered, then the area to be rendered is the surface of the model to be rendered.

[0061] The first site and the second site refer to different sites located within the area to be rendered. In this step, the method for determining the first site and the second site may include the following optional implementation methods:

[0062] Firstly, two randomly selected points within the area to be rendered are used as the first and second points.

[0063] Secondly, the preset direction of light flow is used as the basis for determining the first point and the second point. Specifically, any pair of points in the area to be rendered that are consistent with the direction of light flow are taken as the first point and the second point, and the line connecting the first point and the second point is parallel to the direction of light flow.

[0064] Third, the size of the area to be rendered is used as the basis for determining the first and second points. Specifically, any pair of points in the area to be rendered that are relatively far apart are used as the first and second points.

[0065] Fourth, the preset direction of light flow and the size of the area to be rendered are used as the basis for determining the first and second points. Specifically, the point pair with the largest relative distance between the two points in each point pair that is in the same direction as the light flow is taken as the first and second points.

[0066] Of course, in addition to the four implementation methods mentioned above, there are other implementation methods, such as using the shape and material of the area to be rendered as a basis to determine the first and second points. The specific implementation method is not limited here.

[0067] In this step, determining the first and second points is actually the reference point for determining the geometric relationship for subsequent rendering of the flowing light effect based on geometric spatial relationships. Based on this reference point, the geometric spatial relationship between other points on the model to be rendered and the reference point can be further determined, so that each point can be color rendered based on the corresponding geometric spatial relationship. The specific method will be explained in detail in the following steps.

[0068] Step S220: Determine the position information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the region to be rendered, and the model coordinate system is a coordinate system with the first point as the origin.

[0069] The point to be rendered refers to any point on the region to be rendered. In other words, every point on the region to be rendered is a point to be rendered, including the first point and the second point.

[0070] The model coordinate system can be understood as a coordinate system established with the first point as the origin. This coordinate system can be two-dimensional or three-dimensional. If the first point and the second point are located on the same plane of the surface of the model to be rendered, a two-dimensional coordinate system with the first point as the origin can be established. If the first point and the second point are located on different planes of the surface of the model to be rendered, a three-dimensional coordinate system with the first point as the origin needs to be established. The dynamic effect of the flowing light rendered based on the geometric spatial relationship between each point to be rendered and the first and second points on the rendering area obtained in the three-dimensional coordinate system is superior.

[0071] The position information of the point to be rendered in the model coordinate system can be understood as the coordinates of the point to be rendered in the model coordinate system. If the model coordinate system is a two-dimensional coordinate system, the position information of the point to be rendered can be represented by (X, Y). If the model coordinate system is a three-dimensional coordinate system, the position information of the point to be rendered can be represented by (X, Y, Z).

[0072] Step S230: Calculate the relevant parameters of the location to be rendered and the first feature line based on the position information of the location to be rendered in the model coordinate system. The first feature line is the line connecting the first location and the second location.

[0073] The relevant parameters can be understood as data on the relationship between the point to be rendered and the first feature line, calculated based on the geometric spatial relationship between the point to be rendered, the first point, and the second point in the model coordinate system.

[0074] In one optional implementation provided in this embodiment, calculating the relevant parameters between the site to be rendered and the first feature line may include the following steps S231-S232:

[0075] Step S231: Calculate the original correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system.

[0076] The original correlation parameters can be understood as the initial relationship data between the point to be rendered and the first feature line, obtained based on the geometric spatial relationship between the point to be rendered, the first point, and the second point in the model coordinate system. The relationship data, i.e., the correlation parameters, can be obtained after processing the initial relationship data.

[0077] Since the first point is the origin of the model coordinate system, information such as the distances between the first and second points and the first point, as well as the tilt angles of the first and second points, can be obtained using the position information of the point to be rendered and the position information of the second point. In this embodiment, the position information of the second point in the model coordinate system is defined as the first position information.

[0078] In one optional implementation of this embodiment, the feature information of the first feature line between the second point and the first point, and the feature information of the second feature line between the point to be rendered and the first point are calculated based on the position information of the second point and the position information of the point to be rendered. Then, based on the feature information of the first feature line and the feature information of the second feature line, the original related parameters corresponding to the point to be rendered are calculated. Specifically, this may include the following steps S231-1 to S231-3:

[0079] Step S231-1: Determine the first feature information of the first feature line based on the first position information of the second point in the model coordinate system.

[0080] In this embodiment, the feature information of the first feature line between the second point and the first point is defined as the first feature information. The first feature information includes at least the length information of the first feature line and the tilt angle information of the first feature line in the model coordinate system.

[0081] Step S231-2: Based on the position information of the point to be rendered in the model coordinate system, determine the second feature information of the second feature line between the first point and the point to be rendered.

[0082] In this embodiment, the feature information of the second feature line between the point to be rendered and the first point is defined as the second feature information. The second feature information includes at least the length information of the second feature line and the tilt information of the second feature line in the model coordinate system.

[0083] Step S231-3: Calculate the dot product of the first feature line and the second feature line based on the first feature information and the second feature information, and use the dot product as the original correlation parameter between the point to be rendered and the first feature line.

[0084] The dot product is an operation between two vectors, and the dot product has the following relationship with the angle between the vectors and the magnitude of the vectors:

[0085] a·b=|a|×|b|×cosθ

[0086] Where a and b represent vectors a and b respectively, |a| and |b| represent the magnitudes of vectors a and b respectively, and θ represents the angle between vectors a and b.

[0087] In this embodiment, the dot product of the first feature line and the second feature line is used as the original correlation parameter corresponding to the site to be rendered. That is, the original correlation parameter is the length of the first feature line multiplied by the length of the second feature line, and then multiplied by the angle between the first and second feature lines.

[0088] Step S231-1 yields the first feature information of the first feature line, which includes the length and inclination angle of the first feature line. Step S231-2 yields the second feature information of the second feature line, which includes the length and inclination angle of the second feature line. The angle between the first and second feature lines can be calculated using the inclination angles of the second and first feature lines. Then, the original relevant parameters are calculated based on the lengths of the first and second feature lines and the angle between them.

[0089] Step S232: Map the original relevant parameters to a value range of 0-1 to obtain the relevant parameters.

[0090] In the field of computer technology, data processing often involves data normalization for ease of calculation and accuracy. Normalization scales data according to a certain ratio to make it fall within a specific range. A common normalization method is to map data to the range of 0-1, also known as min-max scaling or deviation standardization. When normalizing a set of data, the maximum and minimum values ​​must first be obtained, and then each data point is mapped to the range of 0-1 based on these values.

[0091] In this embodiment, the relevant parameters are the result of normalizing the original relevant parameters. In one optional implementation, obtaining the relevant parameters based on the original relevant parameters may specifically include the following steps S232-1 to S232-3:

[0092] Step S232-1: Using the first site as the site to be rendered, calculate the original correlation parameters between the site to be rendered and the first feature line, and use them as the first original correlation parameters.

[0093] Step S232-2: Using the second site as the site to be rendered, calculate the original correlation parameters between the site to be rendered and the first feature line, and use them as the second original correlation parameters.

[0094] As mentioned above, the first point and the second point are reference points determined in the area to be rendered. The first point is the origin of the model coordinate system. The original related parameters of the point to be rendered are the dot product of the second feature line between the point to be rendered and the first point, and the first feature line between the second point and the first point. The dot product operation is to multiply the lengths of the first and second feature lines by the angle between them. Therefore, when the first point is taken as the point to be rendered, the length of the second feature line is 0, and the dot product is the smallest, which is 0. When the second point is taken as the point to be rendered, the first and second feature lines coincide, and the angle between them is 0. At this time, the dot product is the largest, which is the square of the length of the first feature line.

[0095] When the first point is used as the rendering point, the calculated dot product is used as the minimum primitive correlation parameter. When the second point is used as the rendering point, the calculated dot product is used as the maximum primitive correlation parameter. In this embodiment, the minimum primitive correlation parameter is defined as the first primitive correlation parameter, and the maximum primitive correlation parameter is defined as the second primitive correlation parameter.

[0096] Step S232-3: Based on the original related parameters corresponding to the point to be rendered, the first original related parameter, and the second original related parameter, calculate the mapping value of the original related parameter corresponding to the point to be rendered in the range of 0-1, and use the mapping value as the related parameter corresponding to the point to be rendered.

[0097] Based on the first and second original correlation parameters, and according to the minimum-maximum scaling method, the original correlation parameters corresponding to the site to be rendered are projected onto a value range of 0-1 to obtain the correlation parameters corresponding to the site to be rendered. The calculation formula is as follows:

[0098]

[0099] Where P represents the relevant parameters corresponding to the location to be rendered, and L represents the original relevant parameters corresponding to the location to be rendered. min L represents the first original correlation parameter. max This represents the second original correlation parameter.

[0100] Figure 3 This is a schematic diagram illustrating the calculation of relevant parameters for the site to be rendered, as provided in this embodiment.

[0101] like Figure 3 As shown, assuming the first point A and the second point B are located on the same plane of the surface of the model to be rendered, and the point C to be rendered is also located on the same plane as the first point A and the second point B, the calculation method for the relevant parameters corresponding to the point C to be rendered is as follows:

[0102] First, establish a model coordinate system 30 with the first point A as the origin. Since the first point A, the second point B, and the point C to be rendered are all located in the same plane on the surface of the model to be rendered, the model coordinate system 30 is established as a two-dimensional coordinate system.

[0103] Second, obtain the position information of the second site B and the site to be rendered C in the model coordinate system 30. Assume that the position information of the second site B is (8,6) and the position information of the site to be rendered C is (3,4).

[0104] Third, based on the position information (8,6) of the second point B, determine the first feature information of the first feature line AB between the second point B and the first point A. For example... Figure 3 As shown, since the position information of the second point B is (8,6), it can be known that: the length of line segment BD is 6 (point D is the projection point of the second point B on the X-axis of the model coordinate system 30), the length of line segment AD is 8, then the length of the first feature line AB is 10, the inclination angle θ1 of the first feature line AB is 30°, and the first feature information includes: length information AB=10, inclination angle information θ1=30°.

[0105] Fourth, based on the position information (3,4) of the point C to be rendered, determine the second feature information of the second feature line AC between the point C to be rendered and the first point A. For example... Figure 3 As shown, since the position information of the point C to be rendered is (3,4), it can be known that: the length of line segment CE is 4 (the point E is the projection point of the point C to be rendered on the X-axis of the model coordinate system 30), the length of line segment AE is 3, then the length of the second feature line AC is 5, the tilt angle θ2 of the second feature line AC is 60°, and the second feature information includes: length information AC = 5, tilt angle information θ2 = 60°.

[0106] Fifth, calculate the dot product of the first feature line AB and the second feature line AC based on the first and second feature information. Use this product as the original correlation parameter L between the point C to be rendered and the first feature line AB. The calculation results are as follows:

[0107]

[0108] Sixth, calculate the first original correlation parameter L between the first point A and the first feature line AB. min Since the first point A is the origin of the model coordinate system 30, its position information in the model coordinate system 30 is (0,0). Therefore, L min =0.

[0109] Seventh, calculate the second primitive correlation parameter L between the second site B and the first characteristic line AB. max The calculation results are as follows:

[0110]

[0111]

[0112] Eighth, based on the first original relevant parameter L min and the second original related parameter L max Calculate the mapping value of the original relevant parameter L corresponding to the site C to be rendered in the range of 0-1, and use it as the relevant parameter P corresponding to the site C to be rendered. The calculation results are as follows:

[0113]

[0114] Through the above steps, the relevant parameters of the rendering point C and the first feature line AB are obtained. It should be noted that the above example illustrates the calculation method for the relevant parameters of the rendering point C, assuming that the first point A, the second point B, and the rendering point C are located on the same plane of the surface of the model to be rendered. If the first point A and the second point B are located on different planes of the surface of the model to be rendered, the calculation method for the relevant parameters of the rendering point C is still the same as described above. The only difference is that the calculation of the lengths of the first feature line AB and the second feature line AC, as well as the angle θ between the first feature line AB and the second feature line AC, is relatively complex. The other actions are the same and will not be listed here.

[0115] Step S240: Calculate the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time, where n is a positive integer greater than or equal to 1.

[0116] As the name suggests, flowing light refers to the movement of light. Therefore, the color of each point on the rendered area is not static but changes over time, creating a visual effect of flowing light across the entire area. Thus, after obtaining the relevant parameters for each rendered point through the steps described above, it is necessary to correlate them with time information so that each point is rendered with different colors at different times, achieving a dynamic flowing light effect.

[0117] In one optional implementation provided in this embodiment, the time value corresponding to each rendering moment is associated with the relevant parameters corresponding to the location to be rendered, and the color information of the location to be rendered at each rendering moment is calculated. Specifically, this may include the following steps S241 to S242:

[0118] Step S241: Calculate the first parameter corresponding to the position to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time.

[0119] The first parameter can be understood as the data obtained by associating the relevant parameters of the location to be rendered with the time value corresponding to the nth rendering time. In an optional implementation, the relevant parameters can be associated with the time value through processing methods such as summation, specifically including the following steps S241-1 to S241-2:

[0120] Step S241-1: Add the relevant parameters and the time value together to obtain the second parameter.

[0121] Without changing the first and second positions, the relevant parameters corresponding to each position within the rendering area remain unchanged. The relevant parameters are summed with time values ​​at different rendering times; that is, the time values ​​that change with the rendering time are combined with the relevant parameters that do not change with the rendering time. This ensures that the position to be rendered not only has geometrical uniqueness but also fluidity that changes with the rendering time. In this embodiment, the summation result of the relevant parameters and time values ​​is defined as the second parameter.

[0122] Step S241-2: Take the decimal part of the second parameter as the first parameter.

[0123] To achieve a seemingly continuous flowing light effect, the rendering time needs to be divided into finer intervals. For example, dividing one second into 50 rendering intervals means re-rendering every 0.02 seconds. If the time interval is too long, the flowing light effect will appear discontinuous. Because the rendering time intervals are divided finely, the differences between multiple time values ​​corresponding to adjacent rendering intervals are small; the integer parts of the time values ​​are basically the same, and the differences lie only in the decimal parts. The above steps define the relevant parameters corresponding to the points to be rendered as data within the range of 0-1. That is to say, the relevant parameters corresponding to each point in the area to be rendered are basically decimals less than 1, without an integer part. In other words, the relevant parameter part constituting the second parameter is data less than 1, while the time value part constituting the second parameter is data with basically the same integer part, differing only in the decimal part. Therefore, to reduce computational pressure and avoid invalid calculations, in an optional implementation provided in this embodiment, the decimal part of the second parameter is obtained through the frac function, and the decimal part of the second parameter is used as the first parameter for subsequent color information calculation. The first parameter can be expressed as:

[0124] frac(P+T)

[0125] Where P represents the relevant parameters corresponding to the location to be rendered, and T represents the time value corresponding to the nth rendering moment.

[0126] by Figure 3 Taking the calculation results of the relevant parameters shown as an example, assuming the time value of the nth rendering moment is 10.02, then the first parameter corresponding to the position C to be rendered at the nth rendering moment is:

[0127] frac(P+T)=frac(0.43+10.02)=0.45

[0128] Step S242: Calculate the color information of the point to be rendered at the nth rendering time based on the first parameter, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color.

[0129] During the design phase of business applications, designers often preset the color of the flowing light to be rendered, for example, setting the flowing light color to a flow change between green and blue. In this embodiment, the first color (e.g., green) preset by the designer is defined as the first preset color, and the second color (e.g., blue) is defined as the second preset color. Based on the first color information corresponding to the first preset color and the second color information corresponding to the second preset color, the color information corresponding to the position to be rendered can be calculated according to the first parameter.

[0130] Color information can be understood as a set of data used to describe color, and can be represented using RGB (red, green, blue) or HSB (hue, saturation, brightness) methods. In RGB mode, color information consists of three values: the intensity values ​​of red, green, and blue. Each color channel has a value range of 0 to 255, and various colors can be created by combining different values. For example, the RGB value of red is (255, 0, 0), the RGB value of black is (0, 0, 0), and the RGB value of white is (255, 255, 255).

[0131] In one optional implementation provided in this embodiment, the color information corresponding to the position to be rendered can be calculated by interpolation. Specifically, the first parameter is used as the interpolation value, and the first color information and the second color information are used as endpoint values ​​to obtain the color information corresponding to the first parameter through interpolation.

[0132] The interpolation operation involves performing an interpolation calculation between two known points to obtain a new point located somewhere between these two points. The calculation formula is as follows:

[0133] Lerp(A,B,C)=A×(1-C)+B×C

[0134] Here, A and B represent two known points, and C represents a number between 0 and 1, indicating the positional relationship of the new point relative to points A and B. When C = 0, the Lerp function returns A; when C = 1, the Lerp function returns B; when 0 < C < 1, the Lerp function returns the interpolation result between A and B. For example, when C is 0.5, the Lerp function returns the mean of A and B.

[0135] In this embodiment, the first color information of the first preset color is taken as A, the second color information of the second preset color is taken as B, and the first parameter corresponding to the position to be rendered is taken as C. The color information corresponding to the position to be rendered can be calculated using the above interpolation function. The calculation formula is as follows:

[0136] FinalColor=Lerp(Color1, Color2, frac(P+T))

[0137] Where FinalColor represents the color information corresponding to the position to be rendered, Color1 represents the first color information corresponding to the first preset color, Color2 represents the second color information corresponding to the second preset color, frac(P+T) represents the first parameter corresponding to the position to be rendered, P represents the relevant parameter corresponding to the position to be rendered, and T represents the time value corresponding to the nth rendering moment.

[0138] by Figure 3Taking the calculation results of the relevant parameters shown as an example, assuming the time value of the nth rendering moment is 10.02, then the first parameter corresponding to the position C to be rendered at the nth rendering moment is:

[0139] frac(P+T)=frac(0.43+10.02)=0.45

[0140] Assuming the first preset color is black and the second preset color is white, then the first color information Color1 is RGB(0, 0, 0), and the second color information Color2 is RGB(255, 255, 255). When the first parameter corresponding to the rendering point C at the nth rendering time is 0.45, the color information FinalColor corresponding to the rendering point C at the nth rendering time is the mixture value of 55% of the first color information and 45% of the second color information, calculated as follows:

[0141] FinalColor=Lerp((0,0,0),(255,255,255),0.45)

[0142] Through steps S210 to S240 above, the color information of any point (the point to be rendered) on the rendering area of ​​the model to be rendered at the nth rendering time is calculated. Furthermore, obtaining the flowing light rendering effect may also include the following steps:

[0143] Step S250: Obtain the color information of each point to be rendered on the region to be rendered at the nth rendering time.

[0144] According to the method described in steps S210 to S240, each point on the region to be rendered is taken as a point to be rendered, and the color information of each point to be rendered in the region to be rendered at the nth rendering time is calculated.

[0145] Step S260: Based on the color information corresponding to each of the rendering points, perform color rendering on the region to be rendered to obtain the flowing light effect of the model to be rendered at the nth rendering time.

[0146] After obtaining the color information corresponding to each point to be rendered at the nth rendering time, the corresponding color can be rendered on the rendering area of ​​the model based on the color information corresponding to each point to be rendered. The technology of rendering color on the model based on color information is relatively mature, and any color rendering method can be applied to the method provided in this embodiment. The specific rendering method will not be described here.

[0147] Through steps S210 to S260, the flowing light effect of the model to be rendered at the nth rendering moment is obtained. As time changes, the color information of each point to be rendered is calculated in real time, thereby performing real-time color rendering to obtain the dynamic flowing light effect on the model to be rendered. Since the flowing light effect rendering method provided in this embodiment renders the flowing light effect by taking each point on the rendering area of ​​the model surface as an independent color rendering point, the obtained flowing light rendering effect is multi-axial.

[0148] In one optional implementation provided in this embodiment, the model to be rendered is at least one of the following models: cube model, cuboid model, cylinder model, sphere model, and irregular shape model.

[0149] The model to be rendered can be a regular model, such as a cube, cuboid, cylinder, or sphere, or an irregular model, such as a cube with a concave surface. The rendering method provided in this embodiment applies to all models, regardless of their specific shape. This is because the rendering method is based on geometric spatial relationships; that is, it calculates the color information of each rendering point at each rendering time based on the geometric spatial relationship between each rendering point and the first and second points on the rendering area of ​​the model. Specifically, regardless of the shape of the model or the shape of the area on the surface of the model, the first and second points can be determined on the rendering area. The angle between the second feature line between the rendering point and the first point and the first feature line between the second and first points can be calculated based on the position information of any rendering point. The dot product of the first and second feature lines is then calculated to obtain the relevant parameters of the rendering point and the first feature line, and finally, the color information of the rendering point at each rendering time is calculated. Therefore, the rendering method for the flowing light effect provided in this embodiment can be applied to models of various shapes.

[0150] The first embodiment described above provides an optional method for rendering a flowing light effect. It should be noted that the examples in the first embodiment are only for explaining the method described in this application and are not intended to limit actual use. The method for rendering a flowing light effect provided in this application includes, but is not limited to, the method described in the first embodiment.

[0151] The second embodiment of this application provides a method for rendering a flowing light effect. In this embodiment, a specific example is used to illustrate the method for rendering a flowing light effect described in the first embodiment of this application.

[0152] In this embodiment, the model to be rendered is a cube model, and the area to be rendered is at least a portion of the surface of the cube model.

[0153] Cube light boxes are a common model in the construction of virtual scenes such as games. In this embodiment, a cube light box is used as the model to be rendered, and a flowing light effect is rendered on the cube light box. The rendering area can be the entire surface of the cube light box or a part of the surface of the cube light box.

[0154] In this embodiment, the rendering of the flowing light effect of the cube lightbox is specifically explained using the following example: the area to be rendered is the entire area on the surface of the cube model; the first point and the second point are two different vertices of the cube model; and the first feature line is the diagonal of the cube model. Figures 4 to 6 This is a schematic diagram of rendering a flowing light effect on a cube lightbox provided in this embodiment. The cube model 40 is a three-dimensional model of the cube lightbox. The rendering process of the flowing light effect may include the following steps S410 to S450:

[0155] Step S410: Determine the first and second points on the surface of the cube model 40 and establish the model coordinate system.

[0156] like Figure 4 As shown, if vertex A of the cube model 40 is selected as the first point and vertex B is selected as the second point, then the first feature line AB between the first point A and the second point B is the diagonal of the cube model 40.

[0157] Establish a model coordinate system with the first point A as the origin. Since the first point A and the second point B are not on the same plane on the surface of the cube model 40, a coordinate system is established as follows: Figure 4 The three-dimensional coordinate system (X, Y, Z) is shown.

[0158] Step S420: Using each pixel on the surface of the cube model 40 as a rendering point, calculate the relevant parameters between each rendering point on the surface of the cube model 40 and the first feature line AB.

[0159] like Figure 5 As shown, taking any point D on the surface of the cube model 40 as a location to be rendered, the relevant parameters are calculated and explained. The calculation steps are as follows:

[0160] Step S421: Obtain the position information of the site D to be rendered and the position information of the second site B.

[0161] Assuming the side length of the cube model 40 is a, based on the positions of the second point B and the point D to be rendered in the model coordinate system, the position information of the second point B and the point D to be rendered is obtained. The position information of the second point B is (a,a,a), and the position information of the point D to be rendered is (x,y,z).

[0162] Step S422: Calculate the original correlation parameters between the site to be rendered (D) and the first feature line (AB) based on the location information of the site to be rendered (D) and the location information of the second site (B).

[0163] Based on the position information of the point D to be rendered and the position information of the second point B, the length of the first feature line AB between the first point A and the second point B, the length of the second feature line AD between the first point A and the point D to be rendered, and the angle between the first feature line AB and the second feature line AD can be calculated.

[0164] Furthermore, a dot product is performed on the first feature line AB and the second feature line AD. The dot product result is used as the original correlation parameter between the point D to be rendered and the first feature line AB. The calculation formula is as follows:

[0165]

[0166] Where L represents the original correlation parameters between the point D to be rendered and the first feature line AB. Denotes the first characteristic line AB. This represents the second characteristic line AD. This represents the magnitude of the first characteristic line AB. Let θ represent the magnitude of the second feature line AD, and let θ represent the angle between the first feature line AB and the second feature line AD.

[0167] Step S423: Map the original related parameters corresponding to the site D to be rendered to a value range of 0-1 to obtain the related parameters corresponding to the site D to be rendered.

[0168] like Figure 5 As shown, when the point to be rendered is point A on the surface of the cube model 40, the original correlation parameter is the smallest because the magnitude of the feature line between the point to be rendered and the first point A is 0. When the point to be rendered is point B on the surface of the cube model 40, the original correlation parameter is the largest because the angle between the second feature line and the first feature line AB between the point to be rendered and the first point A is 0, and the magnitude is the longest. If the side length of the cube model 40 is 1, then the minimum original correlation parameter is 0, and the maximum original correlation parameter is 3.

[0169] Based on the maximum and minimum original correlation parameters, the original correlation parameters corresponding to the site D to be rendered are mapped to a value range of 0-1. The mapped values ​​are then used as the correlation parameters corresponding to the site D to be rendered. The calculation formula is as follows:

[0170]

[0171] Where P represents the correlation parameters between the rendering point D and the first feature line AB, and L represents the original correlation parameters between the rendering point D and the first feature line AB. min L represents the minimum original correlation parameter. max This represents the maximum original correlation parameter.

[0172] Based on steps S421 to S423 above, obtain the relevant parameters of each point to be rendered on the surface of the cube model 40 and the first feature line AB.

[0173] Step S430: Calculate the color information of each point to be rendered on the surface of the cube model 40 at the nth rendering time.

[0174] like Figure 5 As shown, taking any point D on the surface of the cube model 40 as a location to be rendered, the calculation of color information is explained as follows:

[0175] Step S431: Associate the relevant parameters corresponding to the site D to be rendered with the time value corresponding to the nth rendering time to obtain the second parameter corresponding to the site D to be rendered.

[0176] Specifically, the relevant parameters corresponding to the location D to be rendered are summed with the time value corresponding to the nth rendering time, and the sum is used as the second parameter corresponding to the location D to be rendered.

[0177] Step S432: Obtain the first parameter corresponding to the position D to be rendered based on the second parameter.

[0178] Specifically, the frac function is used to take the decimal part of the second parameter as the first parameter, as shown in the following formula:

[0179] frac(P+T)

[0180] Where P represents the relevant parameters corresponding to the location D to be rendered, and T represents the time value corresponding to the nth rendering moment.

[0181] Step S433: Calculate the color information of the site D to be rendered at the nth rendering time based on the first parameter corresponding to the site D to be rendered, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color.

[0182] Specifically, the Lerp interpolation function is used with the first parameter as the interpolation value and the first and second color information as endpoint values ​​to calculate the color information of the point D to be rendered. The calculation formula is as follows:

[0183] FinalColor=Lerp(Color1,Color2,frac(P+T))

[0184] Where FinalColor represents the color information corresponding to the position D to be rendered, Color1 represents the first color information corresponding to the first preset color, Color2 represents the second color information corresponding to the second preset color, frac(P+T) represents the first parameter corresponding to the position D to be rendered, P represents the relevant parameter corresponding to the position D to be rendered, and T represents the time value corresponding to the nth rendering time.

[0185] Based on steps S431 to S433 above, obtain the color information of each point to be rendered on the surface of the cube model 40 at the nth rendering time.

[0186] Step S440: Based on the color information of each point to be rendered on the surface of the cube model 40 at the nth rendering time, perform color rendering on each point to be rendered on the surface of the cube model 40 to obtain the flowing light effect of the cube model 40 at the nth rendering time.

[0187] like Figure 6 As shown, at the nth rendering time, color rendering is performed on each pixel of the cube model 40, resulting in the following: Figure 6 The flowing light effect shown.

[0188] In step S450, as time changes, the color information of each pixel on the surface of the cube model 40 is calculated in real time and then rendered in real time, so that a multi-axial dynamic flowing light effect can be presented on the cube lightbox.

[0189] The second embodiment described above, taking a cube lightbox as an example, provides an optional method for rendering a flowing light effect. It should be noted that the flowing light effect rendering method provided in the first embodiment of this application can be applied not only to cube models but also to other types of models such as cylindrical models, spherical models, and triangular models. The rendering method is consistent with the methods described in the first and second embodiments of this application, differing only in the calculation of geometric spatial relationships, which will not be specifically described here.

[0190] The third embodiment of this application provides a rendering device for a flowing light effect. Figure 7 This is a schematic diagram of the rendering device for the flowing light effect provided in this embodiment.

[0191] like Figure 7 As shown, the rendering device for the flowing light effect provided in this embodiment includes: a site determination unit 710, a position information determination unit 720, a related parameter calculation unit 730, and a color information calculation unit 740.

[0192] The site determination unit 710 is used to determine a first site and a second site on the rendering area of ​​the model to be rendered, wherein the rendering area is at least a part of the model surface of the model to be rendered, and the first site and the second site are different sites within the rendering area.

[0193] The position information determination unit 720 is used to determine the position information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the region to be rendered, and the model coordinate system is a coordinate system with the first point as the origin.

[0194] The relevant parameter calculation unit 730 is used to calculate the relevant parameters between the site to be rendered and the first feature line based on the position information of the site to be rendered in the model coordinate system. The first feature line is the connecting line between the first site and the second site.

[0195] Optionally, calculating the correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system includes:

[0196] Based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system, calculate the original correlation parameters between the point to be rendered and the first feature line;

[0197] The original relevant parameters are mapped to a value range of 0-1 to obtain the relevant parameters.

[0198] Optionally, calculating the original correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system includes:

[0199] Based on the first position information of the second point in the model coordinate system, determine the first feature information of the first feature line;

[0200] Based on the position information of the point to be rendered in the model coordinate system, determine the second feature information of the second feature line between the first point and the point to be rendered;

[0201] Based on the first feature information and the second feature information, the dot product of the first feature line and the second feature line is calculated, and the dot product is used as the original correlation parameter between the site to be rendered and the first feature line.

[0202] Optionally, the step of mapping the original relevant parameters to a value range of 0-1 to obtain the relevant parameters includes:

[0203] Using the first site as the site to be rendered, calculate the original correlation parameters between the first site and the first feature line, and use them as the first original correlation parameters;

[0204] Using the second site as the site to be rendered, calculate the original correlation parameters between the second site and the first feature line, and use them as the second original correlation parameters;

[0205] Based on the original related parameters corresponding to the point to be rendered, the first original related parameter, and the second original related parameter, calculate the mapping value of the original related parameter corresponding to the point to be rendered in the range of 0-1, and use the mapping value as the related parameter corresponding to the point to be rendered.

[0206] The color information calculation unit 740 is used to calculate the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time, where n is a positive integer greater than or equal to 1.

[0207] Optionally, calculating the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time includes:

[0208] Based on the relevant parameters and the time value corresponding to the nth rendering time, calculate the first parameter corresponding to the position to be rendered at the nth rendering time;

[0209] Based on the first parameter, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color, the color information of the position to be rendered at the nth rendering time is calculated.

[0210] Optionally, calculating the first parameter corresponding to the position to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time includes:

[0211] The relevant parameters are summed with the time value to obtain the second parameter;

[0212] Take the decimal part of the second parameter as the first parameter.

[0213] Optionally, calculating the color information of the location to be rendered at the nth rendering time based on the first parameter, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color includes:

[0214] Using the first parameter as an interpolation value and the first color information and the second color information as endpoint values, the color information corresponding to the first parameter is obtained through interpolation calculation.

[0215] Optionally, the apparatus further includes: a rendering unit, the rendering unit being used for:

[0216] Obtain the color information of each point to be rendered on the region to be rendered at the nth rendering time;

[0217] Based on the color information corresponding to each of the rendering points, the region to be rendered is color-rendered to obtain the flowing light effect of the model to be rendered at the nth rendering time.

[0218] Optionally, the model to be rendered is a cube model, and the area to be rendered is at least a portion of the surface of the cube model.

[0219] Optionally, the area to be rendered is the entire area on the surface of the cube model.

[0220] Optionally, the first site and the second site are two different vertices of the cube model.

[0221] Optionally, the first feature line is the diagonal of the cube model.

[0222] The fourth embodiment of this application provides an electronic device. Figure 8 This is a schematic diagram of the structure of the electronic device provided in this embodiment.

[0223] like Figure 8 As shown, the electronic device provided in this embodiment includes: a memory 810 and a processor 820;

[0224] The memory 810 is used to store computer instructions for executing rendering methods of light-flow effects;

[0225] The processor 820 is configured to execute computer instructions stored in the memory 810 to perform the following operations:

[0226] A first point and a second point are determined on the rendering region of the model to be rendered, wherein the rendering region is at least a part of the model surface of the model to be rendered, and the first point and the second point are different points within the rendering region.

[0227] Determine the position information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the region to be rendered, and the model coordinate system is a coordinate system with the first point as the origin;

[0228] Based on the position information of the point to be rendered in the model coordinate system, calculate the relevant parameters of the point to be rendered and the first feature line, where the first feature line is the connecting line between the first point and the second point.

[0229] Based on the relevant parameters and the time value corresponding to the nth rendering time, calculate the color information of the point to be rendered at the nth rendering time, where n is a positive integer greater than or equal to 1.

[0230] Optionally, the following operations may also be performed:

[0231] Obtain the color information of each point to be rendered on the region to be rendered at the nth rendering time;

[0232] Based on the color information corresponding to each of the rendering points, the region to be rendered is color-rendered to obtain the flowing light effect of the model to be rendered at the nth rendering time.

[0233] Optionally, calculating the correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system includes:

[0234] Based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system, calculate the original correlation parameters between the point to be rendered and the first feature line;

[0235] The original relevant parameters are mapped to a value range of 0-1 to obtain the relevant parameters.

[0236] Optionally, calculating the original correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system includes:

[0237] Based on the first position information of the second point in the model coordinate system, determine the first feature information of the first feature line;

[0238] Based on the position information of the point to be rendered in the model coordinate system, determine the second feature information of the second feature line between the first point and the point to be rendered;

[0239] Based on the first feature information and the second feature information, the dot product of the first feature line and the second feature line is calculated, and the dot product is used as the original correlation parameter between the site to be rendered and the first feature line.

[0240] Optionally, the step of mapping the original relevant parameters to a value range of 0-1 to obtain the relevant parameters includes:

[0241] Using the first site as the site to be rendered, calculate the original correlation parameters between the first site and the first feature line, and use them as the first original correlation parameters;

[0242] Using the second site as the site to be rendered, calculate the original correlation parameters between the second site and the first feature line, and use them as the second original correlation parameters;

[0243] Based on the original related parameters corresponding to the point to be rendered, the first original related parameter, and the second original related parameter, calculate the mapping value of the original related parameter corresponding to the point to be rendered in the range of 0-1, and use the mapping value as the related parameter corresponding to the point to be rendered.

[0244] Optionally, calculating the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time includes:

[0245] Based on the relevant parameters and the time value corresponding to the nth rendering time, calculate the first parameter corresponding to the position to be rendered at the nth rendering time;

[0246] Based on the first parameter, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color, the color information of the position to be rendered at the nth rendering time is calculated.

[0247] Optionally, calculating the first parameter corresponding to the position to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time includes:

[0248] The relevant parameters are summed with the time value to obtain the second parameter;

[0249] Take the decimal part of the second parameter as the first parameter.

[0250] Optionally, calculating the color information of the location to be rendered at the nth rendering time based on the first parameter, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color includes:

[0251] Using the first parameter as an interpolation value and the first color information and the second color information as endpoint values, the color information corresponding to the first parameter is obtained through interpolation calculation.

[0252] Optionally, the model to be rendered is a cube model, and the area to be rendered is at least a portion of the surface of the cube model.

[0253] Optionally, the area to be rendered is the entire area on the surface of the cube model.

[0254] Optionally, the first site and the second site are two different vertices of the cube model.

[0255] Optionally, the first feature line is the diagonal of the cube model.

[0256] The fifth embodiment of this application provides a computer-readable storage medium, which includes computer instructions that, when executed by a processor, are used to implement the methods described in the embodiments of this application.

[0257] It should be noted that the relational terms such as "first" and "second" used in this document are only used to distinguish one entity or operation from another, and do not require or imply any actual relationship or order between these entities or operations. Furthermore, "including," "having," "containing," and other similar terms are synonymous, and the conclusion of any one or more items following any of the foregoing words is open-ended; none of the foregoing terms indicates that the one or more items have been exhaustively listed, or are limited to only one or more of the listed items.

[0258] When used herein, unless otherwise expressly stated, the term "or" includes all possible combinations except those that are impractical. For example, if expressed as a database may include A or B, then unless otherwise specified or impractical, it may include database A, or B, or A and B. As a second example, if expressed as a database may include A, B, or C, then unless otherwise specified or impractical, the database may include database A, or B, or C, or A and B, or A and C, or B and C, or A and B and C.

[0259] It is worth noting that the above embodiments can be implemented by hardware or software (program code), or a combination of hardware and software. If implemented by software, it can be stored in the above-described computer-readable medium. When executed by a processor, the software can perform the methods disclosed above. The computing units and other functional units described in this disclosure can be implemented by hardware or software, or a combination of hardware and software. Those skilled in the art will also understand that the above-described multiple modules / units can be combined into one module / unit, and each of the above-described modules / units can be further divided into multiple sub-modules / sub-units.

[0260] In the foregoing detailed description, embodiments have been described with reference to numerous specific details, which may vary depending on the implementation. Certain adaptations and modifications can be made to the embodiments. Other implementations will be readily apparent to those skilled in the art from the specific embodiments disclosed herein. This specification and examples are for illustrative purposes only, and the true scope and essence of this application are defined by the claims. The sequence of steps shown in the figures is also for illustrative purposes only and is not intended to limit to any particular step or order. Therefore, those skilled in the art will recognize that these steps can be performed in different orders when implementing the same method.

[0261] Exemplary embodiments are disclosed in the figures and detailed description of this application. However, many variations and modifications can be made to these embodiments. Accordingly, although specific terms are used, they are only general and descriptive and not for limiting purposes.

Claims

1. A method for rendering a flowing light effect, characterized in that, The method includes: A first point and a second point are determined on the rendering region of the model to be rendered, wherein the rendering region is at least a part of the model surface of the model to be rendered, and the first point and the second point are different points within the rendering region. Determine the position information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the region to be rendered, and the model coordinate system is a coordinate system with the first point as the origin; Based on the position information of the point to be rendered in the model coordinate system, calculate the relevant parameters of the point to be rendered and the first feature line, where the first feature line is the connecting line between the first point and the second point. Based on the relevant parameters and the time value corresponding to the nth rendering time, calculate the color information of the point to be rendered at the nth rendering time, where n is a positive integer greater than or equal to 1; The step of calculating the correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system includes: Based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system, the original correlation parameters between the point to be rendered and the first feature line are calculated. The original correlation parameters are data representing the initial relationship between the point to be rendered and the first feature line obtained based on the geometric spatial relationship between the point to be rendered, the first point, and the second point in the model coordinate system. The original relevant parameters are mapped to a value range of 0-1 to obtain the relevant parameters.

2. The method according to claim 1, characterized in that, The method further includes: Obtain the color information of each point to be rendered on the region to be rendered at the nth rendering time; Based on the color information corresponding to each of the rendering points, the region to be rendered is color-rendered to obtain the flowing light effect of the model to be rendered at the nth rendering time.

3. The method according to claim 1, characterized in that, The step of calculating the original correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system includes: Based on the first position information of the second point in the model coordinate system, determine the first feature information of the first feature line; Based on the position information of the point to be rendered in the model coordinate system, determine the second feature information of the second feature line between the first point and the point to be rendered; Based on the first feature information and the second feature information, the dot product of the first feature line and the second feature line is calculated, and the dot product is used as the original correlation parameter between the site to be rendered and the first feature line.

4. The method according to claim 1, characterized in that, The step of mapping the original relevant parameters to a value range of 0-1 to obtain the relevant parameters includes: Using the first site as the site to be rendered, calculate the original correlation parameters between the first site and the first feature line, and use them as the first original correlation parameters; Using the second site as the site to be rendered, calculate the original correlation parameters between the second site and the first feature line, and use them as the second original correlation parameters; Based on the original related parameters corresponding to the site to be rendered, the first original related parameter, and the second original related parameter, calculate the mapping value of the original related parameter corresponding to the site to be rendered in the range of 0-1, and use the mapping value as the related parameter corresponding to the site to be rendered.

5. The method according to claim 1, characterized in that, The step of calculating the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time includes: Based on the relevant parameters and the time value corresponding to the nth rendering time, calculate the first parameter corresponding to the position to be rendered at the nth rendering time; Based on the first parameter, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color, the color information of the position to be rendered at the nth rendering time is calculated.

6. The method according to claim 5, characterized in that, The step of calculating the first parameter corresponding to the position to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time includes: The relevant parameters are summed with the time value to obtain the second parameter; Take the decimal part of the second parameter as the first parameter.

7. The method according to claim 5, characterized in that, The step of calculating the color information of the location to be rendered at the nth rendering time based on the first parameter, the first color information corresponding to the first preset color, and the second color information corresponding to the second preset color includes: Using the first parameter as an interpolation value and the first color information and the second color information as endpoint values, the color information corresponding to the first parameter is obtained through interpolation calculation.

8. The method according to any one of claims 1-7, characterized in that, The model to be rendered is at least one of the following: cube model, cuboid model, cylinder model, sphere model, or irregular shape model.

9. The method according to claim 8, characterized in that, The model to be rendered is a cube model, and the area to be rendered is at least a portion of the surface of the cube model.

10. The method according to claim 9, characterized in that, The area to be rendered is the entire area on the surface of the cube model.

11. The method according to claim 10, characterized in that, The first site and the second site are two different vertices of the cube model.

12. The method according to claim 11, characterized in that, The first feature line is the diagonal of the cube model.

13. A rendering device for a flowing light effect, characterized in that, The device includes: a site determination unit, a location information determination unit, a related parameter calculation unit, and a color information calculation unit; The site determination unit is used to determine a first site and a second site on the rendering area of ​​the model to be rendered, wherein the rendering area is at least a part of the model surface of the model to be rendered, and the first site and the second site are different sites within the rendering area. The location information determination unit is used to determine the location information of the point to be rendered in the model coordinate system, wherein the point to be rendered is any point on the region to be rendered, and the model coordinate system is a coordinate system with the first point as the origin; The relevant parameter calculation unit is used to calculate the relevant parameters between the site to be rendered and the first feature line based on the position information of the site to be rendered in the model coordinate system. The first feature line is the line connecting the first site and the second site. The color information calculation unit is used to calculate the color information of the point to be rendered at the nth rendering time based on the relevant parameters and the time value corresponding to the nth rendering time, where n is a positive integer greater than or equal to 1; The step of calculating the correlation parameters between the point to be rendered and the first feature line based on the position information of the point to be rendered in the model coordinate system includes: Based on the position information of the point to be rendered in the model coordinate system and the first position information of the second point in the model coordinate system, the original correlation parameters between the point to be rendered and the first feature line are calculated. The original correlation parameters are data representing the initial relationship between the point to be rendered and the first feature line obtained based on the geometric spatial relationship between the point to be rendered, the first point, and the second point in the model coordinate system. The original relevant parameters are mapped to a value range of 0-1 to obtain the relevant parameters.

14. An electronic device, characterized in that, include: Memory, processor; The memory is used to store one or more computer instructions; The processor is configured to execute one or more computer instructions to implement the method as described in any one of claims 1-12.

15. A computer-readable storage medium storing one or more computer instructions thereon, characterized in that, When this instruction is executed by the processor, it performs the method as described in any one of claims 1-12.

Citation Information

Patent Citations

  • Model rendering method and device and electronic equipment

    CN115205442A

  • Model rendering method and device and electronic equipment

    CN115359168A