Rendering method and device of star orbit effect and electronic equipment
By acquiring and moving the positions of celestial bodies in UV space to render star trails, the problem of poor rendering performance in existing technologies is solved, resulting in smoother rendering effects.
Patent Information
- Application Number
- CN202511448126.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-10
- Publication Date
- 2026-02-17
AI Technical Summary
In existing technologies, rendering star trail effects requires multiple texture sampling, resulting in poor rendering performance and causing stuttering in the rendered screen.
The initial star position is obtained in UV space, and rendering is performed based on the initial star position. The initial star position is moved in response to the star trail effect generation command to obtain the moving star position. The star trail effect is then formed based on the initial and moving star positions.
By moving the positions of celestial bodies in UV space to render star trails, the rendering performance is improved and the smoothness of the rendered images is enhanced without the need for texture sampling.
Smart Images

Figure CN121544783A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of rendering, in particular to a star trail effect rendering method, device and electronic equipment. BACKGROUND
[0002] In related technologies, in order to render the effect of changing star bodies in the starry sky into star trails, the starry sky map needs to be sampled multiple times, and the multiple sampling results are superimposed to finally render the star trail effect. Due to the large number of samplings, the rendering performance is poor, causing the rendering picture to be stuck. SUMMARY
[0003] Therefore, the purpose of the present application is to provide a star trail effect rendering method, device and electronic equipment to improve rendering performance and thus improve the smoothness of the rendering picture.
[0004] In a first aspect, an embodiment of the present application provides a star trail effect rendering method, which comprises: obtaining an initial star body position in a UV space of a target model; rendering the target model based on the initial star body position to obtain a star body effect; in response to a star trail effect generation instruction, moving the initial star body position in the UV space to obtain a moved star body position; and rendering the target model based on the initial star body position and the moved star body position to obtain a star trail effect.
[0005] In a second aspect, an embodiment of the present application provides a star trail effect rendering device, which comprises: a position obtaining module configured to obtain an initial star body position in a UV space of a target model; a star body rendering module configured to render the target model based on the initial star body position to obtain a star body effect; a movement control module configured to move the initial star body position in the UV space to obtain a moved star body position in response to a star trail effect generation instruction; and a star trail rendering module configured to render the target model based on the initial star body position and the moved star body position to obtain a star trail effect.
[0006] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the above-mentioned star trail effect rendering method.
[0007] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores computer executable instructions, and when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to implement the above-mentioned star trail effect rendering method.
[0008] The embodiments of the present application have the following beneficial effects: The rendering method, device and electronic equipment of the star orbit effect obtain an initial star position in a UV space of a target model; render the target model based on the initial star position to obtain a star effect; in response to a star orbit effect generation instruction, control the initial star position to move in the UV space to obtain a moved star position; and render the target model based on the initial star position and the moved star position to obtain the star orbit effect. In this way, the star orbit effect is obtained by moving the position of the star effect in the UV space, so that the rendering performance is improved, and the rendering picture fluency is improved.
[0009] Additional features and advantages of the present application will be set forth in the description that follows, and in part will be apparent from the description, or can be learned by practice of the present application. The objectives and other advantages of the present application will be realized and attained by the structure particularly pointed out in the description and claims.
[0010] In order to make the above objectives, features and advantages of the present application more apparent, the following will describe a preferred embodiment, and combine with the accompanying drawings, and make a detailed description as follows. BRIEF DESCRIPTION OF DRAWINGS
[0011] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings described below are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0012] Figure 1 A flowchart of a star orbit effect rendering method provided by an embodiment of the present application; Figure 2 A schematic diagram of a star effect provided by an embodiment of the present application; Figure 3 A schematic diagram of a subspace and an offset distance provided by an embodiment of the present application; Figure 4 A schematic diagram of a subspace and the distance between each position and the space center position provided by an embodiment of the present application; Figure 5 A schematic diagram of another star effect provided by an embodiment of the present application; Figure 6 A schematic diagram of a flare effect provided by an embodiment of the present application; Figure 7 A schematic diagram of star position movement provided by an embodiment of the present application; Figure 8 A schematic diagram of a star orbit effect provided by an embodiment of the present application; Figure 9 A schematic diagram of a star trail rendering device provided in an embodiment of the present invention; Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions 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.
[0014] Star trail photography allows photographers to capture images with star trail effects. This involves increasing the camera's shutter speed to achieve long exposure intervals, resulting in multiple images of celestial bodies. These images are then combined to create a star trail image. To simulate a realistic star trail effect, a dynamic transition from celestial body rendering to star trail rendering is required. Related techniques involve sampling the star map multiple times and then overlaying the results to render the star trail effect. However, this multiple sampling of the star map incurs significant computational overhead, leading to poor rendering performance and causing stuttering in the rendered footage.
[0015] Based on this, the present invention provides a rendering method, apparatus and electronic device for a star trail effect, which can be applied to the rendering of games, virtual scenes and virtual images.
[0016] In one possible implementation, embodiments of the present invention provide a method for rendering star trail effects, such as... Figure 1 As shown, the method includes: Step S102: Obtain the initial star position in the UV space of the target model; The target model is used to render celestial and star trail effects. This target model can be a two-dimensional patch model or a three-dimensional solid model, such as a sphere or cube. UV space is typically used to map two-dimensional textures onto the surface of the target model; however, in this embodiment, it is not necessary to render celestial and star trail effects using textures. UV space is a two-dimensional space, including a horizontal dimension U and a vertical dimension V, where the horizontal dimension U ranges from 0 to 1, and the vertical dimension V also ranges from 0 to 1.
[0017] The initial star positions mentioned above include one or more. The initial star positions can be randomly selected from the UV space or selected according to preset rules; the initial star positions are used to render star effects.
[0018] Step S104: Render the target model based on the initial star position to obtain the star effect; After mapping the initial star position to the target model, the corresponding model position is obtained, and the star effect is rendered at that model position. The star effect can be referenced. Figure 2 Example, Figure 2 It includes multiple celestial effects, which are distributed in the night sky background.
[0019] In addition, when rendering celestial effects, one or more celestial parameters can be set, such as the number of stars, size, flares, color, and brightness, making the celestial effects rich and varied. The initial star positions and parameters are input into a preset rendering program, and the program renders the celestial effects.
[0020] Step S106: In response to the star trail effect generation command, the initial star position is moved in the UV space to obtain the position of the moved star. The command to generate the star trail effect can be triggered by user actions, such as touch or mouse swipes; it can also be triggered automatically by the system or by a specified event.
[0021] The initial position of the moved star is its position. To achieve a star trail effect, it can be moved multiple times along a specific direction. The initial star position and the multiple moved star positions are continuous, thus forming the star trail effect. In actual implementation, the initial star position can move along a straight line, curve, arc, etc. To simulate a realistic star trajectory, the initial star position is usually moved along an arc.
[0022] The position of a moving star is obtained by moving the initial star position. Therefore, the model position on the target model mapped from the moving star position is different from the model position mapped from the initial star position. When the initial star position and multiple moving star positions are continuous, the corresponding model positions are also continuous, thus a continuous star effect can be rendered, forming a star trail effect.
[0023] Step S108: Render the target model based on the initial star position and the moving star position to obtain a star trail effect.
[0024] In practical implementation, the target model can be overlaid and rendered in a loop. For example, the initial star position is rendered first. When no star trail effect generation command is generated, the star effect is displayed on the target model based only on the initial star position. This star effect is discrete. When the star trail effect generation command is generated, the initial star position is moved to obtain the moved star position. Then the star effect corresponding to the moved star position is rendered. The initial star position and the star effects corresponding to multiple moved star positions are continuous, thus forming a star trail effect.
[0025] The above-described star trail rendering method involves obtaining the initial star positions in the UV space of the target model; rendering the target model based on these initial star positions to obtain the star effect; responding to the star trail generation command, controlling the movement of the initial star positions in the UV space to obtain the moved star positions; and rendering the target model based on both the initial and moved star positions to obtain the star trail effect. This method achieves the star trail effect by moving the positions of the star effects in the UV space, eliminating the need for texture sampling, thus improving rendering performance and consequently enhancing the smoothness of the rendered image.
[0026] In one implementation, a star quantity parameter is obtained; wherein the star quantity parameter is used to indicate the number of star effects; the UV space is divided into subspaces corresponding to the number of spaces of the star quantity parameter; and the initial star positions are determined within the subspaces.
[0027] For example, the number of stars parameter is equal to the number of star effects, and the number of subspaces is equal to the number of stars parameter; in one example, the number of stars parameter is 100, then the UV space is divided into 100 subspaces, each subspace determines an initial star position, and each initial star position renders a star effect, for a total of 100 star effects.
[0028] For example, multiple alternative numbers of star effects can be preset. After obtaining the number of stars parameter, the alternative number that is closest to the number of stars parameter is determined as the final number of star effects. The final number of star effects is equal to the number of spaces.
[0029] The number of celestial bodies parameter can be a user-input parameter or a fixed value preset by the system. In actual implementation, the UV space can be tiled to obtain multiple subspaces. Tiling parameters need to be preset when tiling is performed. For example, when the number of spaces is 100, the tiling parameter is 10, where the U dimension is divided into 10 segments and the V dimension is divided into 10 segments, resulting in 100 subspaces.
[0030] Furthermore, based on a preset offset method, the spatial center position of the subspace is offset to obtain the initial star position. This offset method can be random offset, where the spatial center position is randomly offset for each subspace, with both the offset distance and direction being random. Alternatively, the offset direction and offset distance can be determined based on the position of the subspace in UV space.
[0031] exist Figure 3 In the example, each 'small square' represents a subspace, and there are 324 subspaces in total, each 18*18. The gray value filled in each subspace represents the offset distance of the center position in that subspace. The darker the gray value, the smaller the offset distance.
[0032] It is understandable that at least some subspaces have different offset directions and at least some subspaces have different offset distances. By dividing the space into subspaces, the initial star positions can be distributed roughly evenly, avoiding the star effects being concentrated in a small local area; by offsetting the center position of the subspace, the initial star positions can be distributed irregularly, making the rendered star effects more realistic and natural.
[0033] In one implementation, the UV space includes multiple subspaces, and the initial star position is located in the corresponding subspace; the spatial center position of the subspace where the initial star position is located is obtained; based on the distance between the initial star position and the spatial center position, the star size parameter is determined; wherein, the star size parameter is used to indicate the size of the star effect.
[0034] The size of the star effect is related to the distance between the initial star position and the center of space, thus allowing for variations in the size of the star effect. At least some star effects will have different sizes, making the star effect rendering more realistic. For example, the greater the distance between the initial star position and the center of space, the larger the star size parameter, and the larger the star effect size; conversely, the greater the distance between the initial star position and the center of space, the smaller the star size parameter, and the smaller the star effect size.
[0035] Figure 4 A subspace is shown, where the grayscale value of each location represents the distance between that location and the center of the space. The closer to the center, the lower the grayscale value, indicating that if that location is the initial star position, the smaller the size of the star effect. Specifically, the shape of the star effect can be preset, such as a circle or a rhombus. The aforementioned star size parameters can be parameters such as the area, radius, and side length of the star effect. Figure 5 Here are examples of star effects; you can see that the sizes of the star effects vary.
[0036] Furthermore, based on the distance between the initial star position and the space center position, the position offset parameter of the initial star position is determined; based on the position offset parameter, the size adjustment parameter corresponding to the initial star position is determined; based on the size adjustment parameter, the star size parameter is adjusted.
[0037] Specifically, the distance between the initial celestial position and the center of space can be preset to obtain the position offset parameter; for example, the distance can be multiplied by a decimal obtained by magnifying the distance by a specified factor to obtain the position offset parameter; other operations can also be performed on the distance to obtain the position offset parameter, such as multiplication, addition, exponentiation, squaring, or combinations of various operations.
[0038] Then, the position offset parameter is used as the interpolation weight to perform interpolation within a preset data range, resulting in an interpolation result, which is used as the aforementioned size adjustment parameter. Other operations can also be performed on the position offset parameter to obtain the size adjustment parameter, such as multiplication, addition, exponentiation, squaring, or combinations of various operations.
[0039] Finally, the specific process for adjusting the celestial body's size parameters can be as follows: the size adjustment parameter is used as an exponent, and the celestial body's size parameter is exponentially raised to obtain the adjusted celestial body's size parameters. Alternatively, other operations can be performed on the celestial body's size parameter and the size adjustment parameter, such as multiplication, addition, exponentiation, squaring, or combinations of various operations, to finally obtain the adjusted celestial body's size parameters.
[0040] The above methods can make the size of the star effects more varied. By further adjusting the star size parameters, the richness of the size variation of the star effects can be further improved, making the star effects more realistic and enhancing the visual experience of the star effects.
[0041] In one implementation, the UV space includes multiple subspaces, and the initial star position is located in the corresponding subspace; the spatial center position of the subspace where the initial star position is located is obtained; based on the relative position of the initial star position and the spatial center position, the star flare parameters are determined; wherein, the star flare parameters are used to indicate the flare effect associated with the star effect.
[0042] This flare effect simulates the glow of a star, and can be in the form of a line, a cross, or a rhombus. The relative position of the initial star to the center of space can specifically include the distance between the initial star position and the center of space in the U dimension, and the distance between the initial star position and the center of space in the V dimension. The relative position of the initial star position to the center of space can also include the direction of the initial star position relative to the center of space.
[0043] Specifically, the relative positions of the initial star position and the center of space can be preset and calculated, such as multiplication, addition, exponentiation, squaring, or combinations of various calculation methods, to obtain the star flare parameters.
[0044] The specific parameters of the stellar flare can be the size of the flare, the shape of the flare effect can be preset, and the parameters of the stellar flare effect can be parameters such as the side length and area of the flare effect. The specific flare effect can be determined by the stellar flare parameters and the shape of the flare effect.
[0045] Furthermore, the first distance between the initial celestial position and the spatial center position in the first dimension of UV space, and the second distance in the second dimension of UV space, are obtained; based on the first and second distances, the celestial flare parameters are determined. The first dimension is U dimension, and the second dimension is V dimension, or the first dimension is V dimension, and the second dimension is U dimension.
[0046] The first distance can be the absolute value of the distance between the initial star position and the center position in space in the U dimension, and the second distance can be the absolute value of the distance between the initial star position and the center position in space in the V dimension. Multiplying the first distance and the second distance yields the star flare parameters. Alternatively, other operations can be performed on the first distance and the second distance, such as addition or exponential operations, to obtain the star flare parameters.
[0047] To further enrich the flare effect, the above-mentioned stellar flare parameters include multiple parameters; each stellar flare parameter corresponds to a flare effect; based on the first distance and the second distance, the first stellar flare parameter is determined; the following steps are executed repeatedly until the number of stellar flare parameters reaches a preset threshold: control the initial stellar position to rotate around the spatial center position by a preset angle; obtain the rotated initial stellar position, the third distance between it and the spatial center position in the first dimension, and the fourth distance in the second dimension; based on the third distance and the fourth distance, determine the newly added stellar flare parameters.
[0048] Each time the loop executes, the initial celestial position rotates once. The aforementioned preset angle can be pre-set, such as 30 degrees, 45 degrees, etc. Each time the loop executes, the initial celestial position rotates from its current position by the preset angle. The third distance can be the absolute value of the distance between the rotated initial celestial position and the spatial center position in the U dimension, and the fourth distance can be the absolute value of the distance between the rotated initial celestial position and the spatial center position in the V dimension. Multiplying the third and fourth distances yields the newly added celestial flare parameters. Alternatively, other operations can be performed on the third and fourth distances, such as addition or exponential operations, to obtain the celestial flare parameters.
[0049] Each iteration of the loop adds one new stellar flare parameter. The previously mentioned first stellar flare parameter and at least one newly added stellar flare parameter together form multiple stellar flare parameters. Each stellar flare parameter corresponds to a flare effect. Since the newly added stellar flare parameters are obtained by rotating the initial stellar position, at least some of the newly added stellar flare parameters are different from the first stellar flare parameter. Therefore, the flare effects corresponding to at least some of the stellar flare parameters have different shapes and sizes. When multiple flare effects are displayed superimposed, the visual representation of the stellar and flare effects can be enriched.
[0050] By rotating the initial star position, the flare effect corresponding to the star flare parameters can be controlled to rotate. For example, after rotating the initial star position by a preset angle, the corresponding flare effect will also rotate by a preset angle. In one example, the flare effect corresponding to the first star flare parameter is a cross shape, which extends along both the horizontal and vertical directions. After rotating the initial star position by 45 degrees, the second star flare parameter is obtained, and the flare effect corresponding to the second star flare parameter is also a cross shape, which extends along the upper left and lower right directions, as well as the upper right and lower left directions. The two cross-shaped flare effects are superimposed to obtain an octagonal flare effect.
[0051] The flare effect is then overlaid to create a star effect, resulting in a star effect with flare characteristics. In actual implementation, the effect center of the flare effect overlaps with the effect center of the star effect, and multiple flare effects extend in different directions; Figure 6 The examples show star effects superimposed with flare effects, with varying sizes of star effects and different sizes and directions of flare effects.
[0052] In the above method, the flare parameters of the star are determined based on the relative position of the initial star position and the center position of space, thereby generating a flare effect, which makes the star effect have a luminous effect and improves the realism and visual richness of the star effect; furthermore, by controlling the rotation and cycle of the star position, multiple flare effects with different angles are generated, which further enriches the visual layers of the star.
[0053] In one specific implementation, the UV space includes multiple subspaces, and the initial star position is located in the corresponding subspace; the spatial center position of the subspace where the initial star position is located is obtained; based on the distance between the initial star position and the spatial center position, the star color parameters are determined; wherein, the star color parameters are used to indicate the color of the star effect.
[0054] The star color parameters control the color of the star effect, enriching its visual appeal. In practice, the initial distance between the star's position and the center of space can be preset, along with a corresponding preset color parameter. Once this distance is obtained, the corresponding color parameter, i.e., the star color parameter, can be retrieved by querying this correspondence. This preset color parameter can be an RGB color parameter, an HSV color parameter, or another type of color parameter.
[0055] Because the color parameters of celestial bodies are affected by the distance between the initial position of the celestial body and the center of space, at least some celestial bodies will appear to have different colors. For example... Figure 2 In the example, the colors of the star effects include purple, yellow, and white. The star color parameters mentioned above can also indicate the color of the flare effect, in which case the color of the flare effect is the same as the color of the star effect associated with that flare effect.
[0056] Specifically, based on the distance between the initial star position and the center of space, multiple preset reference color parameters are interpolated to obtain the star color parameters. More specifically, the distance between the initial star position and the center of space is used as the interpolation weight to interpolate the multiple reference color parameters, resulting in a transition color between the reference color parameters; this transition color is the star color parameter.
[0057] In the above method, the star color parameters are determined based on the distance between the initial star position and the center of space, so that the star effect has color and the visual richness of the star effect is improved.
[0058] In one implementation, the UV space includes multiple subspaces, and the initial star position is located in the corresponding subspace; the spatial center position of the subspace where the initial star position is located is obtained; based on the distance between the initial star position and the spatial center position, the star brightness parameter is determined; wherein, the star brightness parameter is used to indicate the brightness of the star effect.
[0059] The star brightness parameter is used to control the brightness of the star effect, making the visual effect of the star effect richer. In actual implementation, the correspondence between the initial star position and the space center position can be preset and the preset brightness parameter can be obtained. After obtaining the distance, the corresponding brightness parameter, i.e., the star brightness parameter, can be obtained by querying the correspondence.
[0060] Because the brightness parameters of a star are affected by the distance between the initial star position and the center of space, the brightness of at least some star effects will differ. These star brightness parameters can also indicate the brightness of a flare effect, in which the brightness of the flare effect is the same as the brightness of the star effect associated with that flare effect.
[0061] Furthermore, based on the distance between the initial star position and the space center position, the brightness change frequency parameter and the brightness change offset parameter are determined; wherein, the brightness change offset parameter is used to indicate the start time of the brightness change of the star effect; when there are multiple star effects, at least some of the star effects have different start times for brightness changes; based on the brightness change frequency parameter and the brightness change offset parameter, the star brightness parameter is determined.
[0062] Specifically, the distance between the initial star position and the center of space can be preset and calculated to obtain the brightness change frequency parameter. For example, the distance between the initial star position and the center of space can be magnified to a first specified multiple, the decimal is taken, and then divided by the first specified parameter to obtain the brightness change frequency parameter. Alternatively, other calculations can be performed on the distance between the initial star position and the center of space, such as multiplication, addition, exponentiation, squaring, or combinations of various calculation methods, to obtain the brightness change frequency parameter. Since the distance between the initial star position and the center of space is different for at least some subspaces, the brightness change frequency parameter of at least some star effects results in different flickering periods for at least some star effects. Some star effects flicker quickly, while others flicker slowly, making the star effects more natural and realistic.
[0063] The brightness variation offset parameter is also calculated from the distance between the initial star position and the spatial center. For example, the distance between the initial star position and the spatial center can be magnified to a second specified multiple, the decimal is taken, and then divided by the second specified parameter to obtain the brightness variation offset parameter. Alternatively, other operations can be performed on the distance between the initial star position and the spatial center, such as multiplication, addition, exponentiation, squaring, or combinations of various operations, to obtain the brightness variation offset parameter. Since the distance between the initial star position and the spatial center is different for at least some subspaces, the brightness variation offset parameter for at least some star effects ensures that the start time of the brightness change for at least some star effects is different. This prevents the star effects from simultaneously brightening or dimming during the flickering process, resulting in different flickering patterns for the star effects, making the star effects more natural and realistic.
[0064] After the aforementioned brightness change frequency parameter and brightness change offset parameter are determined, the brightness change frequency and brightness change offset parameters are calculated to obtain the star brightness parameter. Specifically, the brightness change frequency parameter can be multiplied by the current time variable, and then added to the brightness change offset parameter. The result is input into a sine function or cosine function, and then the absolute value is calculated to obtain the star brightness parameter. This star brightness parameter is then superimposed on the star color parameter to control the star effect to flicker.
[0065] In one implementation, in response to a star trail effect generation command, the direction of star movement is obtained. In UV space, the initial star position is controlled to rotate and move along the star movement direction to obtain the moved star position. This star movement direction can be included in the star trail effect generation command, which can be automatically triggered by the system or triggered by user actions, such as sliding or control-triggered operations. A rotation center for the initial star position can be preset, and the initial star position is controlled to move around this center along the aforementioned star movement direction. The star movement direction can include clockwise or counterclockwise. The line connecting the moved star position and the initial star position forms an arc-shaped star trail effect.
[0066] Specifically, a two-dimensional coordinate space is generated, which has an origin. The initial celestial positions in the UV space are mapped to the two-dimensional coordinate space to obtain the initial mapped positions. When there are multiple initial celestial positions, the relative positions between the multiple initial celestial positions and the relative positions between the multiple initial mapped positions remain unchanged. The initial mapped positions are controlled to rotate and move around the origin and along the direction of celestial movement to obtain the moved mapped positions. The moved mapped positions are then mapped back to the UV space to obtain the moved celestial positions.
[0067] The aforementioned UV space has a limited spatial range, with both the U and V dimensions ranging from 0 to 1. The aforementioned two-dimensional coordinate space, however, is larger than the UV space and is used to rotate the initial celestial positions in the UV space. After the initial celestial positions are mapped to the two-dimensional coordinate space, the initial mapped positions are located in a local region within the two-dimensional coordinate space. This local region is the same size as the UV space, and the distribution of the initial mapped positions within this local region is the same as the distribution of the initial celestial positions in the UV space.
[0068] In practical implementation, a reference point can be specified in UV space first, and a mapping point can be specified in two-dimensional coordinate space. The reference point can be any point in UV space, such as the center point or the lower left corner; the mapping point can also be any point in two-dimensional coordinate space except for the origin. The reference point in UV space is mapped to the mapping point in two-dimensional coordinate space to obtain the mapping relationship between UV space and two-dimensional coordinate space. Based on this mapping relationship, the initial position of the star in UV space is then mapped to two-dimensional coordinate space to obtain the initial mapped position.
[0069] The initial mapping position is rotated around the origin. Once the direction and distance of the celestial body's movement are determined, the final mapped position can be obtained. Figure 7In the example, the star moves in a clockwise direction, and the distance the star moves can be, for example, 500 pixels, to obtain the position of the moved star. The local area where the moved star is located has the same size as the local area where the initial mapped position is located, but the location of the area is different.
[0070] In the above method, the position of the star is moved by mapping the initial star position to a two-dimensional space, rotating and moving it, and then mapping it back to the UV space. The star position of the star effect is moved. The star trail effect can be formed by moving the star position and the initial star position. There is no need to sample the texture, which improves the rendering performance and thus improves the smoothness of the rendered picture.
[0071] Furthermore, based on the position of the moving star, the star effect corresponding to the position of the moving star is overlaid on the already rendered star effect; among them, the star effect corresponding to the initial star position and the star effect corresponding to the moving star position together form the star trail effect.
[0072] The rendered celestial effects are based on the initial celestial positions. These effects are discretely distributed, and the effects corresponding to the moving celestial positions are superimposed and located near the effects rendered at the initial positions, along the direction of the initial celestial movement. When there are many moving celestial positions, the effects corresponding to multiple moving celestial positions become continuous with the effects rendered at the initial positions, forming a star trail effect. This rendering process does not require texture sampling; it only calculates celestial positions and controls their movement to render the star trail effect, improving rendering performance and thus enhancing the smoothness of the rendered image.
[0073] In one implementation, in response to the star trail effect generation command, the distance the star moves is obtained; based on the distance the star moves, the total number of loops is determined; the steps of controlling the initial star position to move in the UV space to obtain the position of the moved star are executed repeatedly until the total number of loops is reached.
[0074] The distance the star moves can be included in the star trail effect generation command. The distance the star moves can be a preset fixed distance or a variable distance determined by the user; for example, the distance the star moves can be determined based on the sliding distance of the user's sliding operation.
[0075] Understandably, the greater the distance the celestial body moves, the more iterations are needed. Specifically, a unit distance can be set, and the quotient of the celestial body's movement distance and this unit distance can be used as the total number of iterations. Each iteration moves the initial celestial body position once, resulting in a new celestial body position. In the next iteration, the celestial body continues to move from the previous position, resulting in a new celestial body position; and so on, with the initial celestial body position and multiple new celestial body positions being consecutive.
[0076] Specifically, in response to the star trail effect generation command, the star movement speed is obtained; based on the star movement speed, the loop speed is determined; the loop speed is positively correlated with the star movement speed; according to the loop speed, the steps of controlling the initial star position to move in the UV space are executed repeatedly to obtain the position of the moved star.
[0077] The star's movement speed can be included in the star trail effect generation command. The star's movement speed can be a preset fixed speed or a variable speed determined by the user; for example, the star's movement speed can be determined based on the sliding speed of the user's sliding operation.
[0078] The faster the celestial bodies move, the faster the loop speed. Specifically, a speed-to-loop relationship can be established; based on the moving speed and this relationship, the loop speed can be uniquely determined. For example, the celestial body's moving speed equals the loop speed, or the moving speed is 1.5 times the loop speed, etc. The faster the loop speed, the faster the position of the moving celestial body is determined, the faster the celestial effects at that position are rendered, and the faster the length of the star trails changes.
[0079] Furthermore, in the step of executing the loop, the current loop count is obtained; based on the current loop count, the brightness decay parameter is determined; wherein, the brightness decay parameter is used to indicate the brightness of the star effect at the moving star position; the closer the current loop count is to the total number of loops, the greater the degree of brightness decay indicated by the brightness decay parameter.
[0080] The brightness decay parameter controls the gradual decrease in brightness of each star effect within the star trail effect, simulating the fading of stars at the end of the star trail. In practice, the higher the current loop count, the closer the generated moving star is to the end of the star trail effect, resulting in a greater degree of brightness decay indicated by the brightness decay parameter and lower star brightness. This brightness decay parameter can be superimposed on the aforementioned star brightness parameter, so that after the star trail effect is generated, the brightness decay parameter and the star brightness parameter jointly control the brightness of each star effect.
[0081] Figure 8 This is an example of a star trail effect. Figure 2 Based on the discrete star effect, after responding to the star trail effect generation command, a star trail effect is generated, which is composed of multiple consecutive star effects.
[0082] In the above method, the star trail effect is achieved by controlling the brightness attenuation parameter, making the star trail effect more realistic and improving the visual richness of the star trail effect.
[0083] In one implementation, in response to a sliding operation, the sliding direction of the sliding operation is obtained; a direction parameter is determined based on the sliding direction, and a star trail effect generation instruction containing the direction parameter is generated; wherein, the direction parameter is used to indicate the direction of movement of the star.
[0084] The sliding operation can be a touch sliding operation on the touch screen, or a mouse sliding operation; for example, if the sliding direction is to the right, the direction parameter indicates that the star moves clockwise; as another example, if the sliding direction is to the left, the direction parameter indicates that the star moves counterclockwise.
[0085] Furthermore, in response to a sliding operation, the sliding distance is obtained; based on the sliding distance, the distance the star moves is determined and carried over to the star trail effect generation command. The correspondence between the sliding distance and the star's movement distance can be preset; for example, the sliding distance can be equal to the star's movement distance, or the sliding distance can be slightly less than the star's movement distance.
[0086] Another approach involves responding to a swipe operation by obtaining the swipe speed; determining the star's movement speed based on this speed; and then incorporating this speed into the star trail effect generation command. The correspondence between the swipe speed and the star's movement speed can be pre-defined; for example, the swipe speed can be equal to or slightly less than the star's movement speed.
[0087] In the above method, users can control the generation of star trail effects through sliding operations. The direction, distance, speed and other parameters of the sliding operation control the movement direction, movement distance and movement speed of the stars, respectively. Since the star trail effect rendering performance of this embodiment is high, the star trail effect can be rendered in real time following the user's sliding operation, which improves the user's operation experience and visual experience.
[0088] The star trail rendering method provided in this embodiment can realize the process of transforming discrete star effects into star trail effects. Each initial star position corresponds to a star effect, which can generate a corresponding star trail effect. That is, the star effect and the star trail effect correspond to each other, which can realistically simulate the time-lapse photography effect of the starry sky. Moreover, this method does not require sampling textures and generates star trail effects by cyclically controlling the position movement, resulting in high rendering performance.
[0089] See Figure 9 The diagram shows a rendering apparatus for a star trail effect, the apparatus comprising: The position acquisition module 90 is used to acquire the initial position of the star in the UV space of the target model; The star rendering module 92 is used to render the target model based on the initial star position to obtain the star effect; The movement control module 94 is used to respond to the star trail effect generation command and control the initial star position to move in the UV space to obtain the position of the moving star. The star trail rendering module 96 is used to render the target model based on the initial star position and the moving star position to obtain the star trail effect.
[0090] The aforementioned star trail rendering device obtains the initial star positions in the UV space of the target model; based on the initial star positions, it renders the target model to obtain the star effect; responding to the star trail generation command, it controls the movement of the initial star positions in the UV space to obtain the moved star positions; based on the initial star positions and the moved star positions, it renders the target model to obtain the star trail effect. In this method, the star trail effect is rendered by moving the positions of the star effects in the UV space, eliminating the need for texture sampling, thus improving rendering performance and consequently enhancing the smoothness of the rendered image.
[0091] The aforementioned location acquisition module is used to: acquire the number of stars parameter; wherein the number of stars parameter is used to indicate the number of star effects; divide the UV space into subspaces corresponding to the number of spaces of the number of stars parameter; and determine the initial star positions within the subspaces.
[0092] The aforementioned position acquisition module is used to: offset the spatial center position of the subspace based on a preset offset method to obtain the initial celestial position.
[0093] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace; the aforementioned device also includes a size determination module, used to: obtain the spatial center position of the subspace where the initial star position is located; and determine the star size parameters based on the distance between the initial star position and the spatial center position; wherein, the star size parameters are used to indicate the size of the star effect.
[0094] The aforementioned device also includes a size adjustment module, used to: determine the position offset parameter of the initial star position based on the distance between the initial star position and the space center position; determine the size adjustment parameter corresponding to the initial star position based on the position offset parameter; and adjust the star size parameter based on the size adjustment parameter.
[0095] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace; the aforementioned device also includes a flare control module, used to: obtain the spatial center position of the subspace where the initial star position is located; and determine the star flare parameters based on the relative position between the initial star position and the spatial center position; wherein, the star flare parameters are used to indicate the flare effect associated with the star effect.
[0096] The aforementioned flare control module is used to: obtain the first distance between the initial star position and the space center position in the first dimension of UV space, and the second distance in the second dimension of UV space; and determine the star flare parameters based on the first distance and the second distance.
[0097] The aforementioned stellar flare parameters include multiple parameters; each stellar flare parameter corresponds to a flare effect; the aforementioned flare control module is used to: determine the first stellar flare parameter based on a first distance and a second distance; repeatedly execute the following steps until the number of stellar flare parameters reaches a preset threshold: control the initial stellar position to rotate around the spatial center position by a preset angle; obtain the rotated initial stellar position, the third distance between it and the spatial center position in the first dimension, and the fourth distance in the second dimension; determine the newly added stellar flare parameters based on the third distance and the fourth distance.
[0098] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace; the aforementioned device also includes a color determination module, used to: obtain the spatial center position of the subspace where the initial star position is located; and determine the star color parameters based on the distance between the initial star position and the spatial center position; wherein, the star color parameters are used to indicate the color of the star effect.
[0099] The aforementioned color determination module is used to: interpolate multiple preset reference color parameters based on the distance between the initial star position and the space center position to obtain the star color parameters.
[0100] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace; the aforementioned device also includes a brightness determination module, used to: obtain the spatial center position of the subspace where the initial star position is located; and determine the star brightness parameter based on the distance between the initial star position and the spatial center position; wherein, the star brightness parameter is used to indicate the brightness of the star effect.
[0101] The aforementioned brightness determination module is used to: determine the brightness change frequency parameter and the brightness change offset parameter based on the distance between the initial star position and the space center position; wherein, the brightness change offset parameter is used to indicate the start time of the brightness change of the star effect; when there are multiple star effects, at least some of the star effects have different start times for brightness change; and determine the star brightness parameter based on the brightness change frequency parameter and the brightness change offset parameter.
[0102] The aforementioned movement control module is used to: respond to the star trail effect generation command, obtain the star movement direction; and in the UV space, control the initial star position to rotate and move along the star movement direction to obtain the position of the moving star.
[0103] The aforementioned motion control module is used to: generate a two-dimensional coordinate space; wherein the two-dimensional coordinate space has an origin; map the initial star position in the UV space to the two-dimensional coordinate space to obtain an initial mapped position; wherein, when there are multiple initial star positions, the relative positions between the multiple initial star positions and the relative positions between the multiple initial mapped positions remain unchanged; control the initial mapped position to rotate and move around the origin and along the direction of star movement to obtain a motion mapped position; and map the motion mapped position in reverse to the UV space to obtain the motion star position.
[0104] The aforementioned star trail rendering module is used to: based on the position of the moving star, overlay the star effect corresponding to the position of the moving star on the basis of the already rendered star effect; wherein, the star effect corresponding to the initial position of the star and the star effect corresponding to the position of the moving star constitute the star trail effect.
[0105] The aforementioned device also includes a loop control module, used to: obtain the distance the star moves in response to the star trail effect generation command; determine the total number of loops based on the distance the star moves; and repeatedly execute the steps of controlling the initial star position to move in the UV space to obtain the position of the moved star, until the total number of loops is reached.
[0106] The aforementioned loop control module is used to: respond to the star trail effect generation command and obtain the star's movement speed; determine the loop speed based on the star's movement speed; wherein the loop speed is positively correlated with the star's movement speed; and repeatedly execute the steps of controlling the initial star position to move in the UV space according to the loop speed to obtain the position of the moved star.
[0107] The aforementioned device also includes an attenuation control module, used to: obtain the current number of cycles; determine a brightness attenuation parameter based on the current number of cycles; wherein, the brightness attenuation parameter is used to indicate the brightness of the star effect at the position of the moving star; the closer the current number of cycles is to the total number of cycles, the greater the degree of brightness attenuation indicated by the brightness attenuation parameter.
[0108] The aforementioned device further includes a direction determination module, used to: in response to a sliding operation, obtain the sliding direction of the sliding operation; determine direction parameters based on the sliding direction, and generate a star trail effect generation instruction containing the direction parameters; wherein, the direction parameters are used to indicate the direction of star movement.
[0109] The aforementioned device also includes a distance determination module, used to: in response to a sliding operation, obtain the sliding distance of the sliding operation; determine the movement distance of the star based on the sliding distance, and carry the movement distance of the star into the star trail effect generation instruction.
[0110] The aforementioned device also includes a speed determination module, used to: obtain the sliding speed of the sliding operation in response to the sliding operation; determine the star's movement speed based on the sliding speed; and carry the star's movement speed into the star trail effect generation command.
[0111] This embodiment also provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor. The processor executes the computer-executable instructions to implement the above-described star trail effect rendering method. This electronic device can be a server or a terminal device.
[0112] See Figure 10 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores computer-executable instructions that can be executed by the processor 100. The processor 100 executes the computer-executable instructions to implement the rendering method of the star trail effect described above.
[0113] Furthermore, Figure 10 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0114] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0115] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0116] The processor in the aforementioned electronic device, by executing computer-executable instructions, can perform the following operations in the rendering method for the aforementioned star trail effect: The above-mentioned star trail effect rendering method includes: obtaining the initial star position in the UV space of the target model; rendering the target model based on the initial star position to obtain the star effect; responding to the star trail effect generation command, controlling the initial star position to move in the UV space to obtain the moved star position; and rendering the target model based on the initial star position and the moved star position to obtain the star trail effect.
[0117] The steps described above for obtaining the initial star positions in the UV space of the target model include: obtaining the star quantity parameter; wherein the star quantity parameter is used to indicate the number of star effects; dividing the UV space into subspaces corresponding to the number of spaces of the star quantity parameter; and determining the initial star positions within the subspaces.
[0118] The steps for determining the initial position of a star within the subspace include: offsetting the spatial center position of the subspace based on a preset offset method to obtain the initial position of the star.
[0119] The UV space mentioned above includes multiple subspaces, and the initial star position is located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star size parameter based on the distance between the initial star position and the spatial center position; wherein, the star size parameter is used to indicate the size of the star effect.
[0120] Following the steps of determining the star size parameters based on the distance between the initial star position and the space center position, the method further includes: determining the position offset parameter of the initial star position based on the distance between the initial star position and the space center position; determining the size adjustment parameter corresponding to the initial star position based on the position offset parameter; and adjusting the star size parameters based on the size adjustment parameter.
[0121] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star flare parameters based on the relative position between the initial star position and the spatial center position; wherein, the star flare parameters are used to indicate the flare effect associated with the star effect.
[0122] The steps for determining the stellar flare parameters based on the relative positions of the initial stellar position and the spatial center position include: obtaining a first distance between the initial stellar position and the spatial center position in a first dimension of UV space, and a second distance in a second dimension of UV space; and determining the stellar flare parameters based on the first distance and the second distance.
[0123] The aforementioned stellar flare parameters include multiple parameters; each stellar flare parameter corresponds to a flare effect; the steps for determining stellar flare parameters based on a first distance and a second distance include: determining the first stellar flare parameter based on the first distance and the second distance; repeatedly executing the following steps until the number of stellar flare parameters reaches a preset threshold: controlling the initial stellar position to rotate around the spatial center position by a preset angle; obtaining the rotated initial stellar position, the third distance between it and the spatial center position in the first dimension, and the fourth distance in the second dimension; determining the newly added stellar flare parameters based on the third distance and the fourth distance.
[0124] The UV space mentioned above includes multiple subspaces, and the initial star position is located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star color parameter based on the distance between the initial star position and the spatial center position; wherein, the star color parameter is used to indicate the color of the star effect.
[0125] The steps for determining the star color parameters based on the distance between the initial star position and the space center position include: interpolating multiple preset reference color parameters based on the distance between the initial star position and the space center position to obtain the star color parameters.
[0126] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star brightness parameter based on the distance between the initial star position and the spatial center position; wherein, the star brightness parameter is used to indicate the brightness of the star effect.
[0127] The steps for determining the star brightness parameters based on the distance between the initial star position and the center of space include: determining a brightness change frequency parameter and a brightness change offset parameter based on the distance between the initial star position and the center of space; wherein, the brightness change offset parameter is used to indicate the start time of the brightness change of the star effect; when there are multiple star effects, at least some of the star effects have different start times for brightness changes; and determining the star brightness parameters based on the brightness change frequency parameter and the brightness change offset parameter.
[0128] The steps described above, which respond to the star trail effect generation command and control the initial star position to move in the UV space to obtain the moved star position, include: responding to the star trail effect generation command and obtaining the star movement direction; and controlling the initial star position to rotate and move along the star movement direction in the UV space to obtain the moved star position.
[0129] The steps described above, which involve controlling the initial star position to rotate and move along the star's direction of movement in the UV space to obtain the moved star position, include: generating a two-dimensional coordinate space; wherein the two-dimensional coordinate space has an origin; mapping the initial star position in the UV space to the two-dimensional coordinate space to obtain an initial mapped position; wherein, when there are multiple initial star positions, the relative positions between the multiple initial star positions and the relative positions between the multiple initial mapped positions remain unchanged; controlling the initial mapped position to rotate and move around the origin along the star's direction of movement to obtain the moved mapped position; and mapping the moved mapped position in reverse to the UV space to obtain the moved star position.
[0130] The steps described above for rendering the target model based on the initial star position and the moving star position to obtain the star trail effect include: based on the moving star position, overlaying the star effect corresponding to the moving star position on the already rendered star effect; wherein, the star effect corresponding to the initial star position and the star effect corresponding to the moving star position constitute the star trail effect.
[0131] The above method also includes: responding to the star trail effect generation command to obtain the distance the star moves; determining the total number of loops based on the distance the star moves; and repeatedly executing the step of controlling the initial star position to move in the UV space to obtain the position of the moved star, until the total number of loops is reached.
[0132] The above-mentioned steps, which involve cyclically executing the movement of the initial star position in the UV space to obtain the position of the moved star, include: obtaining the star movement speed in response to the star trail effect generation command; determining the loop speed based on the star movement speed; wherein the loop speed is positively correlated with the star movement speed; and cyclically executing the steps of controlling the movement of the initial star position in the UV space to obtain the position of the moved star according to the loop speed.
[0133] Before the step of controlling the initial star position to move in the UV space and obtaining the position of the moved star, the method further includes: obtaining the current loop count; determining the brightness attenuation parameter based on the current loop count; wherein, the brightness attenuation parameter is used to indicate the brightness of the star effect at the moved star position; the closer the current loop count is to the total number of loops, the greater the degree of brightness attenuation indicated by the brightness attenuation parameter.
[0134] Before the step of obtaining the direction of star movement in response to the star trail effect generation command, the method further includes: obtaining the sliding direction of the sliding operation in response to the sliding operation; determining the direction parameter based on the sliding direction, and generating a star trail effect generation command containing the direction parameter; wherein the direction parameter is used to indicate the direction of star movement.
[0135] The above method also includes: in response to a sliding operation, obtaining the sliding distance of the sliding operation; determining the movement distance of the star based on the sliding distance, and carrying the movement distance of the star into the star trail effect generation command.
[0136] The above method also includes: in response to a sliding operation, obtaining the sliding speed of the sliding operation; determining the star's movement speed based on the sliding speed, and carrying the star's movement speed into the star trail effect generation command.
[0137] In the above method, the star trail effect is obtained by moving the position of the star in the UV space, without the need for texture sampling, which improves rendering performance and thus improves the smoothness of the rendered image.
[0138] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the above-mentioned star trail effect rendering method.
[0139] The computer-executable instructions stored in the aforementioned computer-readable storage medium, by executing the aforementioned computer-executable instructions, can realize the following operations in the rendering method of the star trail effect: The above-mentioned star trail effect rendering method includes: obtaining the initial star position in the UV space of the target model; rendering the target model based on the initial star position to obtain the star effect; responding to the star trail effect generation command, controlling the initial star position to move in the UV space to obtain the moved star position; and rendering the target model based on the initial star position and the moved star position to obtain the star trail effect.
[0140] The steps described above for obtaining the initial star positions in the UV space of the target model include: obtaining the star quantity parameter; wherein the star quantity parameter is used to indicate the number of star effects; dividing the UV space into subspaces corresponding to the number of spaces of the star quantity parameter; and determining the initial star positions within the subspaces.
[0141] The steps for determining the initial position of a star within the subspace include: offsetting the spatial center position of the subspace based on a preset offset method to obtain the initial position of the star.
[0142] The UV space mentioned above includes multiple subspaces, and the initial star position is located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star size parameter based on the distance between the initial star position and the spatial center position; wherein, the star size parameter is used to indicate the size of the star effect.
[0143] Following the steps of determining the star size parameters based on the distance between the initial star position and the space center position, the method further includes: determining the position offset parameter of the initial star position based on the distance between the initial star position and the space center position; determining the size adjustment parameter corresponding to the initial star position based on the position offset parameter; and adjusting the star size parameters based on the size adjustment parameter.
[0144] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star flare parameters based on the relative position between the initial star position and the spatial center position; wherein, the star flare parameters are used to indicate the flare effect associated with the star effect.
[0145] The steps for determining the stellar flare parameters based on the relative positions of the initial stellar position and the spatial center position include: obtaining a first distance between the initial stellar position and the spatial center position in a first dimension of UV space, and a second distance in a second dimension of UV space; and determining the stellar flare parameters based on the first distance and the second distance.
[0146] The aforementioned stellar flare parameters include multiple parameters; each stellar flare parameter corresponds to a flare effect; the steps for determining stellar flare parameters based on a first distance and a second distance include: determining the first stellar flare parameter based on the first distance and the second distance; repeatedly executing the following steps until the number of stellar flare parameters reaches a preset threshold: controlling the initial stellar position to rotate around the spatial center position by a preset angle; obtaining the rotated initial stellar position, the third distance between it and the spatial center position in the first dimension, and the fourth distance in the second dimension; determining the newly added stellar flare parameters based on the third distance and the fourth distance.
[0147] The UV space mentioned above includes multiple subspaces, and the initial star position is located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star color parameter based on the distance between the initial star position and the spatial center position; wherein, the star color parameter is used to indicate the color of the star effect.
[0148] The steps for determining the star color parameters based on the distance between the initial star position and the space center position include: interpolating multiple preset reference color parameters based on the distance between the initial star position and the space center position to obtain the star color parameters.
[0149] The aforementioned UV space includes multiple subspaces, with the initial star position located in the corresponding subspace. Before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: obtaining the spatial center position of the subspace where the initial star position is located; determining the star brightness parameter based on the distance between the initial star position and the spatial center position; wherein, the star brightness parameter is used to indicate the brightness of the star effect.
[0150] The steps for determining the star brightness parameters based on the distance between the initial star position and the center of space include: determining a brightness change frequency parameter and a brightness change offset parameter based on the distance between the initial star position and the center of space; wherein, the brightness change offset parameter is used to indicate the start time of the brightness change of the star effect; when there are multiple star effects, at least some of the star effects have different start times for brightness changes; and determining the star brightness parameters based on the brightness change frequency parameter and the brightness change offset parameter.
[0151] The steps described above, which respond to the star trail effect generation command and control the initial star position to move in the UV space to obtain the moved star position, include: responding to the star trail effect generation command and obtaining the star movement direction; and controlling the initial star position to rotate and move along the star movement direction in the UV space to obtain the moved star position.
[0152] The steps described above, which involve controlling the initial star position to rotate and move along the star's direction of movement in the UV space to obtain the moved star position, include: generating a two-dimensional coordinate space; wherein the two-dimensional coordinate space has an origin; mapping the initial star position in the UV space to the two-dimensional coordinate space to obtain an initial mapped position; wherein, when there are multiple initial star positions, the relative positions between the multiple initial star positions and the relative positions between the multiple initial mapped positions remain unchanged; controlling the initial mapped position to rotate and move around the origin along the star's direction of movement to obtain the moved mapped position; and mapping the moved mapped position in reverse to the UV space to obtain the moved star position.
[0153] The steps described above for rendering the target model based on the initial star position and the moving star position to obtain the star trail effect include: based on the moving star position, overlaying the star effect corresponding to the moving star position on the already rendered star effect; wherein, the star effect corresponding to the initial star position and the star effect corresponding to the moving star position constitute the star trail effect.
[0154] The above method also includes: responding to the star trail effect generation command to obtain the distance the star moves; determining the total number of loops based on the distance the star moves; and repeatedly executing the step of controlling the initial star position to move in the UV space to obtain the position of the moved star, until the total number of loops is reached.
[0155] The above-mentioned steps, which involve cyclically executing the movement of the initial star position in the UV space to obtain the position of the moved star, include: obtaining the star movement speed in response to the star trail effect generation command; determining the loop speed based on the star movement speed; wherein the loop speed is positively correlated with the star movement speed; and cyclically executing the steps of controlling the movement of the initial star position in the UV space to obtain the position of the moved star according to the loop speed.
[0156] Before the step of controlling the initial star position to move in the UV space and obtaining the position of the moved star, the method further includes: obtaining the current loop count; determining the brightness attenuation parameter based on the current loop count; wherein, the brightness attenuation parameter is used to indicate the brightness of the star effect at the moved star position; the closer the current loop count is to the total number of loops, the greater the degree of brightness attenuation indicated by the brightness attenuation parameter.
[0157] Before the step of obtaining the direction of star movement in response to the star trail effect generation command, the method further includes: obtaining the sliding direction of the sliding operation in response to the sliding operation; determining the direction parameter based on the sliding direction, and generating a star trail effect generation command containing the direction parameter; wherein the direction parameter is used to indicate the direction of star movement.
[0158] The above method also includes: in response to a sliding operation, obtaining the sliding distance of the sliding operation; determining the movement distance of the star based on the sliding distance, and carrying the movement distance of the star into the star trail effect generation command.
[0159] The above method also includes: in response to a sliding operation, obtaining the sliding speed of the sliding operation; determining the star's movement speed based on the sliding speed, and carrying the star's movement speed into the star trail effect generation command.
[0160] In the above method, the star trail effect is obtained by moving the position of the star in the UV space, without the need for texture sampling, which improves rendering performance and thus improves the smoothness of the rendered image.
[0161] The computer program product of the star trail effect rendering method, apparatus and electronic device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0162] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0163] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0164] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0165] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0166] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for rendering star trail effects, characterized in that, The method includes: In the UV space of the target model, obtain the initial positions of the stars; Based on the initial star position, the target model is rendered to obtain the star effect; In response to the star trail effect generation command, the initial star position is moved in the UV space to obtain the position of the moved star; Based on the initial star position and the moving star position, the target model is rendered to obtain a star trail effect.
2. The method according to claim 1, characterized in that, The steps for obtaining the initial celestial positions in the UV space of the target model include: Obtain the number of celestial bodies parameter; wherein, the number of celestial bodies parameter is used to indicate the number of celestial body effects; The UV space is divided into subspaces corresponding to the number of stars as specified in the star count parameter. Determine the initial celestial position within the subspace.
3. The method according to claim 2, characterized in that, The steps for determining the initial celestial position within the subspace include: Based on a preset offset method, the spatial center position of the subspace is offset to obtain the initial star position.
4. The method according to claim 1, characterized in that, The UV space includes multiple subspaces, and the initial star position is located in a corresponding subspace; before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: Obtain the spatial center position of the subspace containing the initial celestial position; Based on the distance between the initial star position and the space center position, the star size parameters are determined; wherein, the star size parameters are used to indicate the size of the star effect.
5. The method according to claim 4, characterized in that, After determining the celestial body size parameters based on the distance between the initial celestial body position and the space center position, the method further includes: Based on the distance between the initial celestial position and the space center position, determine the position offset parameter of the initial celestial position; Based on the position offset parameter, determine the size adjustment parameter corresponding to the initial celestial position; based on the size adjustment parameter, adjust the celestial size parameter.
6. The method according to claim 1, characterized in that, The UV space includes multiple subspaces, and the initial star position is located in a corresponding subspace; before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: Obtain the spatial center position of the subspace containing the initial celestial position; Based on the relative position of the initial star position and the spatial center position, star flare parameters are determined; wherein, the star flare parameters are used to indicate the flare effect associated with the star effect.
7. The method according to claim 6, characterized in that, The step of determining the parameters of a stellar flare based on the relative position of the initial celestial body and the position of the space center includes: Obtain the first distance between the initial celestial position and the spatial center position in the first dimension of the UV space, and the second distance in the second dimension of the UV space; Based on the first distance and the second distance, the parameters of the stellar flare are determined.
8. The method according to claim 7, characterized in that, The star flare parameters include multiple parameters; each star flare parameter corresponds to a flare effect; the step of determining the star flare parameters based on the first distance and the second distance includes: Based on the first distance and the second distance, determine the parameters of the first stellar flare; Repeat the following steps until the star flare parameters reach a preset threshold number: Control the initial celestial position to rotate around the space center position by a preset angle; Obtain the rotated initial celestial position, the third distance between it and the spatial center position in the first dimension, and the fourth distance in the second dimension; Based on the third and fourth distances, the parameters of the newly added stellar flare are determined.
9. The method according to claim 1, characterized in that, The UV space includes multiple subspaces, and the initial star position is located in a corresponding subspace; before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: Obtain the spatial center position of the subspace containing the initial celestial position; Based on the distance between the initial star position and the space center position, the star color parameters are determined; wherein, the star color parameters are used to indicate the color of the star effect.
10. The method according to claim 9, characterized in that, The step of determining the star's color parameters based on the distance between the initial star position and the space center position includes: Based on the distance between the initial star position and the space center position, multiple preset reference color parameters are interpolated to obtain the star color parameters.
11. The method according to claim 1, characterized in that, The UV space includes multiple subspaces, and the initial star position is located in a corresponding subspace; before the step of rendering the target model based on the initial star position to obtain the star effect, the method further includes: Obtain the spatial center position of the subspace containing the initial celestial position; Based on the distance between the initial star position and the space center position, a star brightness parameter is determined; wherein, the star brightness parameter is used to indicate the brightness of the star effect.
12. The method according to claim 11, characterized in that, The step of determining the star brightness parameters based on the distance between the initial star position and the space center position includes: Based on the distance between the initial star position and the space center position, a brightness change frequency parameter and a brightness change offset parameter are determined; wherein, the brightness change offset parameter is used to indicate the start time of the brightness change of the star effect; when the star effect includes multiple star effects, at least some of the star effects have different start times for brightness changes; The star's brightness parameters are determined based on the brightness change frequency parameter and the brightness change offset parameter.
13. The method according to claim 1, characterized in that, In response to the star trail effect generation command, the step of controlling the initial star position to move within the UV space to obtain the moved star position includes: In response to the star trail effect generation command, obtain the direction of star movement; In the UV space, the initial star position is controlled to rotate and move along the star's movement direction to obtain the moving star position.
14. The method according to claim 13, characterized in that, In the UV space, the step of controlling the initial celestial position to rotate and move along the direction of celestial movement to obtain the position of the moved celestial body includes: A two-dimensional coordinate space is generated; wherein the two-dimensional coordinate space has an origin; The initial star position in the UV space is mapped to the two-dimensional coordinate space to obtain the initial mapped position; wherein, when there are multiple initial star positions, the relative positions between the multiple initial star positions and the relative positions between the multiple initial mapped positions remain unchanged; The initial mapping position is controlled to rotate and move around the origin of the coordinate system and along the direction of the celestial body's movement to obtain the moving mapping position; The position of the moving celestial body is obtained by reverse mapping the moving mapping position to the UV space.
15. The method according to claim 1, characterized in that, The steps for rendering the target model based on the initial star position and the moving star position to obtain a star trail effect include: Based on the position of the moving celestial body, a celestial effect corresponding to the position of the moving celestial body is superimposed on the already rendered celestial effect; wherein, the celestial effect corresponding to the initial celestial body position and the celestial effect corresponding to the moving celestial body position together form a star trail effect.
16. The method according to claim 1, characterized in that, The method further includes: In response to the star trail effect generation command, obtain the distance the stars have moved; The total number of cycles is determined based on the distance the celestial body has moved. The process of repeatedly controlling the initial position of the star in the UV space to move the position of the moved star is repeated until the total number of iterations is reached.
17. The method according to claim 16, characterized in that, The steps of repeatedly executing the movement of the initial celestial body position within the UV space to obtain the moved celestial body position include: In response to the star trail effect generation command, obtain the movement speed of the stars; Based on the celestial body's movement speed, the circulation speed is determined; wherein, the circulation speed is positively correlated with the celestial body's movement speed; The steps of controlling the initial celestial position to move within the UV space are executed repeatedly at the specified cycle speed to obtain the position of the moved celestial body.
18. The method according to claim 16, characterized in that, Before the step of repeatedly executing the movement of the initial celestial body position within the UV space to obtain the moved celestial body position, the method further includes: Get the current loop count; Based on the current number of cycles, a brightness attenuation parameter is determined; wherein, the brightness attenuation parameter is used to indicate the brightness of the star effect at the position of the moving star; the closer the current number of cycles is to the total number of cycles, the greater the degree of brightness attenuation indicated by the brightness attenuation parameter.
19. The method according to claim 13, characterized in that, Before the step of obtaining the direction of celestial movement in response to the star trail effect generation command, the method further includes: In response to a sliding operation, the sliding direction of the sliding operation is obtained; Based on the sliding direction, a direction parameter is determined, and a star trail effect generation instruction containing the direction parameter is generated; wherein, the direction parameter is used to indicate the direction of movement of the star.
20. The method according to claim 19, characterized in that, The method further includes: In response to a sliding operation, the sliding distance of the sliding operation is obtained; The distance the star moves is determined based on the sliding distance, and the distance the star moves is carried into the star trail effect generation instruction.
21. The method according to claim 19, characterized in that, The method further includes: In response to a sliding operation, the sliding speed of the sliding operation is obtained; The celestial body's movement speed is determined based on the sliding speed, and this movement speed is then incorporated into the star trail effect generation command.
22. A rendering device for star trail effects, characterized in that, The device includes: The position acquisition module is used to obtain the initial celestial positions in the UV space of the target model; The star rendering module is used to render the target model based on the initial star position to obtain the star effect; The movement control module is used to respond to the star trail effect generation command and control the initial star position to move in the UV space to obtain the moving star position; The star trail rendering module is used to render the target model based on the initial star position and the moving star position to obtain a star trail effect.
23. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the star trail effect rendering method according to any one of claims 1-21.
24. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the rendering method for the star trail effect as described in any one of claims 1-21.