Celestial body rendering method and device, computer program product and electronic equipment
By rendering celestial bodies using a method that determines the observation position and matrix based on the celestial body's rotation, the problems of vertex redundancy and low efficiency in existing technologies are solved, and real-time stereoscopic celestial body rendering is achieved, which is applicable to a variety of celestial bodies.
Patent Information
- Application Number
- CN202511093132.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-05
- Publication Date
- 2025-11-21
AI Technical Summary
Existing technologies suffer from problems when rendering 3D celestial bodies, such as redundant model vertices leading to GPU overload, inability to observe celestial body changes in real time resulting in a lack of stereoscopic effect, and inefficiency due to the non-universal nature of sequence frame images.
By determining the observation position and reference vector based on the rotation of celestial bodies, an observation matrix is generated, a celestial body model is constructed, and a probe beam is emitted to determine the intersection point. Based on the intersection point, a preset celestial body texture map is sampled and rendered, thus avoiding the construction of a celestial body mesh model.
It enables real-time observation of celestial bodies from different angles, improves rendering efficiency and enhances the sense of depth, and can be reused in any celestial body, solving the vertex redundancy problem.
Smart Images

Figure CN120997361A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a celestial rendering method and apparatus, computer program products, and electronic devices. Background Technology
[0002] When rendering a large number of dynamic 3D celestial bodies in the game's UI, it is necessary to not only reproduce the movement and effects of the 3D celestial bodies in the three-dimensional scene, but also to include the dynamic interaction between the celestial bodies and sunlight.
[0003] In related technologies, there are three approaches to rendering celestial bodies. Approach 1 involves constructing a celestial mesh model within the UI and using various textures for auxiliary rendering. Approach 2 directly outputs static celestial images to the UI. Approach 3 uses a sequence of frame images to simulate 3D celestial motion, depicting different motion states of the celestial body in each image and playing them sequentially to create a dynamic celestial motion sequence.
[0004] However, Option 1 suffers from model vertex redundancy when displayed in the UI, leading to GPU overload when multiple celestial bodies move synchronously. Option 2 cannot observe celestial changes in real time and lacks a sense of depth. Option 3 requires a large number of images, and the sequence frames for each celestial body are not interchangeable, resulting in low efficiency when rendering a large number of celestial bodies. Summary of the Invention
[0005] This disclosure provides a method for rendering celestial bodies, which at least partially solves the problems of low stereoscopic effect, redundant vertices, and low versatility in celestial body rendering in related technologies.
[0006] According to a first aspect of this disclosure, a method for rendering celestial bodies is provided, the method comprising:
[0007] Based on the rotation of celestial bodies, determine the current longitude and latitude, and based on the current longitude and latitude, obtain the observation position;
[0008] A reference vector is determined based on the observation location and the center of the celestial body, and an observation matrix corresponding to the observation location is generated based on the reference vector.
[0009] Construct a celestial model, and based on the observation position and the observation matrix, send a probe beam to the celestial model to obtain the intersection point with the celestial model, and determine the target longitude and target latitude corresponding to the intersection point;
[0010] Based on the target longitude and the target latitude, a preset celestial texture map is sampled to obtain the sampling result. The celestial model is then rendered based on the sampling result to obtain the target celestial body.
[0011] According to a second aspect of this disclosure, a celestial rendering apparatus is provided, the apparatus comprising:
[0012] The observation location determination module is used to determine the current longitude and latitude based on the rotation of celestial bodies, and to obtain the observation location based on the current longitude and latitude.
[0013] An observation matrix generation module is used to determine a reference vector based on the observation location and the center of the celestial body, and to generate an observation matrix corresponding to the observation location based on the reference vector.
[0014] The intersection point determination module is used to construct a celestial model, and based on the observation position and the observation matrix, to emit a probe beam to the celestial model to obtain the intersection point with the celestial model, and to determine the target longitude and target latitude corresponding to the intersection point;
[0015] The celestial body rendering module is used to sample a preset celestial body texture map based on the target longitude and the target latitude, obtain the sampling result, and render the celestial body model according to the sampling result to obtain the target celestial body.
[0016] According to a third aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method of the first aspect described above and possible implementations thereof.
[0017] According to a fourth aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of the first aspect and possible implementations thereof by executing the executable instructions.
[0018] This disclosure provides a celestial body rendering method, which involves determining the current longitude and latitude based on the rotation of a celestial body, obtaining an observation position based on the current longitude and latitude, determining a reference vector based on the observation position and the center of the celestial body, generating an observation matrix corresponding to the observation position based on the reference vector, constructing a celestial body model, emitting a probe beam to the celestial body model based on the observation position and the observation matrix to obtain the intersection point with the celestial body model, determining the target longitude and target latitude corresponding to the intersection point, sampling a preset celestial body texture map based on the target longitude and target latitude to obtain the sampling result, and rendering the celestial body model based on the sampling result to obtain the target celestial body. On the one hand, based on the rotation of celestial bodies, the current longitude and latitude are determined. Based on these, the observation position is obtained, and the camera's trajectory can be determined, simulating the effect of observing celestial bodies from different angles in real time. On the other hand, after obtaining the observation position, an observation matrix is determined. This matrix converts all observation positions in a plane into three-dimensional space. Based on this matrix and the observation position, a probe beam is emitted towards the celestial model, and the intersection point between the probe beam and the celestial model is determined. Based on the intersection point, a preset celestial texture map is sampled. This eliminates the need to construct a celestial mesh model, solving the vertex redundancy problem in related technologies and improving the efficiency of celestial model rendering. Furthermore, this celestial rendering method can be used on any celestial body, demonstrating strong reusability. Attached Figure Description
[0019] Figure 1 A flowchart of a celestial body rendering method is shown in this exemplary embodiment;
[0020] Figure 2 This exemplary embodiment shows a flowchart of a method for determining the current longitude and latitude based on the rotation of a celestial body;
[0021] Figure 3 A flowchart illustrating a method for obtaining an observation location based on the current longitude and the current latitude in this exemplary embodiment is shown.
[0022] Figure 4 This exemplary embodiment shows a method for determining a reference vector based on the observation location and the center of the celestial body, and generating an observation matrix corresponding to the observation location based on the reference vector.
[0023] Figure 5 This example embodiment shows a method flowchart for transmitting a probe beam to the celestial model based on the observation location and the observation matrix to obtain the intersection point with the celestial model;
[0024] Figure 6 A flowchart illustrating a method in this example embodiment for sending a probe beam to the celestial model to determine the intersection point with the celestial model;
[0025] Figure 7 This example embodiment shows a flowchart of a method for determining the target latitude corresponding to the intersection point;
[0026] Figure 8 This example embodiment shows a flowchart of a method for determining the target longitude corresponding to the intersection point;
[0027] Figure 9 This example implementation shows a flowchart of a celestial body rendering method after obtaining the target celestial body;
[0028] Figure 10 A block diagram of a celestial rendering apparatus is shown in this exemplary embodiment;
[0029] Figure 11 A schematic diagram of the structure of an electronic device in this exemplary embodiment is shown. Detailed Implementation
[0030] Exemplary embodiments of this disclosure will be described more fully below with reference to the accompanying drawings.
[0031] The accompanying drawings are schematic illustrations of this disclosure and are not necessarily drawn to scale. Some block diagrams shown in the drawings may be functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in hardware modules or integrated circuits, or in networks, processors, or microcontrollers. Implementations can be carried out in various forms and should not be construed as limited to the examples set forth herein. The features, structures, or characteristics described in this disclosure can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough description of embodiments of this disclosure. However, those skilled in the art will recognize that one or more specific details may be omitted when implementing the technical solutions of this disclosure, or other methods, components, apparatuses, steps, etc., may be used to replace one or more specific details.
[0032] When rendering a large number of dynamic 3D celestial bodies in the game's UI, it is necessary to not only reproduce the movement and effects of the 3D celestial bodies in the three-dimensional scene, but also to include the dynamic interaction between the celestial bodies and sunlight.
[0033] In related technologies, there are three approaches to rendering celestial bodies. Approach 1 involves constructing a celestial mesh model within the UI and using various textures for auxiliary rendering. Approach 2 directly outputs static celestial images to the UI. Approach 3 uses a sequence of frame images to simulate 3D celestial motion, depicting different motion states of the celestial body in each image and playing them sequentially to create a dynamic celestial motion sequence.
[0034] However, Option 1 suffers from model vertex redundancy when displayed in the UI, leading to GPU overload when multiple celestial bodies move synchronously. Option 2 cannot observe celestial changes in real time and lacks a sense of depth. Option 3 requires a large number of images, and the sequence frames for each celestial body are not interchangeable, resulting in low efficiency when rendering a large number of celestial bodies.
[0035] In view of the above problems, an exemplary embodiment of this disclosure provides a method for rendering celestial bodies. (See reference...) Figure 1 As shown, the celestial body rendering method may include the following steps:
[0036] Step S110. Determine the current longitude and latitude based on the rotation of the celestial body, and obtain the observation position based on the current longitude and latitude;
[0037] Step S120. Determine a reference vector based on the observation location and the center of the celestial body, and generate an observation matrix corresponding to the observation location based on the reference vector;
[0038] Step S130. Construct a celestial model, and based on the observation position and the observation matrix, send a probe beam to the celestial model to obtain the intersection point with the celestial model, and determine the target longitude and target latitude corresponding to the intersection point;
[0039] Step S140. Sample the preset celestial texture map based on the target longitude and the target latitude to obtain the sampling result, and render the celestial model according to the sampling result to obtain the target celestial body.
[0040] In the above-described celestial body rendering method, the current longitude and latitude are determined based on the rotation of the celestial body, and the observation position is obtained based on the current longitude and latitude. A reference vector is determined based on the observation position and the center of the celestial body, and an observation matrix corresponding to the observation position is generated based on the reference vector. A celestial body model is constructed, and a probe beam is emitted towards the celestial body model based on the observation position and the observation matrix to obtain the intersection point with the celestial body model. The target longitude and target latitude corresponding to the intersection point are determined. A preset celestial body texture map is sampled based on the target longitude and target latitude to obtain the sampling result. The celestial body model is rendered based on the sampling result to obtain the target celestial body. On the one hand, based on the rotation of celestial bodies, the current longitude and latitude are determined. Based on these, the observation position is obtained, and the camera's trajectory can be determined, simulating the effect of observing celestial bodies from different angles in real time. On the other hand, after obtaining the observation position, an observation matrix is determined. This matrix converts all observation positions in a plane into three-dimensional space. Based on this matrix and the observation position, a probe beam is emitted towards the celestial model, and the intersection point between the probe beam and the celestial model is determined. Based on the intersection point, a preset celestial texture map is sampled. This eliminates the need to construct a celestial mesh model, solving the vertex redundancy problem in related technologies and improving the efficiency of celestial model rendering. Furthermore, this celestial rendering method can be used on any celestial body, demonstrating strong reusability.
[0041] The following will provide further explanation and description of steps S110-S140.
[0042] In step S110, the current longitude and latitude are determined based on the rotation of the celestial body, and the observation position is obtained based on the current longitude and latitude.
[0043] Celestial rotation refers to the motion of a celestial body around its own axis, that is, the motion around its rotation axis. The rotation axis usually passes through the center of mass of the celestial body, and its direction follows the right-hand rule. The coordinate system corresponding to the celestial body can be a spherical coordinate system. In this coordinate system, the azimuth angle is determined as the longitude angle of the celestial body, and the polar angle is determined as the latitude angle of the celestial body. During the rotation of a celestial body, the current longitude and latitude of the celestial body can be determined in the spherical coordinate system based on the longitude and latitude angles.
[0044] The current latitude is the latitude corresponding to the current time during the celestial body's rotation. The current latitude of a celestial body changes periodically during its rotation. Since latitude is the polar angle in a spherical coordinate system, the current latitude of a celestial body at a given moment needs to be determined by combining the latitude angle, rotational speed, and time. The current longitude is the longitude corresponding to the current time during the celestial body's rotation. Since longitude is the azimuth angle in spherical coordinates, and this azimuth angle is horizontal, the current longitude of a celestial body at a given moment can be determined directly based on its rotational speed and time. After obtaining the current longitude and latitude, trigonometric functions can be used to convert the current longitude and latitude into radians, and then these radians can be converted into 3D Cartesian coordinates. These 3D Cartesian coordinates are then used as the observation position.
[0045] In one exemplary embodiment, reference is made to Figure 2 As shown, determining the current longitude and latitude based on the rotation of celestial bodies includes:
[0046] Step S210. Obtain the spherical coordinate system of the celestial body, and determine the polar angle in the spherical coordinate system as the latitude angle;
[0047] Step S220. Determine the rotation speed of the celestial body, and obtain the current latitude of the celestial body based on the latitude angle, the rotation speed, and the time variable;
[0048] Step S230. Obtain the current longitude of the celestial body based on the rotation speed and the time variable.
[0049] The following will further explain and illustrate steps S210-S230. Specifically, firstly, the spherical coordinate system of the celestial body is obtained, and the polar angle in the spherical coordinate system is determined as the latitude angle. The rotation speed of the celestial body is then determined. During the rotation of the celestial body according to this rotation speed, the current latitude of the celestial body is obtained based on the time variable, where the current latitude of the celestial body = latitude angle * sin(rotation speed * time). Based on the rotation speed and the time variable, the current longitude of the celestial body is obtained, where the current longitude of the celestial body = rotation speed * time. In this example embodiment, the rotation speed of the celestial body is not specifically limited; those skilled in the art can set specific values according to specific actual conditions.
[0050] In one exemplary embodiment, reference is made to Figure 3 As shown, the observation location is obtained based on the current longitude and the current latitude, including:
[0051] Step S310. Convert the current longitude and the current latitude into first radians and second radians;
[0052] Step S320. Based on the transformation relationship between spherical coordinate system and rectangular coordinate system, convert the first radian and the second radian into the first rectangular coordinate, and determine the first rectangular coordinate as the observation position.
[0053] The following will further explain and illustrate steps S310 and S320. Specifically, the current longitude is converted to first radians and the current latitude is converted to second radians using the conversion relationship between angles and radians. Then, based on the conversion relationship between spherical coordinates and rectangular coordinates, the radians are converted to rectangular coordinates. The conversion relationship between angles and radians is: radians = (angle * PI / 180), spherical coordinates... The transformation relationship between Cartesian coordinates (x, y, z) and the Cartesian coordinate system (x, y, z) is as follows: z = rcosθ. Therefore, the observation position camPos = scale * float3(sin(current latitude * PI / 180) * cos(current longitude * PI / 180), sin(current latitude * PI / 180) * sin(current longitude * PI / 180), cos(current longitude * PI / 180)). Here, scale controls the observation distance; in this example embodiment, the value of the observation distance is not specifically limited.
[0054] In step S120, a reference vector is determined based on the observation location and the center of the celestial body, and an observation matrix corresponding to the observation location is generated based on the reference vector.
[0055] After obtaining the observation position, a reference axis can be determined based on the observation position and the center of the celestial body. An observation matrix corresponding to the observation position is then calculated based on this reference axis. This observation matrix converts all observation positions on the plane into three-dimensional vectors. Based on these three-dimensional vectors, the emission direction of the probe beam when sending it to the celestial model can be determined.
[0056] In one exemplary embodiment, reference is made to Figure 4 As shown, the step of determining a reference vector based on the observation location and the center of the celestial body, and generating an observation matrix corresponding to the observation location based on the reference vector, includes:
[0057] Step S410. Obtain the direction vector from the observation position to the center of the celestial body, and normalize the direction vector to obtain the reference vector;
[0058] Step S420. Determine the global up direction vector, and obtain the secondary axis vector based on the reference vector and the global up direction vector;
[0059] Step S430. Based on the reference vector and the secondary axis vector, obtain the corrected up direction vector, and based on the reference vector, the secondary axis vector and the corrected up direction vector, generate the observation matrix.
[0060] The following will further explain and illustrate steps S410-S430. Specifically, the direction vector pointing from the observation position to the center of the celestial body is obtained. This direction vector is normalized to obtain the reference vector, w = normalized(-camPos). The global up direction vector is determined. This global up direction vector is the direction anchor point in three-dimensional space. Regardless of the rotation of the object or camera, the global up direction remains unchanged. This global up direction is a fixed three-dimensional vector, and there is only one global up direction in the entire coordinate world. The y-axis (0,1,0) of the world space can be used as the global up direction. In some systems that use a right-handed coordinate system and the Z-axis is upward, the Z-axis can also be determined as the global up direction. In this example embodiment, the global up direction is not specifically limited. After obtaining the global up direction vector, the secondary axis vector is obtained using the reference vector and the global up direction vector. This secondary axis vector u = normalized(cross product (w, global up direction vector)), and it is orthogonal to the reference vector. After obtaining the secondary axis vector, the global up direction vector can be corrected using the secondary axis vector and the reference vector to obtain the corrected up direction vector. This ensures that the secondary axis vector, the reference vector, and the corrected up direction vector are orthogonal, forming a right-handed coordinate system. The corrected up direction vector v = normalize(cross product (u, w)). The detection matrix based on the reference vector, secondary axis vector, and corrected up direction vector can be represented as float3x3 camera = float3x3(u, v, w).
[0061] In step S130, a celestial model is constructed. Based on the observation position and the observation matrix, a probe beam is emitted to the celestial model to obtain the intersection point with the celestial model, and the target longitude and target latitude corresponding to the intersection point are determined.
[0062] The system allows for the construction of celestial models within the UI. Since celestial bodies are generally spheres, the surface formula of a sphere can be used to construct the model; that is, the distance from any point on the sphere's surface to the center is equal to the radius. After obtaining the celestial model, a probe beam is emitted from the observation position towards it. The direction of the beam is determined by the probe matrix. When the probe beam intersects the celestial model, the intersection point is obtained, and its coordinates are converted to longitude and latitude. After conversion, a preset celestial texture map can be sampled based on the intersection point.
[0063] In one exemplary embodiment, reference is made to Figure 5 As shown, the step of emitting a probe beam towards the celestial model based on the observation position and the observation matrix to obtain the intersection point with the celestial model includes:
[0064] Step S510. Determine the emission direction of the detection beam based on the observation matrix, the secondary axis vector, and the corrected up direction vector;
[0065] Step S520. Send a probe beam from the observation position along the launch direction to the celestial model and determine the intersection point with the celestial model.
[0066] The following will further explain and illustrate steps S510 and S520. Specifically, firstly, the detection position is taken as the starting point for the detection beam. The emission direction of the detection beam can be determined by the observation matrix, the secondary axis vector, and the corrected upward direction vector. The emission direction = (cross product (observation matrix camera, secondary axis vector u, corrected upward direction vector v)). After determining the emission direction, the detection beam is emitted towards the celestial model, and the intersection point between the detection beam and the celestial model is obtained.
[0067] In one exemplary embodiment, reference is made to Figure 6 As shown, sending a probe beam to the celestial model to determine the intersection point with the celestial model includes:
[0068] Step S610. Obtain a first vector from the center of the celestial model to the observation position, and determine the projection of the first vector onto the observation matrix;
[0069] Step S620. Obtain the second vector based on the first vector and the radius of the celestial model, and obtain the discrimination result based on the projection and the second vector;
[0070] Step S630. Determine the intersection point based on the discrimination result.
[0071] The following will further explain and illustrate steps S610-S630. Specifically, a first vector is obtained pointing from the center of the celestial model to the observation position. This first vector is oc = ro - sph.xyz, where ro represents the observation position and sph.xyz is the position coordinate of the center point of the spherical model, which is float4(0,0,0,1). After obtaining the first vector, the projection of the first vector onto the observation matrix is calculated. This projection is b = dot(oc,rd), where dot represents the vector dot product and rd represents the observation matrix. A second vector can also be calculated based on the first vector. This second vector is the square of the length of the first vector minus the square of the radius of the celestial model, i.e., the second vector c = dot(oc,oc) - sph.w * sph.w, where sph.w represents the radius of the celestial model. After obtaining the projection and the second vector, the discrimination result h = b * bc can be determined based on the projection and the second vector. After obtaining the discrimination result, the intersection point is determined based on the discrimination result.
[0072] In one exemplary embodiment, determining the intersection point based on the discrimination result includes:
[0073] When the discrimination result is less than 0, it indicates that there is no intersection between the detection beam and the celestial model;
[0074] When the discrimination result is greater than 0, it indicates that the detection has an intersection with the celestial model;
[0075] Obtain the shortest distance from the intersection point to the observation position, and obtain the intersection point position based on the shortest distance, the observation position, and the observation matrix.
[0076] Specifically, when the discrimination result is less than 0, i.e., h < 0, it indicates that the probe beam does not intersect with the celestial model. When the discrimination result is greater than 0, i.e., h > 0, it indicates that the probe beam intersects with the celestial model. When the probe beam intersects with the celestial model, the shortest distance between the observation position and the intersection point can be obtained. This shortest distance is t = -b - sqrt(h). After obtaining the shortest distance, the intersection point position can be obtained based on the shortest distance, the observation position, and the observation matrix. This intersection point position = observation position + observation matrix * shortest distance. By using the discrimination result, invalid calculations can be terminated early, improving computational efficiency.
[0077] In one exemplary embodiment, constructing the celestial model includes:
[0078] The celestial model is constructed by utilizing the fact that every point on the sphere is equidistant from the center of the sphere.
[0079] Specifically, when generating celestial models in the UI, since celestial bodies are generally spheres, the surface formula of a sphere can be directly used. That is, the distance from any point on the sphere to the center of the sphere is equal to the radius, to construct the celestial model. The center of the sphere is the center of the surface carrier, and the radius of the sphere can be half the width or half the height of the surface carrier. In this example embodiment, the radius is not specifically limited. The generation process may include: using the conversion relationship between spherical coordinates and Cartesian coordinates to determine the spherical parametric equations. r is the distance from each point on the sphere to the center of the sphere. Based on this parametric equation, the coordinates of the sphere's vertices are determined, and adjacent vertices are combined to form triangular facets, thus obtaining the sphere model.
[0080] In related technologies, height maps are used to assist in creating 3D effects in UI interfaces. A height map is a black-and-white image used to represent the degree of concavity and convexity in different areas. In a height map, white represents 1, indicating a convexity, and black represents 0, indicating a constant height. Compared to the methods in related technologies, this example embodiment uses the formula for the surface of a sphere to create a celestial model. On the one hand, it can accurately describe the position of each vertex, avoiding quantization errors caused by discrete sampling of the height map; on the other hand, it eliminates the computational overhead of height map decoding and mesh reconstruction. During rendering, there is no need to convert height data in real time, and the GPU can directly process parametric geometric data; furthermore, it does not require building a celestial mesh model. During data storage, only radius data needs to be stored, which significantly saves memory compared to the two-dimensional array of the height map.
[0081] In one exemplary embodiment, after obtaining the intersection point location, it is necessary to transform the intersection point location from a Cartesian coordinate system to a spherical coordinate system to correspond to a preset celestial texture map. This is because the preset celestial texture map is a two-dimensional planar image (UV coordinate system). When it is applied to the surface of a three-dimensional celestial model (XYZ coordinate system), the spherical coordinate system (longitude, latitude) becomes the bridge connecting the surface of the celestial model and the two-dimensional texture. (See reference...) Figure 7 As shown, determining the target latitude corresponding to the intersection point includes:
[0082] Step S710. Determine the position of the intersection point in the celestial model, wherein the position can be a pole region, a non-polar region, or an equatorial region;
[0083] Step S720. When the intersection point is located in a non-polar region, perform coordinate transformation on the intersection point to obtain the target latitude;
[0084] Step S730. When the intersection point is located in the polar region, perform coordinate transformation on the intersection point to obtain the first latitude, and adjust the first latitude by the mapping index to obtain the target latitude;
[0085] Step S740. When the intersection point is located in the equatorial region, the angle between the projection of the intersection point in the vertical direction and the North Pole direction is determined by the inverse cosine function, and the angle is converted to obtain the target latitude.
[0086] The following will further explain and illustrate steps S710-S740. Specifically, general latitude calculations directly use linear mapping; however, in the extreme regions of a sphere (North and South Poles), textures are severely compressed. In the equatorial region, texture resolution is too high, while in the extreme regions, resolution is insufficient, resulting in the loss of texture details and poor visual quality. Therefore, a hypercurvature mapping function can be used to maintain linearity in the equatorial region and expand it in the extreme regions.
[0087] During the transformation, firstly, the location of the intersection point in the celestial model is determined. The celestial model can include polar regions, non-polar regions, and equatorial regions. Secondly, when the intersection point is located in a non-polar region, a linear transformation is directly performed on the intersection point's position, that is, it is directly converted from a Cartesian coordinate system to a spherical coordinate system. After conversion to spherical coordinates, the spherical coordinate system is divided by π and then 0.5 is added to obtain the target latitude. When the intersection point is located in a polar region, a power function can be used to control the degree of nonlinearity. That is, the coordinates of the intersection point are first converted from a Cartesian coordinate system to a spherical coordinate system to obtain the first latitude. A mapping index is determined based on this first dimension, and the first latitude is adjusted based on this mapping index to obtain the target latitude. The target latitude v = sign(first latitude) * pow(first latitude, 1 / (1+2k)), where k is the mapping exponent (k>0), the sign() function is a function that takes the sign of the number, and the pow() function is a power function, pow(a,b), representing a raised to the power of b. When k>0, the exponent 1 / (1+2k)<1, and the function curve bulges upward in the interval (0,1). After adjusting the first latitude, the adjusted latitude can be divided by π and then 0.5 is added to obtain the target latitude. When the intersection point is located in the equatorial region, the angle between the projection of the intersection point in the vertical direction and the North Pole direction can be calculated using the inverse cosine function to obtain radians. This radian is then converted to an angle to obtain the target latitude. To convert radians to angles, multiply the radian by 180 / π to convert it to an angle. The converted angle range is [-90, 90]. After obtaining the angle, the target latitude can be obtained by dividing the angle by 180 and adding 0.5. The range of the target latitude is [0,1].
[0088] In one exemplary embodiment, reference is made to Figure 8 As shown, determining the target longitude corresponding to the intersection point includes:
[0089] Step S810. Obtain the first projection and the second projection of the intersection point in the world space coordinate system, and perform arctangent processing on the first projection and the second projection to obtain the radian value;
[0090] Step S820. Convert the radian value into an angle to obtain the target longitude.
[0091] The following will further explain and illustrate steps S810 and S820. Specifically, the left and right deflection angles of the intersection point relative to true north can be calculated on the horizontal plane. Therefore, the intersection point can be projected into the world coordinate system to obtain a first projection and a second projection. The first and second projections are then subjected to arctangent processing to obtain radian values. These radian values are then converted to angle values, i.e., the target longitude. When projecting the intersection point into the world coordinate system, the intersection point can be projected onto the X-axis and Z-axis. That is, the projections of the intersection point along the X-axis and Z-axis are subjected to arctangent processing to obtain radian values. These radian values are then converted to angle values to obtain the target accuracy.
[0092] That is, when the rectangular coordinate system of the intersection point is (x,y,z) and the target accuracy is phi, we can get tan(phi)=z / x, where z is the projection of the intersection point on the Z-axis and x is the projection of the intersection point on the X-axis. Then, phi=arctan(z / x). Here, phi is in radians. We can multiply the radians by 180 / PI to convert it into angles. The range of the converted angles is [-90,90]. After obtaining the angles, we can get the target longitude by angle / 180+0.5. The range of the target longitude is [0,1].
[0093] In step S140, a preset celestial texture map is sampled based on the target longitude and the target latitude to obtain a sampling result. The celestial model is then rendered based on the sampling result to obtain the target celestial body.
[0094] The preset celestial texture map can be obtained by selecting from multiple levels of celestial texture maps. When selecting a texture map, anti-aliasing technology can be used to read the map and automatically select a texture level with appropriate clarity, ensuring that it appears blurry from a distance but clear up close. After determining the preset celestial texture map, it can be sampled based on the target longitude and latitude of the intersection point to obtain the sampling result. The celestial model is then rendered based on the sampling result to obtain the target celestial body.
[0095] In one exemplary embodiment, pseudo-physical illumination enhancement technology can also be used to enhance the stereoscopic perception of the target celestial body in the UI interface. (See reference) Figure 9 As shown, after obtaining the target celestial body, the method further includes:
[0096] Step S910. Obtain the horizontal and vertical pixels of each pixel in the target celestial body, and perform partial derivatives on the horizontal and vertical pixels to obtain the first and second partial derivatives;
[0097] Step S920. Obtain the virtual normal of each pixel based on the first partial derivative and the second partial derivative;
[0098] Step S930. Obtain the light source direction, determine the lighting result of each pixel based on the light source direction and the virtual normal of each pixel in the target celestial body, and render the target celestial body based on the lighting result.
[0099] The following will further explain and illustrate steps S910-S930. Specifically, a light source direction is defined, where the light source can be sunlight. For each pixel in the target celestial body, its horizontal and vertical pixels can be obtained. Partial derivatives are taken for the horizontal and vertical pixels respectively to obtain a first partial derivative and a second partial derivative. The first and second partial derivatives are then cross-multiplied to obtain the virtual normal of each pixel. The virtual normal of each pixel is then cross-multiplied with the light source direction to obtain the lighting result of each pixel. After obtaining the lighting result of each pixel, the target celestial body is rendered using the lighting result of each pixel.
[0100] The light source direction can be float3(-1.0,0.0,1.0), and the virtual normal of each pixel is equal to the cross product (partial derivative(X), partial derivative(Y)), where X is the horizontal pixel and Y is the vertical pixel. The lighting result of each pixel is a = clamp(smoothstep(0,0.5,dot(light source direction,virtual normal)),0,1). smoothstep(0,0.5,x) means smoothing the x value in the range [0,0.5] to [0,1]. It returns 0 if the x value is less than 0 and 1 if the x value is greater than 0.5. clamp(x,0,1) ensures that the output value is strictly limited to the range [0,1]. The calculation logic for the lighting result of each pixel is as follows: when the angle between the light source direction and the virtual normal is greater than 90 degrees (dot product < 0), the output is forced to 0 to avoid negative lighting; when the angle is between [0, 60] degrees (dot product between [0-0.5]), a smooth gradient is generated to simulate the transition of natural light; when the angle is less than 60 degrees (dot product > 0.5), the maximum value of 1 is directly taken to maintain the high light intensity.
[0101] In one exemplary embodiment, the target celestial body in the UI interface can also be subjected to anti-defect processing. After obtaining the target celestial body, the method further includes:
[0102] Obtain the distance from the pixel of the target celestial body to the center of the screen, and perform a smooth transition on the edge of the target celestial body based on the distance.
[0103] Specifically, the distance from each pixel in the target celestial body to the center of the screen is determined. Based on this distance, the edge pixels of the target celestial body are smoothly transitioned, generating a gradient effect of transparency at the screen edges to eliminate jagged edges caused by planar mapping. The mask for each pixel is defined as `maskA = 1 - smoothstep(0.9, 1.0, length(p))`, where `length(p)` is the distance from the pixel to the center of the screen, `smoothstep(0.9, 1.0, x)` indicates a smooth transition when `x` is in the range [0.9, 1.0], returning 0 for `x < 0.9` and 1 for `x > 1.0`, and `1 - smoothstep()` reverses the transition curve to create a decay effect. That is, when the distance between a pixel and the center of the screen is less than 0.9, the pixel is fully displayed; when the distance is in the range [0.9, 1.0], the pixel value is smoothly decayed from 1 to 0; and when the distance is greater than 1.0, the pixel value is completely hidden.
[0104] The celestial rendering method provided in this exemplary embodiment has at least the following advantages: Firstly, based on the rotation of the celestial body, the current longitude and latitude are determined, and the observation position is obtained based on the current longitude and latitude. The camera's motion trajectory can be determined through this observation position, simulating the effect of observing the celestial body from different angles, thus realizing real-time observation of the celestial body from different angles. Secondly, after obtaining the observation position, an observation matrix is determined based on the observation position. The observation matrix converts all observation positions located in the plane into three-dimensional space. Based on the observation matrix and the observation position, a probe beam is emitted to the celestial model, and the intersection point between the probe beam and the celestial model is determined. The texture is sampled based on the intersection point. Here, there is no need to construct a celestial mesh model, which solves the problem of vertex redundancy in related technologies and improves the efficiency of celestial model rendering. Thirdly, this celestial rendering method can be used on any celestial body, and has strong reusability. Fourthly, the three-dimensionality of the target celestial body is improved through pseudo-physical lighting enhancement technology.
[0105] Exemplary embodiments of this disclosure also provide a celestial rendering apparatus, with reference to Figure 10 As shown, the celestial rendering device includes:
[0106] The observation location determination module 1010 is used to determine the current longitude and current latitude based on the rotation of the celestial body, and to obtain the observation location based on the current longitude and current latitude.
[0107] The observation matrix generation module 1020 is used to determine a reference vector based on the observation location and the center of the celestial body, and generate an observation matrix corresponding to the observation location based on the reference vector.
[0108] The intersection point determination module 1030 is used to construct a celestial model, and based on the observation position and the observation matrix, to emit a probe beam to the celestial model to obtain the intersection point with the celestial model and determine the target longitude and target latitude corresponding to the intersection point;
[0109] The celestial rendering module 1040 is used to sample a preset celestial texture map based on the target longitude and the target latitude, obtain the sampling result, and render the celestial model according to the sampling result to obtain the target celestial body.
[0110] In one exemplary embodiment, the observation location determination module includes:
[0111] The latitude angle determination module is used to obtain the spherical coordinate system of the celestial body and determine the polar angle in the spherical coordinate system as the latitude angle;
[0112] The current latitude determination module is used to determine the rotation speed of the celestial body and obtain the current latitude of the celestial body based on the latitude angle, the rotation speed, and the time variable.
[0113] The current longitude determination module is used to obtain the current longitude of the celestial body based on the rotation speed and the time variable.
[0114] In one exemplary embodiment, the observation location determination module includes:
[0115] A radian conversion module is used to convert the current longitude and the current latitude into a first radian and a second radian;
[0116] The coordinate transformation module is used to convert the first radian and the second radian into a first rectangular coordinate based on the transformation relationship between the spherical coordinate system and the rectangular coordinate system, and to determine the first rectangular coordinate as the observation position.
[0117] In one exemplary embodiment, the observation matrix generation module includes:
[0118] The reference vector determination module is used to obtain the direction vector pointing from the observation position to the center of the celestial body, and to normalize the direction vector to obtain the reference vector;
[0119] The secondary axis vector determination module is used to determine the global up direction vector and obtain the secondary axis vector based on the reference vector and the global up direction vector.
[0120] The up direction vector correction module is used to obtain a corrected up direction vector based on the reference vector and the secondary axis vector, and to generate the observation matrix based on the reference vector, the secondary axis vector and the corrected up direction vector.
[0121] In one exemplary embodiment, the intersection point determination module includes:
[0122] The emission direction determination module is used to determine the emission direction of the detection beam based on the observation matrix, the secondary axis vector, and the corrected up direction vector.
[0123] The transmission module is used to send a probe beam from the observation position along the transmission direction to the celestial model and determine the intersection point with the celestial model.
[0124] In one exemplary embodiment, the intersection point determination module includes:
[0125] The first vector calculation module is used to obtain a first vector from the center of the celestial model to the observation position, and to determine the projection of the first vector onto the observation matrix.
[0126] The discrimination result acquisition module is used to obtain a second vector based on the first vector and the radius of the celestial model, and to obtain a discrimination result based on the projection and the second vector;
[0127] The intersection calculation module is used to determine the intersection point based on the discrimination result.
[0128] In one exemplary embodiment, the intersection calculation module includes:
[0129] The first calculation module is used to indicate that when the discrimination result is less than 0, it means that there is no intersection between the detection beam and the celestial model;
[0130] The second calculation module is used to indicate that the detection has an intersection with the celestial model when the discrimination result is greater than 0;
[0131] The location determination module is used to obtain the shortest distance from the intersection point to the observation position, and to obtain the intersection point position based on the shortest distance, the observation position, and the observation matrix.
[0132] In one exemplary embodiment, the intersection point determination module includes:
[0133] The position division module is used to determine the position of the intersection point in the celestial model, wherein the position can be a polar region, a non-polar region, or an equatorial region;
[0134] The first latitude determination module is used to perform coordinate transformation on the intersection point when the intersection point is located in a non-polar region to obtain the target latitude;
[0135] The second latitude determination module is used to perform coordinate transformation on the intersection point when the intersection point is located in the polar region to obtain the first latitude, and adjust the first latitude by the mapping index to obtain the target latitude;
[0136] The third latitude determination module is used to determine the angle between the projection of the intersection point in the vertical direction and the North Pole direction by using an inverse cosine function when the intersection point is located in the equatorial region, and to perform angle conversion on the angle to obtain the target latitude.
[0137] In one exemplary embodiment, the intersection point determination module includes:
[0138] The radian value acquisition module is used to acquire the first projection and the second projection of the intersection point on the world space coordinate system, and to perform arctangent processing on the first projection and the second projection to obtain the radian value.
[0139] The target latitude acquisition module is used to convert the radian value into an angle to obtain the target latitude.
[0140] In one exemplary embodiment, the celestial rendering module includes:
[0141] The pixel acquisition module is used to acquire the horizontal and vertical pixels of each pixel in the target celestial body, and perform partial derivatives on the horizontal and vertical pixels to obtain the first and second partial derivatives.
[0142] The normal determination module is used to obtain the virtual normal of each pixel based on the first partial derivative and the second partial derivative;
[0143] The lighting calculation module is used to obtain the direction of the light source, determine the lighting result of each pixel based on the direction of the light source and the virtual normal of each pixel in the target celestial body, and render the target celestial body based on the lighting result.
[0144] In one exemplary embodiment, the celestial rendering module includes:
[0145] The pixel smoothing module is used to obtain the distance from the pixel of the target celestial body to the center of the screen, and to smooth the edge of the target celestial body according to the distance.
[0146] The specific details of each part of the above-mentioned device have been described in detail in the method section of the implementation plan. For any undisclosed details, please refer to the implementation plan of the method section, and therefore will not be repeated here.
[0147] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to exemplary embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0148] Furthermore, although the steps of the method in this invention are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0149] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above-described method is also provided.
[0150] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as “circuits,” “modules,” or “systems.”
[0151] The following reference Figure 11 To describe an electronic device 1100 according to this embodiment of the present invention. Figure 11 The electronic device 1100 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0152] like Figure 11 As shown, the electronic device 1100 is manifested in the form of a general-purpose computing device. The components of the electronic device 1100 may include, but are not limited to: at least one processing unit 1110, at least one storage unit 1120, a bus 1130 connecting different system components (including storage unit 1120 and processing unit 1110), and a display unit 1140.
[0153] The storage unit stores program code that can be executed by the processing unit 1110, causing the processing unit 1110 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 1110 can perform actions such as... Figure 1Step S110: Determine the current longitude and latitude based on the rotation of the celestial body, and obtain the observation position based on the current longitude and latitude; Step S120: Determine the reference vector based on the observation position and the center of the celestial body, and generate an observation matrix corresponding to the observation position based on the reference vector; Step S130: Generate a celestial body model, and emit a probe beam to the celestial body model based on the observation position and the observation matrix to obtain the intersection point with the celestial body model, and determine the target longitude and target latitude corresponding to the intersection point; Step S140: Sample the target texture based on the target longitude and target latitude to obtain the sampling result, and render the celestial body model based on the sampling result to obtain the target celestial body.
[0154] Storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 11201 and / or cache memory 11202, and may further include a read-only memory (ROM) 11203.
[0155] Storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0156] Bus 1130 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0157] Electronic device 1100 can also communicate with one or more external devices 1200 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 1100, and / or any device that enables electronic device 1100 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1150. Furthermore, electronic device 1100 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1160. As shown, network adapter 1160 communicates with other modules of electronic device 1100 via bus 1130. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems.
[0158] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the method according to the embodiments of the present invention.
[0159] In exemplary embodiments of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the present invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.
[0160] According to embodiments of the present invention, a program product for implementing the above-described method may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0161] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0162] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0163] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF (Radio Frequency), etc., or any suitable combination thereof.
[0164] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0165] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0166] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention described herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not invented herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
Claims
1. A method for rendering celestial bodies, characterized in that, include: Based on the rotation of celestial bodies, determine the current longitude and latitude, and based on the current longitude and latitude, obtain the observation position; A reference vector is determined based on the observation location and the center of the celestial body, and an observation matrix corresponding to the observation location is generated based on the reference vector. Construct a celestial model, and based on the observation position and the observation matrix, send a probe beam to the celestial model to obtain the intersection point with the celestial model, and determine the target longitude and target latitude corresponding to the intersection point; Based on the target longitude and the target latitude, a preset celestial texture map is sampled to obtain the sampling result. The celestial model is then rendered based on the sampling result to obtain the target celestial body.
2. The method according to claim 1, characterized in that, The process of determining the current longitude and latitude based on the rotation of celestial bodies includes: Obtain the spherical coordinate system of the celestial body, and determine the polar angle in the spherical coordinate system as the latitude angle; Determine the rotation speed of the celestial body, and obtain the current latitude of the celestial body based on the latitude angle, the rotation speed, and the time variable; The current longitude of the celestial body is obtained based on the rotation speed and the time variable.
3. The method according to claim 1, characterized in that, The process of obtaining the observation location based on the current longitude and the current latitude includes: Convert the current longitude and the current latitude into first radians and second radians; Based on the transformation relationship between spherical coordinate system and rectangular coordinate system, the first radian and the second radian are converted into the first rectangular coordinate, and the first rectangular coordinate is determined as the observation position.
4. The method according to claim 1, characterized in that, The process of determining a reference vector based on the observation location and the center of the celestial body, and generating an observation matrix corresponding to the observation location based on the reference vector, includes: Obtain the direction vector pointing from the observation position to the center of the celestial body, and normalize the direction vector to obtain the reference vector; Determine the global upward direction vector, and based on the reference vector and the global upward direction vector, obtain the secondary axis vector; Based on the reference vector and the secondary axis vector, a corrected up direction vector is obtained, and based on the reference vector, the secondary axis vector, and the corrected up direction vector, the observation matrix is generated.
5. The method according to claim 4, characterized in that, The step of emitting a probe beam towards the celestial model based on the observation location and the observation matrix to obtain the intersection point with the celestial model includes: The emission direction of the detection beam is determined based on the observation matrix, the secondary axis vector, and the corrected up direction vector. A probe beam is sent from the observation position along the launch direction to the celestial model to determine the intersection point with the celestial model.
6. The method according to claim 5, characterized in that, Sending a probe beam to the celestial model to determine the intersection point with the celestial model includes: Obtain a first vector from the center of the celestial model to the observation position, and determine the projection of the first vector onto the observation matrix; Based on the first vector and the radius of the celestial model, a second vector is obtained; based on the projection and the second vector, a discrimination result is obtained. The intersection point is determined based on the discrimination result.
7. The method according to claim 6, characterized in that, Determining the intersection point based on the discrimination result includes: When the discrimination result is less than 0, it indicates that there is no intersection between the detection beam and the celestial model; When the discrimination result is greater than 0, it indicates that the detection has an intersection with the celestial model; Obtain the shortest distance from the intersection point to the observation position, and obtain the intersection point position based on the shortest distance, the observation position, and the observation matrix.
8. The method according to claim 1, characterized in that, Determining the target latitude corresponding to the intersection point includes: Determine the position of the intersection point in the celestial model, wherein the position can be a pole region, a non-polar region, or an equatorial region; When the intersection point is located in a non-polar region, the coordinates of the intersection point are transformed to obtain the target latitude; When the intersection point is located in the extreme region, the coordinates of the intersection point are transformed to obtain the first latitude. The first latitude is then adjusted by the mapping index to obtain the target latitude. When the intersection point is located in the equatorial region, the angle between the projection of the intersection point in the vertical direction and the North Pole direction is determined by the inverse cosine function, and the angle is converted to obtain the target latitude.
9. The method according to claim 1, characterized in that, Determining the target longitude corresponding to the intersection point includes: Obtain the first and second projections of the intersection point in the world space coordinate system, and perform arctangent processing on the first and second projections to obtain the radian value; The radian value is converted into an angle to obtain the target longitude.
10. The method according to claim 1, characterized in that, After obtaining the target celestial body, the method further includes: Obtain the horizontal and vertical pixels of each pixel in the target celestial body, and perform partial derivatives on the horizontal and vertical pixels to obtain the first and second partial derivatives. Based on the first partial derivative and the second partial derivative, the virtual normal of each pixel is obtained; Obtain the direction of the light source, determine the illumination result of each pixel based on the direction of the light source and the virtual normal of each pixel in the target celestial body, and render the target celestial body based on the illumination result.
11. The method according to claim 1, characterized in that, After obtaining the target celestial body, the method further includes: Obtain the distance from the pixel of the target celestial body to the center of the screen, and perform a smooth transition on the edge of the target celestial body based on the distance.
12. A celestial rendering device, characterized in that, include: The observation location determination module is used to determine the current longitude and latitude based on the rotation of celestial bodies, and to obtain the observation location based on the current longitude and latitude. An observation matrix generation module is used to determine a reference vector based on the observation location and the center of the celestial body, and to generate an observation matrix corresponding to the observation location based on the reference vector. The intersection point determination module is used to construct a celestial model, and based on the observation position and the observation matrix, to emit a probe beam to the celestial model to obtain the intersection point with the celestial model, and to determine the target longitude and target latitude corresponding to the intersection point; The celestial body rendering module is used to sample a preset celestial body texture map based on the target longitude and the target latitude, obtain the sampling result, and render the celestial body model according to the sampling result to obtain the target celestial body.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 11.
14. An electronic device, characterized in that, include: processor; Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 11 by executing the executable instructions.