Streaming effect rendering method and device, equipment, storage medium and program product
By drawing curves on textures and generating flowing light maps, and customizing the curve start point and progress value, the problems of clipping and unidirectional flow in flowing light rendering are solved, achieving simpler and more efficient flowing light effect rendering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NETEASE (SHANGHAI) NETWORK CO LTD
- Filing Date
- 2025-12-22
- Publication Date
- 2026-05-01
AI Technical Summary
Existing light-flowing rendering methods suffer from the problem that custom patch models are prone to clipping after binding, and that light can only flow in a fixed direction.
By drawing curves on the texture, a flowing light map is generated and mapped to the 3D model. The starting point and progress value of the curve can be customized to control the direction and path of the flowing light effect.
It solves the clipping problem caused by custom patches, simplifies the light flow rendering process, reduces labor costs, makes the modification of light flow effects more flexible, and reduces the production cycle.
Smart Images

Figure CN121962390A_ABST
Abstract
Description
Rendering methods, devices, equipment, storage media, and software products for light-flowing effects. Technical Field
[0001] This invention relates to the field of computer technology, and specifically to rendering methods, apparatus, devices, storage media, and program products for light-flowing effects. Background Technology
[0002] In game scenes, flowing light rendering, especially when applied to 3D models, can increase the recognizability of the models and enhance visual effects. Currently, flowing light effects are typically added using model textures. However, this method requires custom-designed texture models, which are prone to clipping after binding, and the customization process is time-consuming and labor-intensive. Alternatively, flowing light can be rendered using world space movement; however, this method only allows the flowing light to move in a fixed direction, without allowing for customization of the direction. Summary of the Invention
[0003] This invention provides a rendering method, apparatus, device, storage medium, and program product for a flowing light effect, in order to solve the problems that custom patch models are prone to clipping after binding, the process of customizing patch models is time-consuming and laborious, and the flow of light through world space can only make the flowing light flow in a fixed direction.
[0004] In a first aspect, the present invention provides a method for rendering a flowing light effect, comprising: acquiring at least one curve for rendering, the curve including multiple value points.
[0005] Determine the starting point of the curve, and determine the relative position of each value point on the curve relative to the starting point.
[0006] For each value point, the corresponding curve progress value is determined based on the relative position of the value point.
[0007] Generate a streamer map containing the curve progress values corresponding to each point in the curve, and map the streamer map onto the 3D model.
[0008] The effective position of the preset flowing light effect in the flowing light map is dynamically determined based on the curve progress value, so as to render the preset flowing light effect on the surface of the 3D model.
[0009] The rendering method for the flowing light effect provided in this embodiment solves the clipping problem caused by custom flowing light patches in related technologies by drawing curves on textures and generating corresponding flowing light textures and mapping them to 3D models. The process of drawing curves is also simpler, reducing labor costs. Furthermore, by customizing the curve's starting point, the flowing light effect can flow according to the curve's starting position, with the direction of the curve's progress value as the flow direction. This solves the problem in related technologies where flowing light can only flow in one direction, allowing the user to adjust the flow direction. Moreover, when modifying the flowing light effect, only the original curve needs to be modified and the flowing light texture regenerated to change the path and direction of the flowing light, reducing the production time and labor costs.
[0010] In some optional implementations, determining the curve progress value corresponding to the value point based on the relative position of the value point includes: performing regularization processing on the length value of the curve to determine the regularized length value corresponding to the curve.
[0011] Based on the regular length value corresponding to the curve and the relative position of the value point on the curve, determine the curve progress value corresponding to the value point.
[0012] In some optional implementations, the length values of the curves are regularized to determine the regularized length values corresponding to the curves, including: obtaining the length values of each curve and determining the maximum length value corresponding to each length value.
[0013] The regularized length value of the curve is determined based on the ratio between the curve's length and its maximum length, as well as a preset standard value. The regularized length value is positively correlated with both the ratio and the preset standard value.
[0014] In some optional implementations, the curve progress value corresponding to the point of reference is determined based on the regular length value corresponding to the curve and the relative position of the point of reference on the curve, including: determining the baseline progress value corresponding to the curve.
[0015] Based on the regular length value and baseline progress value corresponding to the curve, and the relative position of the value point on the curve, determine the curve progress value corresponding to the value point.
[0016] In some optional implementations, the curve progress value corresponding to the point of reference is determined based on the regular length value and the baseline progress value corresponding to the curve, as well as the relative position of the point of reference on the curve. This includes: for any point of reference on the curve, determining the initial progress value corresponding to the point of reference based on the product between the relative position of the point of reference and the regular length value of the curve.
[0017] Based on the initial progress value corresponding to the reference point, the baseline progress value of the curve is added to obtain the curve progress value corresponding to the reference point.
[0018] In some optional implementations, determining the baseline progress value corresponding to the curve includes: determining the model point corresponding to the starting point on the three-dimensional model, and obtaining the three-dimensional coordinate value of the model point on the three-dimensional model.
[0019] Determine the baseline progress value corresponding to the curve based on at least one of the three-dimensional coordinate values.
[0020] In some optional implementations, determining the baseline progress value corresponding to the curve based on at least one of the three-dimensional coordinate values includes: determining the height value of the model point corresponding to the starting point based on the three-dimensional coordinate values.
[0021] The height values corresponding to the starting points of each curve are normalized, and the normalized height values are used as the baseline progress values.
[0022] In some optional implementations, generating a streamer map containing curve progress values corresponding to each point in the curve includes: generating an original map with the same size as the map corresponding to the 3D model.
[0023] Based on each value point in the curve, the corresponding value position is determined on the original texture, and the curve progress value corresponding to the value point is used as the value corresponding to the value position to generate a streamer texture containing the curve progress value corresponding to each value point in the curve.
[0024] In some optional implementations, the effective position corresponding to the preset flowing light effect in the flowing light map is dynamically determined according to the curve progress value, including: determining the current effective value corresponding to the current time according to the correspondence between time and effective value within a preset time period, and determining the current curve progress value corresponding to the current effective value.
[0025] Iterate through all the points in the light flow map and determine the current effective position corresponding to the point with the current curve progress value. The current effective position is the position where the preset light flow effect is effective at the current moment.
[0026] The rendering method for the flowing light effect provided in this embodiment solves the clipping problem caused by custom flowing light patches in related technologies by drawing curves on textures and generating corresponding flowing light textures and mapping them to 3D models. This simplifies the curve drawing process and reduces labor costs. By processing curves of different lengths, the length of the curve is used as a calculation element for the curve progress value, ensuring that the flowing light effect flows at a consistent speed on curves of different lengths. The curve progress value is calculated by using the height values of the model points corresponding to each value point in the 3D model, achieving a sequential rendering effect for the flowing light. Furthermore, by customizing the curve's starting point, the flowing light effect can flow according to the starting position of the curve, with the magnitude and direction of the curve progress value serving as the flow direction, allowing the user to adjust the flow direction. Simultaneously, when modifying the flowing light effect, only the original curve needs to be modified and the flowing light texture regenerated to change the path and direction of the flowing light, reducing the production time of the flowing light effect and lowering labor costs.
[0027] Secondly, the present invention provides a rendering device for a flowing light effect, the device comprising: a curve acquisition module, used to acquire at least one curve for rendering, the curve including multiple value points.
[0028] The starting point determination module is used to determine the starting point of the curve and the relative position of each value point on the curve with respect to the starting point.
[0029] The progress value determination module is used to determine the curve progress value corresponding to each value point based on the relative position of the value point.
[0030] The streamer mapping module is used to generate streamers containing curve progress values corresponding to each value point in the curve, and to map the streamers onto the 3D model.
[0031] The streaming light rendering module is used to dynamically determine the effective position of the preset streaming light effect in the streaming light map based on the curve progress value, so as to render the preset streaming light effect on the surface of the 3D model.
[0032] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the rendering method of the light-flowing effect described in the first aspect or any corresponding embodiment thereof.
[0033] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the rendering method for the light-flowing effect of the first aspect or any corresponding embodiment described above.
[0034] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the rendering method of the light-flowing effect of the first aspect or any corresponding embodiment described above. Attached Figure Description
[0035] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0036] Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present invention; Figure 2 is a schematic diagram of a first flowchart of a method for rendering a flowing light effect according to an embodiment of the present invention; Figure 3 is a schematic diagram of a second flowchart of a method for rendering a flowing light effect according to an embodiment of the present invention; Figure 4 is a schematic diagram of determining the progress value of curves of different lengths according to an embodiment of the present invention; Figure 5 is a general flowchart of generating a flowing light map according to an embodiment of the present invention; Figure 6 is a schematic diagram of the correspondence between time and effective value according to an embodiment of the present invention; Figure 7 is a structural block diagram of a device for rendering a flowing light effect according to an embodiment of the present invention; Figure 8 is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0038] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0039] As an optional application scenario of this invention, as shown in FIG1, the terminal device 110 is equipped with application 101, and the user 130 can interact with application 101 through the terminal device 110 and / or the access device of the terminal device 110.
[0040] For example, application 101 can be any application that provides streaming rendering services. For instance, application 101 can be a graphical interactive application. In the application scenario shown in Figure 1, if application 101 is active, the terminal device 110 can display the interface 102 of application 101. Interface 102 can include various types of pages that application 101 can provide.
[0041] Terminal device 110 may be a mobile terminal, a fixed terminal, or a portable terminal, etc., including but not limited to desktop computers, laptop computers, multimedia tablets, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, terminal device 110 may also support any type of interface.
[0042] It should be noted that Figure 1 is merely an example of an application scenario and does not limit the scope of protection of this invention.
[0043] The embodiments of the present invention will now be described with reference to the accompanying drawings. It should be understood that the pages shown in the drawings are merely examples, and various page designs are possible in practice. The various graphic elements on the page may have different arrangements and different visual representations, one or more elements may be omitted or replaced, and one or more other elements may also be present; no limitations are imposed in the embodiments of the present invention. Furthermore, the embodiments are described below primarily with respect to terminal device 110. It should be understood that the actions described relative to terminal device 110 can be performed by application 101 on terminal device 110.
[0044] This invention provides a method for rendering a flowing light effect. By drawing curves on a texture and generating corresponding flowing light textures, it solves the clipping problem caused by custom flowing light patches in related technologies. By customizing the starting point of the curve, the flowing light effect can flow according to the starting position of the curve, solving the problem that flowing light can only flow in one direction in related technologies.
[0045] According to an embodiment of the present invention, a rendering method for a flowing light effect is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0046] This embodiment provides a method for rendering a flowing light effect, which can be used in the aforementioned terminal devices, such as desktop computers and tablet computers. Figure 2 is a flowchart of the method for rendering a flowing light effect according to an embodiment of the present invention. As shown in Figure 2, the process includes the following steps: Step S201, obtaining at least one curve for rendering, the curve including multiple value points.
[0047] Before performing streamer rendering, curves for streamer rendering can be received and acquired. These curves can be preset curves or curves drawn by the user. When drawing curves, they can be drawn on a UV map, where each UV coordinate in the UV map corresponds to a point on the 3D model. In other words, there can be a one-to-one correspondence between a point on the 3D model and a point on the UV map.
[0048] After obtaining the curve, you can select the reference points within the curve—the points on the curve where the flowing light rendering will take place. Generally, any point on the curve can be used as a reference point to ensure the flowing light appears to flow properly. Users can draw simple curves themselves without creating textures, ensuring efficient flowing light rendering. Furthermore, using UV mapping minimizes clipping issues when the 3D model is mapped to the flowing light texture.
[0049] Step S202: Determine the starting point of the curve and the relative position of each value point on the curve with respect to the starting point.
[0050] Since the flowing light effect requires movement in a specific direction, this embodiment predetermines the starting point of the curve to determine the starting position or time of the flowing light rendering. Specifically, the starting point of the curve drawn by the user can be used as the starting point of the curve, or the endpoint with the smaller V coordinate in the UV coordinates of the two endpoints of the curve can be used as the starting point. By customizing the starting point of the curve, the flow direction can be controlled.
[0051] After determining the starting point of the curve, the relative positions of each point on the curve relative to the starting point can be determined. For example, the relative positions can be determined by calculating the curve u parameter (U parameter). Specifically, for any point on the curve, the relative position of that point is the percentage of its position relative to the starting point on the entire curve, and its value can range from 0 to 1. For example, if the overall length of the curve is 20cm, and a point is 6cm from the starting point, then the curve u (i.e., the relative position) for that point is 0.3 (6 / 20). If another point is 16.6cm from the starting point, then the curve u (i.e., the relative position) for that point is 0.83 (16.6 / 20). It can be understood that the relative position of the starting point is 0.
[0052] Step S203: For each value point, determine the curve progress value corresponding to the value point based on the relative position of the value point.
[0053] After determining the relative positions of each value point, the curve progress value can be determined based on these positions. This curve progress value determines the effective position of the flowing light effect on the curve. Specifically, a curve progress value is assigned to each value point on the curve. These curve progress values are used to sequentially apply the flowing light effect along the curve, creating a flowing effect. For example, if the current curve progress value is 1, then the corresponding flowing light effect is added to all value points on the curve with a curve progress value of 1. If the curve progress value at the next time moment is 1.1, then the corresponding flowing light effect is added to all value points on the curve with a curve progress value of 1.1, thus achieving the flowing effect. For example, the relative position of the value point can be directly used as the curve progress value, or calculations can be performed to ensure that value points with the same relative position on different curves have different curve progress values. Determining the curve progress value establishes a basis for determining the arrival time of the flowing light effect at each value point.
[0054] It is understood that for each curve, the progress value corresponding to each value point can be determined in the manner shown in steps S202 to S203, which will not be elaborated here.
[0055] Step S204: Generate a streamer map containing the curve progress values corresponding to each value point in the curve, and map the streamer map onto the 3D model.
[0056] The streamer map can be a grayscale UV map, where the brightness information of each point can be the curve progress value generated in step S203. For example, the greater the brightness of a point, the greater the curve progress value indicating that point. Then, the streamer map is mapped onto the 3D model so that each value point on the streamer map corresponds to a model point on the 3D model.
[0057] Step S205: Dynamically determine the effective position of the preset flowing light effect in the flowing light map according to the curve progress value, so as to render the preset flowing light effect on the surface of the 3D model.
[0058] For each model point on the 3D model, the brightness information corresponding to the model point on the flowing light map can be obtained through the UV coordinates corresponding to the model point, that is, the corresponding curve progress value is obtained. Generally speaking, a variable that increases with time can be added in the game engine, such as time.x. When the curve progress value corresponding to the model point is close to the variable that increases with time, for example, x > time.x and x + 0.1 < time.x (where x is the curve progress value corresponding to the model point and time.x is the variable that increases with time), the preset flowing light effect is added to the model points whose curve progress values meet the conditions. It can be understood that whenever time passes, the effective position corresponding to the current flowing light effect can be determined according to the curve progress value corresponding to the model point, so that the flowing light effect moves along the preset curve and path on the model surface, rendering a dynamic flowing light effect.
[0059] The rendering method of the flowing light effect provided in this embodiment solves the problem of model penetration caused by customizing the flowing light patch in the related technology by drawing a curve on the map and generating a corresponding flowing light map for mapping with the 3D model. At the same time, the process of drawing the curve is simpler, reducing labor costs; in addition, by customizing the starting point of the curve, the flowing light effect can flow according to the starting position of the curve, and the size and direction of the curve progress value are used as the flowing direction, solving the problem that the flowing light in the related technology can only flow in one direction, so that the flowing direction of the flowing light can be adjusted by the user; at the same time, when modifying the flowing light effect, only the original curve needs to be modified and the flowing light map is regenerated to change the path, direction, etc. of the flowing light, reducing the production period of the flowing light effect and lowering the labor cost.
[0060] In this embodiment, a rendering method of a flowing light effect is provided, which can be used in the above terminal devices, such as desktop computers, tablet computers, etc. FIG. 3 is a flowchart of the rendering method of the flowing light effect according to an embodiment of the present invention. As shown in FIG. 3, the process includes the following steps: Step S301, obtain at least one curve for rendering, and the curve includes multiple value points.
[0061] For details, please refer to step S201 of the embodiment shown in FIG. 2, which will not be elaborated here.
[0062] Step S302, determine the starting point of the curve, and determine the relative positions of each value point on the curve with respect to the starting point.
[0063] For details, please refer to step S202 of the embodiment shown in FIG. 2, which will not be elaborated here.
[0064] Step S303, for each value point, determine the curve progress value corresponding to the value point according to the relative position of the value point.
[0065] For details, please refer to step S203 of the embodiment shown in FIG. 2, which will not be elaborated here.
[0066] In some optional implementations, step S303, "determining the curve progress value corresponding to the value point based on the relative position of the value point," includes steps S3031 and S3032.
[0067] Step S3031: Regularize the length value of the curve to determine the regularized length value corresponding to the curve.
[0068] When obtaining the progress value of the curve corresponding to each value point, the length value of each curve can be obtained first. For example, the length value of each curve can be obtained through geometric calculation (such as accumulating the distance between adjacent points). Then, the length value of each curve can be regularized, which can transform the length of each curve into a parameter that can be compared or calculated with each other, thus obtaining the regularized length value corresponding to each curve.
[0069] In some optional implementations, step S3031, "regularizing the length value of the curve to determine the regularized length value corresponding to the curve," includes steps a1 and a2.
[0070] Step a1: Obtain the length values of each curve and determine the maximum length value corresponding to each length value.
[0071] Step a2: Determine the regularized length value of the curve based on the ratio between the curve's length value and the maximum length value, as well as the preset standard value. The regularized length value is positively correlated with both the ratio and the preset standard value.
[0072] In this embodiment, regularization can be achieved by converting the absolute length of each curve into a proportional coefficient relative to the longest curve in the set. Therefore, it is necessary to determine the maximum length value among all length values, and then perform regularization based on the ratio between the length value of the curve and the maximum length value. Furthermore, a preset standard value is provided to limit the regularized length value corresponding to the maximum length value after regularization, so as to obtain a regularized length value for each curve that conforms to the value range.
[0073] The preset standard value can be a default value or a user-input value. For ease of calculation, the preset standard value is usually set to 1. For example, the ratio between the curve's length and the maximum length can be multiplied by the preset standard value to obtain the regularized length value. For instance, if the maximum length is 50, the current curve's length is 30, and the preset standard value is 1, then the regularized length value of the current curve can be 0.6 (i.e., ...). ).
[0074] Step S3032: Determine the curve progress value corresponding to the value point based on the regular length value corresponding to the curve and the relative position of the value point on the curve.
[0075] In some cases, it's necessary to ensure that the speed of the flowing light effect is independent of the curve length. However, if only the relative position is used to calculate the curve progress value, the flowing light effect will become dependent on the curve length; that is, the longer the curve, the faster the flowing light effect. To avoid this problem, when determining the curve progress value corresponding to each value point, the curve length can be considered. Specifically, a regularization length value corresponding to the curve length can be added when calculating the curve progress value. After obtaining the regularization length value of the curve, the curve progress value corresponding to each value point can be calculated based on its relative position. For example, the curve progress value can be set as: Curve Progress Value = Regularization Length Value × Relative Position. For instance, on a curve with a regularization length value of 0.6, for a value point with a curveu (i.e., relative position) of 0.83, the curve progress value at that value point is 0.6 × 0.83 = 0.498.
[0076] As shown in Figure 4, for curves of different lengths (drawn as straight lines for ease of understanding), the curve length at point A is 10, with a regularized length value of 1; the curve length at point B is 5, with a regularized length value of 0.5; the relative position of point A is 0.4; and the relative position of point B is 0.8. If only the relative position is used to calculate the curve progress value, the flowing light effect will arrive at point A first after starting from the curve's starting point (left endpoint) (because the curve progress value corresponding to point A is smaller). However, by adding the regularized length value corresponding to the curve length when calculating the curve progress value, the curve progress value corresponding to point A is 0.4 (i.e., 0.4 × 1), and the curve progress value corresponding to point B is also 0.4 (i.e., 0.8 × 0.5). At this time, the flowing light effect arrives at both points A and B simultaneously after starting from the curve's starting point, thus ensuring that the speed of the flowing light effect is independent of the curve length.
[0077] In some optional implementations, step S3032, "determining the curve progress value corresponding to the value point based on the regular length value corresponding to the curve and the relative position of the value point on the curve", includes steps b1 and b2.
[0078] Step b1: Determine the baseline progress value corresponding to the curve.
[0079] To control the flow of curves in a specific order—for example, allowing the left curve to flow first, and the right curve to flow only after the left curve has finished—a baseline progress value can be added to each curve. This baseline progress value is then incorporated into the curve's progress calculation, allowing for targeted modification of the rendering timing or order of the flowing light effect for each curve. The baseline progress value can be added manually by the user or determined by attributes specific to each curve, such as the starting point's position on the texture and the order in which the curves were added.
[0080] In some alternative implementations, step b1, “determining the baseline progress value corresponding to the curve,” includes steps b11 and b12.
[0081] Step b11: Determine the model point corresponding to the starting point on the 3D model, and obtain the 3D coordinate value of the model point on the 3D model.
[0082] Step b12: Determine the baseline progress value corresponding to the curve based on at least one of the three-dimensional coordinate values.
[0083] As mentioned earlier, the baseline progress value can be determined by the attributes corresponding to each curve. In this embodiment, it can be determined by the model point on the 3D model corresponding to the starting point of the curve. Since the points on the UV map where the curve is located correspond to the model points of the 3D model, the corresponding model point on the 3D model can be determined by the starting point of the curve, and the 3D coordinate value corresponding to that model point (i.e., the model point in the 3D model corresponding to the starting point) can be obtained. Generally, the 3D coordinate value is in the form of (x, y, z). The baseline progress value can be determined by at least one of the coordinate values. For example, the sum of the x and y values of the 3D coordinate value corresponding to the model point corresponding to the starting point of the curve can be used as the baseline progress value.
[0084] In some optional implementations, step b12, "determining the baseline progress value corresponding to the curve based on at least one of the three-dimensional coordinate values," includes steps b121 and b122.
[0085] Step b121: Determine the height value of the model point corresponding to the starting point based on the three-dimensional coordinate values.
[0086] Step b122: Normalize the height values corresponding to the starting points of each curve, and use the normalized height values as the baseline progress values.
[0087] To make the flowing light effect flow first on the curve below the 3D model and then on the curve above the model, the height value of the model point corresponding to the starting point can be determined based on the corresponding height value in the 3D coordinate system, such as the z value in the 3D coordinate system (x, y, z). The baseline progress value can then be determined based on the height value of the model point.
[0088] In determining the baseline schedule value using the height values of model points, the height values can be normalized first. For example, the normalized height values can be set to a range of 0 to 0.5, and the normalized height values can be used as the baseline schedule values.
[0089] As mentioned earlier, the lengths of each curve have been normalized. At this point, it is also necessary to normalize the height value corresponding to the starting point of the curve to avoid affecting the rationality of the curve progress value due to excessively large height values.
[0090] Step b2: Determine the curve progress value corresponding to the point of reference based on the regular length value and baseline progress value corresponding to the curve, as well as the relative position of the point of reference on the curve.
[0091] After determining the baseline progress value corresponding to the curve, it needs to be added to the calculation of the curve progress value. This allows for adaptive adjustment of the curve progress value based on the baseline progress value, thereby controlling the rendering order of each curve. Specifically, the curve progress value for each point on the curve is determined based on the curve's regularization length value, the baseline progress value, and the relative position of the points on the curve. For example, a positive correlation can be established between the baseline progress value and the curve progress value; that is, the larger the baseline progress value, the larger the adjusted curve progress value.
[0092] In some optional implementations, step b2, "determining the curve progress value corresponding to the point of reference based on the regular length value and the baseline progress value corresponding to the curve, and the relative position of the point of reference on the curve", includes steps b21 and b22.
[0093] Step b21: For any point on the curve, determine the initial progress value corresponding to the point based on the product of the relative position of the point and the regular length value of the curve.
[0094] Step b22: Based on the initial progress value corresponding to the value point, add the baseline progress value of the curve to obtain the curve progress value corresponding to the value point.
[0095] In the process of calculating the curve progress value, the initial progress value corresponding to the reference point can be calculated first, and then the baseline progress value of the curve can be added to determine the final curve progress value. In the process of calculating the initial progress value, similar to step S3032, the relative position of the reference point and the regular length value of the curve can be multiplied, and the result can be used as the initial progress value corresponding to the reference point. The curve progress value corresponding to the reference point can be obtained by adding the baseline progress value of the curve to the initial progress value.
[0096] The curve progress value p can be calculated using the following formula:
[0097] Where pos is the relative position of the value point, length is the regular length of the curve where the value point is located, val is the baseline progress value, and f(x) is the adjustment function.
[0098] For example, since the baseline progress value can be normalized, its range can be 0~0.5, and the range of the relative position of the reference point can be 0~1. With a preset standard value of 1, the range of the curve's regularization length can also be 0~1. In this case, the range of the initial progress value can be 0~1, and the range of the curve progress value obtained by summing the initial progress value and the baseline progress value is 0~1.5. However, the range of brightness information on the UV map is generally 0~1. Therefore, the initial progress value can be reduced proportionally, for example, by dividing the initial progress value by 2 (i.e., f(x) = x / 2), and then adding the baseline progress value. The resulting curve progress value will then have a range of 0~1.
[0099] The initial progress value can be used to set the direction of the flowing light effect to the direction starting from the curve's starting point. At the same time, the rendering order of the flowing light effect corresponding to the starting point of the curve can be controlled by introducing a baseline progress value.
[0100] Step S304: Generate a streamer map containing the curve progress values corresponding to each value point in the curve, and map the streamer map onto the 3D model.
[0101] For details, please refer to step S204 of the embodiment shown in Figure 2, which will not be repeated here.
[0102] In some optional implementations, step S304, "generating a streamer map containing curve progress values corresponding to each value point in the curve, and mapping the streamer map to the 3D model", includes steps c1 and c2.
[0103] Step c1: Generate an original texture map with the same size as the texture map corresponding to the 3D model.
[0104] Step c2: Based on each value point in the curve, determine the corresponding value position on the original texture, and use the curve progress value corresponding to the value point as the value corresponding to the value position to generate a streamer texture containing the curve progress value corresponding to each value point in the curve.
[0105] As mentioned earlier, since drawing curves requires creating a UV map where each UV coordinate corresponds to a point on the 3D model, the size of the original texture must match the size of the corresponding UV map on the 3D model. The original texture is a blank texture. Based on the position of each value point on the curve within the original texture, the value at that position (i.e., the brightness information on the streamer map) is updated to the corresponding curve progress value. After updating the original texture at all value points, the updated original texture becomes a streamer map containing the curve progress values corresponding to each value point on the curve.
[0106] Figure 5 is the overall flowchart for generating a streamer map. As shown in Figure 5, the process first receives the curve input by the user and preprocesses the curve, including measuring the curve length and regularization. It may also include determining the relative positions of each value point on the curve. Then, through the input 3D model, the model point information on the 3D model is transmitted into the curve to obtain the 3D coordinate values of each curve starting point on the 3D model and the height value in the 3D coordinate values. Based on the regularized height values, a baseline progress value is generated (i.e., each curve is sorted according to the coordinate height value in the figure), and the curve progress value is mapped to the streamer map to finally obtain the streamer map.
[0107] Step S305: Dynamically determine the effective position of the preset flowing light effect in the flowing light map according to the curve progress value, so as to render the preset flowing light effect on the surface of the 3D model.
[0108] For details, please refer to step S205 of the embodiment shown in Figure 2, which will not be repeated here.
[0109] In some optional implementations, step S305, "dynamically determining the effective position of the preset flowing light effect in the flowing light texture based on the curve progress value," includes steps d1 and d2.
[0110] Step d1: Based on the correspondence between time and effective value within the preset time period, determine the current effective value corresponding to the current time, and determine the current curve progress value corresponding to the current effective value.
[0111] Step d2: Traverse all value points in the flow map and determine the current effective position corresponding to the value point with the current curve progress value. The current effective position is the effective position corresponding to the preset flow effect at the current moment.
[0112] When the flowing light effect is in motion, it is necessary to determine the effective position of each flowing light effect. In order for the flowing light effect to flow periodically, a correspondence between time and effective value can be preset within a time period. Based on the correspondence and the current time, the current effective value corresponding to the current time can be obtained, and the current curve progress value corresponding to the current effective value can be determined.
[0113] Figure 6 illustrates the correspondence between time and effective value. As shown in Figure 6, the horizontal axis 't' represents time, and the vertical axis 'a' represents the effective value. The effective value increases with time in the early part of a cycle, while remaining at its maximum value in the later part of the cycle. Based on this correspondence and the current time, the current effective value corresponding to the current time can be obtained. For example, if the current effective value is 'a', then the range of the current curve progress value can be a to a+0.01. At this point, a matching value point can be found among all the value points in the light map; that is, the value point whose corresponding curve progress value falls within the current curve progress value range. The position of the matching value point in the light map is the effective position. Using the correspondence shown in Figure 6, the light appears and flows in the early part of a time cycle, while during the period when the effective value remains at its maximum value, the light can be controlled not to appear (i.e., there is no corresponding effective position), thus demonstrating the breathing light effect during rendering.
[0114] The rendering method for the flowing light effect provided in this embodiment solves the clipping problem caused by custom flowing light patches in related technologies by drawing curves on textures and generating corresponding flowing light textures and mapping them to 3D models. This simplifies the curve drawing process and reduces labor costs. By processing curves of different lengths, the length of the curve is used as a calculation element for the curve progress value, ensuring that the flowing light effect flows at a consistent speed on curves of different lengths. The curve progress value is calculated by using the height values of the model points corresponding to each value point in the 3D model, achieving a sequential rendering effect for the flowing light. Furthermore, by customizing the curve's starting point, the flowing light effect can flow according to the starting position of the curve, with the magnitude and direction of the curve progress value serving as the flow direction, allowing the user to adjust the flow direction. Simultaneously, when modifying the flowing light effect, only the original curve needs to be modified and the flowing light texture regenerated to change the path and direction of the flowing light, reducing the production time of the flowing light effect and lowering labor costs.
[0115] This embodiment also provides a rendering apparatus for a flowing light effect, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0116] This embodiment provides a rendering device for a flowing light effect, as shown in Figure 7, including: a curve acquisition module 701, used to acquire at least one curve for rendering, the curve including multiple value points.
[0117] The starting point determination module 702 is used to determine the starting point of the curve and the relative position of each value point on the curve with respect to the starting point.
[0118] The progress value determination module 703 is used to determine the curve progress value corresponding to each value point based on the relative position of the value point.
[0119] The streamer mapping module 704 is used to generate a streamer map containing the curve progress values corresponding to each value point in the curve, and to map the streamer map onto the 3D model.
[0120] The light flow rendering module 705 is used to dynamically determine the effective position of the preset light flow effect in the light flow map according to the curve progress value, so as to render the preset light flow effect on the surface of the 3D model.
[0121] In some optional implementations, the progress value determination module 703 includes a length regularization submodule, used to perform regularization processing on the length value of the curve to determine the regularized length value corresponding to the curve.
[0122] The progress value determination submodule is used to determine the progress value of the curve corresponding to the value point based on the regular length value corresponding to the curve and the relative position of the value point on the curve.
[0123] In some optional implementations, the length regularization submodule includes: a maximum length value determination unit, used to obtain the length values of each curve and determine the maximum length value corresponding to each length value.
[0124] The length regularization unit determines the regularized length value of a curve based on the ratio between its length and maximum length, as well as a preset standard value. The regularized length value is positively correlated with both the ratio and the preset standard value.
[0125] In some optional implementations, the progress value determination submodule includes: a baseline progress value unit, used to determine the baseline progress value corresponding to the curve.
[0126] The curve progress value unit is used to determine the curve progress value corresponding to the point of reference based on the regular length value and the baseline progress value corresponding to the curve, as well as the relative position of the point of reference on the curve.
[0127] In some optional implementations, the curve progress value unit includes an initial progress value subunit, used to determine the initial progress value corresponding to any point on the curve based on the product between the relative position of the point and the regular length value of the curve.
[0128] The curve progress value sub-unit is used to add the baseline progress value of the curve to the initial progress value corresponding to the value point to obtain the curve progress value corresponding to the value point.
[0129] In some optional implementations, the reference progress value unit includes: a coordinate value determination subunit, used to determine the model point corresponding to the starting point on the three-dimensional model, and to obtain the three-dimensional coordinate value of the model point on the three-dimensional model.
[0130] The baseline progress value sub-unit is used to determine the baseline progress value corresponding to the curve based on at least one of the three-dimensional coordinate values.
[0131] In some optional implementations, the baseline progress value subunit is used to: determine the height value of the model point corresponding to the starting point based on the three-dimensional coordinate values.
[0132] The height values corresponding to the starting points of each curve are normalized, and the normalized height values are used as the baseline progress values.
[0133] In some alternative implementations, the streaming texture module 704 includes: an original texture submodule for generating an original texture with the same size as the texture corresponding to the 3D model.
[0134] The Glow Mapping submodule is used to determine the corresponding position of each value point on the original texture based on each value point in the curve, and use the curve progress value corresponding to the value point as the value corresponding to the value position to generate a Glow Map containing the curve progress value corresponding to each value point in the curve.
[0135] In some optional implementations, the streaming rendering module 705 includes: a current effective value determination submodule, used to determine the current effective value corresponding to the current time based on the correspondence between time and effective value within a preset time period, and to determine the current curve progress value corresponding to the current effective value.
[0136] The "Effect Position Determination" submodule iterates through each value point in the flow map to determine the current effective position corresponding to the value point with the current curve progress value. The current effective position is the position corresponding to the preset flow effect at the current moment.
[0137] The rendering apparatus for flowing light effects provided in this embodiment of the invention can execute the rendering method for flowing light effects provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.
[0138] Figure 8 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0139] Referring specifically to Figure 8, a schematic diagram of a suitable electronic device for implementing embodiments of the present invention is shown below. The electronic device may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from memory 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the electronic device. The processor 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0140] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although FIG8 shows an electronic device with various devices, it should be understood that it is not required to implement or have all the devices shown, and more or fewer devices may be implemented or have alternatively.
[0141] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a memory 808, or installed from a ROM 802. When the computer program is executed by the processor 801, it performs the functions defined in the rendering method for the flowing light effect of the embodiments of the present invention.
[0142] The electronic device shown in Figure 8 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0143] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the rendering method for the flowing light effect shown in the above embodiments is implemented.
[0144] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0145] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method for rendering a flowing light effect, characterized in that, The method includes: acquiring at least one curve for rendering, the curve including multiple value points; determining the starting point of the curve and determining the relative position of each value point on the curve between the starting point and the starting point; for each value point, determining the curve progress value corresponding to the value point according to the relative position of the value point; generating a streamer map containing the curve progress values corresponding to each value point in the curve, and mapping the streamer map to a three-dimensional model; dynamically determining the effective position of a preset streamer effect in the streamer map according to the curve progress value, so as to render the preset streamer effect on the surface of the three-dimensional model.
2. The method according to claim 1, characterized in that, The step of determining the curve progress value corresponding to the value point based on the relative position of the value point includes: performing regularization processing on the length value of the curve to determine the regularized length value corresponding to the curve; and determining the curve progress value corresponding to the value point based on the regularized length value corresponding to the curve and the relative position of the value point on the curve.
3. The method according to claim 2, characterized in that, The step of regularizing the length values of the curves to determine the regularized length value corresponding to the curves includes: obtaining the length values of each curve and determining the maximum length value corresponding to each length value; determining the regularized length value corresponding to the curve based on the ratio between the length value of the curve and the maximum length value, and a preset standard value; wherein the regularized length value is positively correlated with the ratio and the preset standard value.
4. The method according to claim 2, characterized in that, The step of determining the curve progress value corresponding to the value point based on the regular length value corresponding to the curve and the relative position of the value point on the curve includes: determining the baseline progress value corresponding to the curve; and determining the curve progress value corresponding to the value point based on the regular length value and the baseline progress value corresponding to the curve and the relative position of the value point on the curve.
5. The method according to claim 4, characterized in that, The step of determining the curve progress value corresponding to a point based on the regular length value and baseline progress value of the curve, and the relative position of the point on the curve, includes: for any point on the curve, determining the initial progress value corresponding to the point based on the product between the relative position of the point and the regular length value of the curve; and adding the baseline progress value of the curve to the initial progress value corresponding to the point to obtain the curve progress value corresponding to the point.
6. The method according to claim 4, characterized in that, Determining the baseline progress value corresponding to the curve includes: determining the model point corresponding to the starting point on the three-dimensional model, and obtaining the three-dimensional coordinate value of the model point on the three-dimensional model; determining the baseline progress value corresponding to the curve based on at least one of the three-dimensional coordinate values.
7. The method according to claim 6, characterized in that, The step of determining the baseline progress value corresponding to the curve based on at least one of the three-dimensional coordinate values includes: determining the height value of the model point corresponding to the starting point based on the three-dimensional coordinate values; normalizing the height values corresponding to the starting points of each curve, and using the normalized height values as the baseline progress values.
8. The method according to claim 1, characterized in that, The step of generating a flowing light map containing curve progress values corresponding to each value point in the curve includes: generating an original texture map with the same size as the texture map corresponding to the 3D model; determining the corresponding value position on the original texture map according to each value point in the curve, and using the curve progress value corresponding to the value point as the value corresponding to the value position to generate a flowing light map containing curve progress values corresponding to each value point in the curve.
9. The method according to claim 1, characterized in that, The step of dynamically determining the effective position of the preset flowing light effect in the flowing light map based on the curve progress value includes: determining the current effective value corresponding to the current time based on the correspondence between time and effective value within a preset time period, and determining the current curve progress value corresponding to the current effective value; traversing each value point in the flowing light map to determine the current effective position corresponding to the value point with the current curve progress value; the current effective position is the effective position of the preset flowing light effect at the current moment.
10. A rendering device for a flowing light effect, characterized in that, The device includes: a curve acquisition module for acquiring at least one curve for rendering, the curve including multiple value points; a start point determination module for determining the start point of the curve and the relative position of each value point on the curve relative to the start point; a progress value determination module for determining the curve progress value corresponding to each value point based on the relative position of the value point; a streamer map module for generating a streamer map containing the curve progress values corresponding to each value point in the curve and mapping the streamer map to a 3D model; and a streamer rendering module for dynamically determining the effective position of a preset streamer effect in the streamer map based on the curve progress value, so as to render the preset streamer effect on the surface of the 3D model.
11. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the rendering method for the light-flowing effect according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to execute the rendering method of the light-flowing effect according to any one of claims 1 to 9.
13. A computer program product, characterized in that, Includes computer instructions for causing a computer to execute the rendering method for the light-flowing effect as described in any one of claims 1 to 9.