Method, device, electronic device and medium for simulating solar eclipse phenomenon in a real scene

By adding a mask layer to the camera and adjusting transparency according to the overlap between the moon image and the sun image, the problem of high performance consumption of equipment when simulating solar eclipse phenomena in online education is solved, and efficient and low-cost solar eclipse phenomenon simulation is achieved, which is suitable for low-end equipment.

CN116017111BActive Publication Date: 2025-03-07BEIJING XINTANG SICHUANG EDUCATIONAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211642382.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-20
Publication Date
2025-03-07
Estimated Expiration
2042-12-20

AI Technical Summary

Technical Problem

In online education scenarios, the method of simulating solar eclipse phenomenon requires high frame rate refreshing images to avoid misleading, resulting in large consumption of equipment performance and high requirements for equipment performance, affecting the adaptability of low-end equipment.

Method used

By adding a mask layer to the camera, the transparency of the mask layer is adjusted according to the degree of overlap between the moon image and the sun image, simulating the brightness and dark changes of the scene during the solar eclipse phenomenon.

Benefits of technology

It realizes the light and dark changes of solar eclipse phenomenon by adjusting the transparency of the mask layer, reducing the dependence on equipment performance, avoiding the phenomenon of misfortunes, improving the simulation effect of solar eclipse phenomenon, and adapting to low-end equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116017111B_ABST
    Figure CN116017111B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, electronic device and medium for simulating a solar eclipse phenomenon in a full-scale scene. The method includes: obtaining the degree of overlap between the moon image and the sun image during the process of simulating a solar eclipse phenomenon in a full-scale scene; determining the target environment brightness corresponding to the degree of overlap according to the degree of overlap; adjusting the transparency of the mask layer of the camera in the full-scale scene according to the target environment brightness to simulate the brightness and darkness changes of the scene during the solar eclipse phenomenon. This solution realizes the change of the environment in the full-scale scene only by changing the transparency of the mask layer, has low requirements on device performance, reduces dependence on device performance, and also effectively avoids the occurrence of goofs and improves the simulation effect of the solar eclipse phenomenon.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of online education technology, and in particular to a method, device, electronic device and medium for simulating a solar eclipse phenomenon in a true-to-life scenario. Background Art

[0002] At present, in online education scenarios, in order to simulate the changes in brightness of the entire scene during a solar eclipse, the method used is to simultaneously change the lighting in the full-scale scene and the color of the skybox to simulate the changes in the scene. However, in order to achieve a full-scale effect, the above implementation method requires a high frame rate to refresh the image to avoid mistakes, which consumes more device performance and has high performance requirements for the device. If the device performance is poor, the mistakes will affect the simulation effect of the solar eclipse. Summary of the invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present disclosure provide a method, device, electronic device and medium for simulating a solar eclipse phenomenon in a full-scale scene.

[0004] According to one aspect of the present disclosure, a method for simulating a solar eclipse phenomenon in a full-scale scenario is provided, comprising:

[0005] In the process of simulating the solar eclipse phenomenon in a real scene, the degree of overlap between the moon image and the sun image is obtained;

[0006] According to the overlap degree, determining the target environment brightness corresponding to the overlap degree;

[0007] According to the target environment brightness, the transparency of the mask layer of the camera in the true scene is adjusted to simulate the brightness change of the scene during the solar eclipse phenomenon.

[0008] According to another aspect of the present disclosure, a device for simulating a solar eclipse phenomenon in a true scene is provided, comprising:

[0009] An acquisition module is used to obtain the degree of overlap between the moon image and the sun image in the process of simulating the solar eclipse phenomenon in a true scene;

[0010] A determination module, configured to determine, according to the overlap degree, a target environment brightness corresponding to the overlap degree;

[0011] The adjustment module is used to adjust the transparency of the mask layer of the camera in the true scene according to the brightness of the target environment to simulate the brightness change of the scene during the solar eclipse phenomenon.

[0012] According to another aspect of the present disclosure, there is provided an electronic device, comprising:

[0013] Processor; and

[0014] Memory for storing programs,

[0015] The program includes instructions, which, when executed by the processor, enable the processor to execute the method for simulating a solar eclipse phenomenon in a realistic scenario according to the aforementioned aspect.

[0016] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method for simulating a solar eclipse phenomenon in a full-scale scenario according to the aforementioned aspect.

[0017] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method for simulating a solar eclipse phenomenon in a true-to-life scenario as described in the aforementioned aspect is implemented.

[0018] One or more technical solutions provided in the embodiments of the present disclosure obtain the degree of overlap between the moon image and the sun image in the process of simulating the solar eclipse phenomenon in a full-scale scene, and determine the target environment brightness corresponding to the degree of overlap based on the degree of overlap, and then adjust the transparency of the mask layer of the camera in the full-scale scene according to the target environment brightness to simulate the brightness change of the scene during the solar eclipse phenomenon. The scheme of the present disclosure is adopted, by adding a mask layer to the camera, and adjusting the transparency of the mask layer according to the degree of overlap between the moon image and the sun image in the process of simulating the solar eclipse phenomenon, the purpose of simulating the brightness change of the scene during the solar eclipse phenomenon by adjusting the transparency of the mask layer is achieved, and the solar eclipse phenomenon is vividly and vividly displayed. In addition, in this scheme, the change of the environment in the full-scale scene is achieved only by changing the transparency of the mask layer, and the requirements for device performance are relatively low, reducing the dependence on device performance, and at the same time effectively avoiding the occurrence of the gangbang phenomenon, and improving the simulation effect of the solar eclipse phenomenon. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0020] Figure 1 A flow chart of a method for simulating a solar eclipse phenomenon in a true scene according to an exemplary embodiment of the present disclosure is shown;

[0021] Figure 2 A flow chart showing a method for simulating a solar eclipse phenomenon in a true scene according to another exemplary embodiment of the present disclosure is shown;

[0022] Figure 3 A schematic diagram showing the positional relationship between the moon image and the sun image in an exemplary embodiment of the present disclosure is shown;

[0023] Figure 4 A schematic diagram showing movement of a human character in a real-life scene in an exemplary embodiment of the present disclosure is shown;

[0024] Figure 5 A schematic block diagram of a device for simulating a solar eclipse phenomenon in a full-scale scene according to an exemplary embodiment of the present disclosure is shown;

[0025] Figure 6 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0027] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0028] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0029] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0030] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0031] The following describes the method, device, electronic device and storage medium for simulating a solar eclipse phenomenon in a true-to-life scenario provided by the present disclosure with reference to the accompanying drawings.

[0032] Before describing the embodiments of the present disclosure in detail, the relevant terms involved in the present disclosure are first explained.

[0033] 1. Full-scale environment / full-scale scene

[0034] A full-scale scene is a scene displayed (or provided) when the client of an application (such as an educational application) runs on a terminal. It is a virtual scene, which refers to an environment created for virtual objects (i.e., characters in the scene) to carry out activities (such as education and learning). For example, it can be a virtual classroom, a virtual teaching scene, etc. The virtual scene can be a scene that simulates the real world, or it can also be a fictional scene, or it can be a semi-real and semi-fictional scene.

[0035] 2. Camera

[0036] The camera refers to the camera in the direction of the student's perspective in the real scene. The camera follows the characters in the real scene. One character corresponds to one camera. Only through the camera can the content in the real scene be presented to the user.

[0037] 3. Characters

[0038] The character is a virtual object in a real scene. It should be noted that the character described in the embodiments of the present disclosure mainly refers to the role of the current user in the real scene (i.e., the protagonist), and the current user is the user of the electronic device that executes the method for simulating a solar eclipse in a real scene provided by the present disclosure.

[0039] 4. Skybox

[0040] In modern computer games, skybox is a common method to fill the background. The so-called skybox is actually a cube unfolded, and then the corresponding textures are pasted on the six faces. The content of the texture can be a texture simulating real weather, the properties of objects in the scene such as houses, etc.

[0041] 5. Unity

[0042] Unity is a real-time 3D interactive content creation and operation platform. All creators, including game development, art, architecture, automotive design, film and television, use Unity to turn their creativity into reality.

[0043] 6. Shader

[0044] Shader is used to implement image rendering. It is an editable program that replaces the fixed rendering pipeline. It can implement related calculations in 3D graphics. Due to its editability, it can achieve a variety of image effects without being restricted by the fixed rendering pipeline of the graphics card.

[0045] 7. Tiling And Offset

[0046] Tiling represents the scaling factor of the UV coordinates, and Offset represents the starting position of the UV coordinates. Tiling and Offset are used to tile and offset the input UV values, which are usually used for detail maps and scrolling textures over time.

[0047] 8. Ellipse

[0048] Ellipse generates an ellipse shape based on the input UVs with the size specified by the input Width and Height, where the center of the ellipse is the center of the bounding rectangle. The generated shape can be offset or tiled by connecting a Tiling And Offset node.

[0049] At present, online teaching is widely used in the field of education. With the development of the real scene, the real classroom based on the real scene for online teaching has gradually become the focus of research and application because it simulates the real classroom environment.

[0050] In the online education scenario, in the relevant technology, when the instructor needs to explain the solar eclipse phenomenon, the relative displacement of the two spheres is mainly used to simulate the moon blocking the light from the sun to the earth, and the light and dark effects of the entire environment when the solar eclipse occurs are simulated by changing the lighting of the full-scene and the color of the sky box. However, when simulating the solar eclipse phenomenon in the above way, since the displacement of the sphere needs to be synchronized with the change of the light color, and needs to be observed at a fixed point, in order to achieve the full-real effect, a high frame rate refresh image is required to avoid mistakes, which consumes more device performance, resulting in high performance requirements for the device to simulate the solar eclipse phenomenon. In the mobile era, performance is one of the key factors affecting user growth and experience. If the performance of the device is poor, the mistakes will affect the simulation effect of the solar eclipse phenomenon.

[0051] In view of the above problems, the present invention provides a method for simulating the solar eclipse phenomenon in a full-scale scene. By adding a mask layer to the camera, the transparency of the mask layer is adjusted according to the overlap between the moon image and the sun image during the simulation of the solar eclipse phenomenon, so as to achieve the purpose of simulating the light and dark changes of the scene during the solar eclipse phenomenon by adjusting the transparency of the mask layer, and vividly and vividly display the solar eclipse phenomenon. In addition, in this scheme, the change of the environment in the full-scale scene is realized only by changing the transparency of the mask layer, and the requirements for device performance are low, which reduces the dependence on device performance, and also effectively avoids the occurrence of the gang phenomenon, thereby improving the simulation effect of the solar eclipse phenomenon. This scheme uses Unity's shader (Shader) to realize the change of the displacement and occlusion of the moon image, and then adds a black picture as a mask layer in front of the camera. By adjusting the transparency of the mask layer, the light and dark changes seen by the human eye when the solar eclipse occurs are completely simulated, so that students can easily understand the knowledge points of the solar eclipse phenomenon in a vivid and vivid way, and students can immersively experience the solar eclipse phenomenon in real life. Since this solution does not change the properties of the lighting, skybox and objects in the full-scale scene, it only adds a mask layer to the camera and adjusts the transparency of the mask layer to achieve the light and dark changes of the environment in the full-scale scene, thereby achieving the light and dark changes of the scene in the solar eclipse phenomenon. Therefore, the performance requirements of the device are not high. Therefore, the performance of the present invention on mobile devices will be greatly improved, and it can be adapted to more low-end models.

[0052] Figure 1 A flowchart of a method for simulating a solar eclipse phenomenon in a full-scale scene according to an exemplary embodiment of the present disclosure is shown. The method can be executed by a device for simulating a solar eclipse phenomenon in a full-scale scene, wherein the device can be implemented using software and / or hardware and can generally be integrated into electronic devices, such as mobile phones and tablet computers.

[0053] like Figure 1 As shown, the method for simulating the solar eclipse phenomenon in the real scene may include the following steps:

[0054] Step 101, in the process of simulating a solar eclipse phenomenon in a real scene, obtaining the degree of overlap between the moon image and the sun image.

[0055] The moon image may be a black circular image, and the moon image may be input, or may be generated based on an input sun image using a preset program, and the present disclosure does not impose any limitation on this.

[0056] In the disclosed embodiment, in a full-real scene, a moon image and a sun image can be used to simulate the solar eclipse process in the full-real scene by setting the moon image to move toward the sun image. When the moon image moves to the point where it begins to overlap with the sun image, the part of the sun image that overlaps with the moon image is covered by the moon image, and a solar eclipse occurs. As the degree of overlap between the moon image and the sun image increases, the illumination of the entire scene in the full-real scene becomes lower and lower. When the outline of the moon in the moon image completely overlaps with the outline of the sun in the sun image, it can be determined that a total solar eclipse occurs at this time, and the illumination of the entire environment in the full-real scene reaches the lowest. After that, as the moon image continues to move, the degree of solar eclipse gradually decreases, that is, the degree of overlap between the moon image and the sun image gradually decreases, and the illumination of the entire scene in the full-real scene begins to gradually increase. Therefore, in the disclosed embodiment, in the process of simulating the solar eclipse phenomenon, the degree of overlap between the moon image and the sun image can be obtained to simulate the change in ambient brightness in the full-real scene based on the degree of overlap.

[0057] For example, the degree of overlap between the moon image and the sun image can be characterized by the area of ​​the overlapping portion between the two. The overlapping area of ​​the two circles can be calculated by using the currently commonly used method of calculating the intersection area of ​​two circles. When implementing, it can be implemented by writing a program to calculate the intersection area of ​​two circles. When the area of ​​the overlapping portion is used to characterize the degree of overlap, the area of ​​the overlapping portion can be used as the degree of overlap, or the ratio of the area of ​​the overlapping portion to the area of ​​the circle in the sun image (or moon image) can be used as the degree of overlap.

[0058] For example, the degree of overlap between the moon image and the sun image can be characterized by the overlap length in the moving direction between the two. When calculating the overlap length, the radius of the moon image and the sun image, the center position of the circle on the moon image, and the center position of the circle on the sun image can be combined for calculation. When the overlap length is used to characterize the degree of overlap, the overlap length can be used as the degree of overlap, or the ratio between the overlap length and the diameter of the circle in the sun image (or moon image) can be used as the degree of overlap.

[0059] Step 102: Determine the target environment brightness corresponding to the overlap degree according to the overlap degree.

[0060] In the disclosed embodiment, after the degree of overlap between the moon image and the sun image is determined, the corresponding ambient brightness, ie, the target ambient brightness, may be determined according to the degree of overlap.

[0061] It can be understood that the more overlap there is between the moon image and the sun image, that is, the greater the degree of overlap, the greater the degree of solar eclipse phenomenon, and accordingly, the ambient brightness in the entire scene will become darker and darker. Therefore, in the embodiment of the present disclosure, the target ambient brightness is negatively correlated with the degree of overlap. In other words, the greater the degree of overlap, the smaller the corresponding target ambient brightness; the smaller the degree of overlap, the greater the corresponding target ambient brightness.

[0062] Exemplarily, taking the overlapping area as an example to characterize the degree of overlap between the moon image and the sun image, a mapping relationship table between different degrees of overlap and corresponding ambient brightness can be pre-set, and the mapping relationship table can be stored in the local memory. Thus, when determining the target ambient brightness corresponding to the degree of overlap, the mapping relationship table can be queried to find the target ambient brightness corresponding to the acquired degree of overlap. Among them, the value range of ambient brightness can be defined as 0 to 100 (including 0 and 100). When the value of ambient brightness is 100, it indicates that no solar eclipse has occurred or the solar eclipse has been completed. When the value of ambient brightness is 0, it indicates that a total solar eclipse has occurred.

[0063] Exemplarily, taking the ratio of the overlapping length to the diameter of a circle in the sun image (or moon image) as the degree of overlap, the ambient brightness when no solar eclipse occurs can be regarded as 1 (i.e. 100%), and the difference between 1 and the degree of overlap can be taken as the corresponding target ambient brightness.

[0064] Step 103, adjusting the transparency of the mask layer of the camera in the true scene according to the target environment brightness, so as to simulate the brightness change of the scene during the solar eclipse phenomenon.

[0065] The mask layer of the camera may be a black image added in front of the camera, and the black image may be a two-dimensional plane image.

[0066] In the disclosed embodiment, after determining the target environment brightness corresponding to the overlap degree, the transparency of the mask layer of the camera in the true scene can be adjusted according to the determined target environment brightness, thereby achieving the purpose of simulating the brightness changes of the scene during the solar eclipse phenomenon.

[0067] Exemplarily, assuming that the determined target environment brightness is a value between 0 and 100 in the above example, the transparency of the camera's mask layer can be adjusted according to the value. For example, when the transparency of the mask layer is the lowest (i.e., opaque, with a transparency of 0%), the environment brightness of the full-scene is the darkest. If the determined target environment brightness is 60, the transparency of the mask layer can be adjusted to 60%; if the determined target environment brightness is 100, the transparency of the mask layer is adjusted to the highest (i.e., fully transparent, with a transparency of 100%).

[0068] For example, assuming that the ambient brightness when there is no solar eclipse is regarded as 1 (i.e., 100%), and the difference between 1 and the degree of overlap is taken as the corresponding target ambient brightness, when adjusting the transparency of the mask layer of the camera according to the target ambient brightness, the transparency of the mask layer can be adjusted according to the product of the target ambient brightness and 100%. For example, if the determined target ambient brightness is 0.4, the transparency of the mask layer is adjusted to 40%.

[0069] It can be seen that in the embodiment of the present disclosure, only by adjusting the transparency of the mask layer of the camera, the brightness and darkness changes of the lighting in the entire scene corresponding to the changes in the degree of the solar eclipse phenomenon can be accurately simulated, thereby realizing the solar eclipse phenomenon in a true scene.

[0070] The method for simulating a solar eclipse phenomenon in a full-scale scene of the disclosed embodiment obtains the degree of overlap between the moon image and the sun image during the process of simulating the solar eclipse phenomenon in the full-scale scene, and determines the target environment brightness corresponding to the degree of overlap according to the degree of overlap, and then adjusts the transparency of the mask layer of the camera in the full-scale scene according to the target environment brightness, so as to simulate the brightness change of the scene during the solar eclipse phenomenon. The scheme disclosed in the present invention is adopted, by adding a mask layer to the camera, and adjusting the transparency of the mask layer according to the degree of overlap between the moon image and the sun image during the process of simulating the solar eclipse phenomenon, so as to achieve the purpose of simulating the brightness change of the scene during the solar eclipse phenomenon by adjusting the transparency of the mask layer, and vividly and figuratively displaying the solar eclipse phenomenon. Moreover, in the scheme, the change of the environment in the full-scale scene is achieved only by changing the transparency of the mask layer, and the requirements for the performance of the device are relatively low, and the dependence on the performance of the device is reduced. At the same time, the occurrence of the gang phenomenon is effectively avoided, and the simulation effect of the solar eclipse phenomenon is improved.

[0071] In an optional embodiment of the present disclosure, the lunar image used to simulate the solar eclipse phenomenon can be generated based on the input solar image. In this case, the method for simulating the solar eclipse phenomenon in a full-scale scene of the present disclosure may also include the following steps: obtaining preset initial position coordinates and the radius of the sun in the solar image; generating a black circular image based on the initial position coordinates and the radius; and using the black circular image as the lunar image.

[0072] The initial position coordinates and the radius of the sun in the solar image may be pre-set in the program, and the initial position coordinates are used to characterize the initial position of the moon in the generated lunar image.

[0073] In the disclosed embodiment, based on the preset initial position coordinates and the radius of the sun in the solar image, a black circular image can be generated, and the black circular image is used as the lunar image to complete the simulation of the solar eclipse phenomenon together with the solar image. When generating the black circular image, the initial position coordinates are used as the center of the circle, and the radius of the sun in the solar image is used as the radius to generate the black circular image, thereby obtaining the lunar image. The size of the lunar image is consistent with the size of the solar image, which is conducive to improving the simulation effect of the solar eclipse phenomenon.

[0074] For example, when a moon image is generated by a program, the generation of the moon image can be achieved by linking Tiling AndOffset and Ellipse functions in the program.

[0075] In an optional embodiment of the present disclosure, Figure 2 As shown, based on the above-mentioned embodiment, obtaining the degree of overlap between the moon image and the sun image may include the following steps:

[0076] Step 201, determining the moving distance of the moon image according to a preset moving step length and the current moving times.

[0077] The moving step length can be pre-set by a program, and the number of moves can be counted by a counter, the initial value of the counter is 0, and each time the moon image moves, the count value of the counter is accumulated by 1, so that the product of the moving step length and the number of moves represents the moving distance of the moon image. When the moon image moves, it can move according to a preset moving frequency.

[0078] Step 202: Determine the current position coordinates of the moon image according to the initial position coordinates and the moving distance.

[0079] In the disclosed embodiment, after the moving distance of the moon image is determined, the current position coordinates of the moon image can be determined based on the above initial position coordinates and the determined moving distance.

[0080] The current position coordinates refer to the coordinates of the position where the center of the circle representing the moon in the moon image is located.

[0081] It can be understood that when the lunar image moves in the horizontal direction (x direction), the x-direction coordinate of the center of the circle representing the moon changes, and the y-direction (vertical direction) coordinate remains unchanged. Therefore, in the embodiment of the present disclosure, the x-direction coordinate value in the current position coordinate can be added to the moving distance, and the coordinates in other directions remain unchanged, that is, the current position coordinates of the lunar image are obtained.

[0082] In an optional embodiment of the present disclosure, if the moving direction of the lunar image when moving toward the solar image is not horizontal, the moving direction of the lunar image can be calculated based on the initial position coordinates and the current position coordinates of the solar image (i.e., the position coordinates corresponding to the center of the circle representing the sun in the solar image), and then the current position coordinates of the lunar image can be calculated based on the initial position coordinates, the moving distance and the moving direction.

[0083] Step 203: Determine the relative distance between the moon image and the sun image based on the current position coordinates of the moon image and the current position coordinates of the sun image.

[0084] Among them, the current position coordinates of the sun image can be preset through the program.

[0085] In the disclosed embodiment, based on the current position coordinates of the moon image and the current position coordinates of the sun image, the distance between the moon image and the sun image, that is, the relative distance, can be calculated using the distance calculation formula between the two points.

[0086] Step 204: determining the overlap length between the moon image and the sun image based on the relative distance and the radius.

[0087] In the disclosed embodiment, based on the determined relative distance between the lunar image and the solar image, and the radius of the sun in the solar image, the maximum length of the overlapping portion in the moving direction between the lunar image and the solar image, referred to as the overlapping length, can be determined.

[0088] Exemplarily, when calculating the overlapping length, the result of (relative distance - 2*radius) can be expressed as the overlapping length. At this time, when the obtained difference is less than 0, it indicates that there is an overlap between the moon image and the sun image, that is, a solar eclipse occurs.

[0089] Exemplarily, when calculating the overlapping length, the result of (2*radius-relative distance) can be expressed as the overlapping length. At this time, when the obtained difference is greater than 0, it indicates that there is an overlap between the moon image and the sun image, that is, a solar eclipse occurs.

[0090] Figure 3 FIG. 1 is a schematic diagram showing the positional relationship between the moon image and the sun image in an exemplary embodiment of the present disclosure. Figure 3 Of the two circles shown, the left one represents the moon image, and the position of the center of the circle is the current position of the moon image. The right one represents the sun image, and the position of the center of the circle is the current position of the sun image. Figure 3As shown, there is a partial overlap between the solar image and the lunar image. The distance between point N on the lunar image and point M on the solar image, that is, the length of line segment MN, represents the overlapping length.

[0091] Step 205: Determine the overlap degree according to the overlap length.

[0092] In the embodiment of the present disclosure, after the overlapping length between the moon image and the sun image is determined, the overlapping degree between the moon image and the sun image can be determined according to the overlapping length.

[0093] Exemplarily, assuming that the result of (relative distance - 2*radius) is expressed as the overlapping length, when it is determined that the result of (relative distance - 2*radius) is less than 0, the absolute value of the obtained result (i.e., the overlapping length) is determined as the degree of overlap between the lunar image and the solar image; when it is determined that the result of (relative distance - 2*radius) is not less than 0, 0 is determined as the degree of overlap between the lunar image and the solar image.

[0094] Exemplarily, assuming that the overlapping length is twice the radius minus the difference of the relative distance, that is, the result of (2*radius-relative distance) is expressed as the overlapping length, then when it is determined that the overlapping length is greater than 0, the ratio between the overlapping length and twice the radius is determined as the degree of overlap, that is, the degree of overlap = overlapping length / (2*radius); when it is determined that the overlapping length is not greater than 0, 0 is determined as the degree of overlap between the lunar image and the solar image.

[0095] The method for simulating a solar eclipse phenomenon in a true-to-life scenario in an embodiment of the present disclosure determines the moving distance of the lunar image according to a preset moving step and the current number of movements, and determines the current position coordinates of the lunar image according to the initial position coordinates and the moving distance, and then determines the relative distance between the lunar image and the solar image based on the current position coordinates of the lunar image and the current position coordinates of the solar image, and determines the overlapping length between the lunar image and the solar image based on the relative distance and the radius, and then determines the degree of overlap between the lunar image and the solar image according to the overlapping length. Thus, a method for accurately determining the degree of overlap between the lunar image and the solar image is provided, which provides conditions for accurately simulating a solar eclipse phenomenon.

[0096] In a full-scale scene, the character is sometimes still and sometimes moving. When the character moves, the direction of the camera following the character changes accordingly, so as to switch the presentation content in the full-scale scene following the movement of the character, thereby improving the user's immersive experience. When the character moves, if the sun image still maintains its original direction, the character may not be able to feel the better effect of the solar eclipse phenomenon. Therefore, in an optional implementation of the present disclosure, in order to improve the user experience, the direction of the camera can be obtained at a preset frequency, and then the direction of the sun image and the moon image can be adjusted according to the direction of the camera, so that the direction of the sun image and the moon image is facing the camera, so that the user can have a better experience.

[0097] It should be noted that in the embodiment of the present disclosure, when the lunar image is generated based on the solar image, only the direction of the solar image can be adjusted to face the camera. Since the lunar image is generated based on the solar image, adjusting the direction of the solar image is equivalent to adjusting the direction of the lunar image.

[0098] In an optional embodiment of the present disclosure, when obtaining the orientation of the camera, the position coordinates of the character in the real scene when facing the sun image (called the first position coordinates) and the position coordinates of the character's current position (called the second position coordinates) can be obtained first, and then the moving direction and angle of the character relative to the sun image are determined based on the first position coordinates, the second position coordinates and the current position coordinates of the sun image, and then the orientation of the camera is determined based on the moving direction and angle.

[0099] Figure 4 FIG. 1 shows a schematic diagram of the movement of a character in a real scene in an exemplary embodiment of the present disclosure. Figure 4 The circle shown in represents the sun image, the position coordinates corresponding to the center of the circle and the current position coordinates of the sun image, point A represents the first position coordinates of the character in the full-scale scene when it faces the sun image, and point B represents the second position coordinates of the character's current position. Figure 4 It can be seen from the positions of the midpoint A and the point B that the character moves to the right, that is, the moving direction is to the right. According to the first position coordinate, the second position coordinate and the current position coordinate of the sun image, the moving angle of the character can also be determined. Figure 4 The α in it represents the moving angle.

[0100] In the disclosed embodiment, the orientation of the camera can be determined according to the determined moving direction and moving angle of the character in the real scene. For example, if the determined moving direction is moving to the right and the moving angle is 30 degrees, the orientation of the camera can be determined to be offset 30 degrees to the right. Furthermore, when adjusting the orientation of the sun image and the moon image, the orientation of the sun image and the moon image can also be offset 30 degrees to the right, that is, rotated 30 degrees counterclockwise from the current orientation.

[0101] In practical applications, the directions of the sun image and the moon image can be refreshed at a preset frequency through a program so that they always face the camera.

[0102] In the disclosed embodiment, the orientation of the camera is obtained at a preset frequency, and the orientations of the sun image and the moon image are adjusted according to the orientation of the camera so that the sun image and the moon image face the camera. This ensures that the camera is always facing the sun image and the moon image, that is, the camera always captures the process of the solar eclipse phenomenon, allowing users to experience the solar eclipse phenomenon in an immersive way, thereby enhancing user experience.

[0103] In practical applications, a Shader file can be pre-written to simulate the occurrence of a solar eclipse. By importing a solar image, according to the outline of the solar image, the generation of the lunar image and the displacement of the moon over time are realized by linking the Tiling And Offset and Ellipse functions in the Shader file. The refresh range of the lunar displacement is set by linking Step and One Minus, and the relevant data is summarized by Add. The Sample Texture 2D node is used to expose the interface for easy reference to the solar image. After the Shader file is written, a new material ball can be created to reference the Shader file, and a new empty node can be created in the scene to reference the newly created material ball, and then the pre-prepared solar image can be referenced through the node, and the parameters such as the radius of the sun, the initial position coordinates of the lunar image, and the moving step length are set. In addition, a black two-dimensional picture is added to the full-scale scene as the mask layer of the camera, and the displacement of the lunar image and the transparency of the refreshed mask layer are synchronously changed according to the preset frequency. The transparency of the mask layer can be determined according to the degree of overlap between the lunar image and the solar image. When the moving distance of the moon image reaches the distance threshold, it indicates that a solar eclipse is complete. At this time, the Shader related parameters can be reset and the mask layer of the camera can be removed. The distance threshold can be preset, for example, the distance threshold is set to (the distance between the initial position coordinates and the current position coordinates of the sun image + 2*the radius of the sun in the sun image). The above scheme is adopted to achieve the purpose of simulating the solar eclipse phenomenon in the full-scale scene, and the change of the ambient brightness in the full-scale scene is realized by changing the transparency of the mask layer.

[0104] The exemplary embodiments of the present disclosure also provide a device for simulating a solar eclipse phenomenon in a true scene. Figure 5 A schematic block diagram of a device for simulating a solar eclipse phenomenon in a full-scale scene according to an exemplary embodiment of the present disclosure is shown. Figure 5 As shown, the device 50 for simulating the solar eclipse phenomenon in a full-scale scene includes: an acquisition module 510, a determination module 520 and an adjustment module 530.

[0105] The acquisition module 510 is used to acquire the degree of overlap between the moon image and the sun image in the process of simulating the solar eclipse phenomenon in a full-scale scene;

[0106] A determination module 520, configured to determine, according to the overlap degree, a target environment brightness corresponding to the overlap degree;

[0107] The adjustment module 530 is used to adjust the transparency of the mask layer of the camera in the true scene according to the target environment brightness, so as to simulate the brightness change of the scene during the solar eclipse phenomenon.

[0108] Optionally, the device 50 for simulating a solar eclipse phenomenon in a real scene further includes:

[0109] A parameter acquisition module, used to acquire preset initial position coordinates and the radius of the sun in the solar image;

[0110] A generating module is used to generate a black circular image based on the initial position coordinates and the radius, and use the black circular image as the moon image.

[0111] Optionally, the acquisition module 510 includes:

[0112] A first determining unit, configured to determine a moving distance of the moon image according to a preset moving step length and a current moving number;

[0113] A second determining unit, configured to determine the current position coordinates of the lunar image according to the initial position coordinates and the moving distance;

[0114] a third determining unit, configured to determine a relative distance between the lunar image and the solar image based on the current position coordinates of the lunar image and the current position coordinates of the solar image;

[0115] a fourth determining unit, configured to determine an overlapping length between the moon image and the sun image based on the relative distance and the radius;

[0116] A fifth determining unit is used to determine the overlap degree according to the overlap length.

[0117] Optionally, the overlapping length is a difference between twice the radius and the relative distance; and the fifth determining unit is further configured to:

[0118] In response to the overlap length being greater than 0, determining the overlap degree as a ratio between the overlap length and twice the radius;

[0119] In response to the overlap length being not greater than 0, the overlap degree is determined to be 0.

[0120] Optionally, the device 50 for simulating a solar eclipse phenomenon in a real scene further includes:

[0121] A direction acquisition module, used to acquire the direction of the camera according to a preset frequency;

[0122] The orientation adjustment module is used to adjust the orientations of the sun image and the moon image according to the orientation of the camera so that the sun image and the moon image face the camera.

[0123] Optionally, the orientation acquisition module is further used to:

[0124] Acquire a first position coordinate of the human character in the full-scale scene when the human character faces the sun image, and a second position coordinate of the human character's current position;

[0125] Determining a moving direction and a moving angle of the character relative to the sun image according to the first position coordinates, the second position coordinates and the current position coordinates of the sun image;

[0126] Based on the moving direction and the moving angle, the orientation of the camera is determined.

[0127] Optionally, the target environment brightness is negatively correlated with the overlap degree.

[0128] The device for simulating a solar eclipse in a real scene provided in the embodiments of the present disclosure can execute any method for simulating a solar eclipse in a real scene that can be applied to an electronic device provided in the embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method. For the contents not fully described in the embodiments of the device of the present disclosure, reference can be made to the description in any method embodiment of the present disclosure.

[0129] The exemplary embodiment of the present disclosure also provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and when the computer program is executed by the at least one processor, the electronic device executes the method for simulating a solar eclipse phenomenon in a full-scale scene according to the embodiment of the present disclosure.

[0130] The exemplary embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute a method for simulating a solar eclipse phenomenon in a full-scale scenario according to an embodiment of the present disclosure.

[0131] The exemplary embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to execute the method for simulating a solar eclipse phenomenon in a full-scale scenario according to the embodiments of the present disclosure.

[0132] refer to Figure 6 , a block diagram of an electronic device 1100 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0133] like Figure 6 As shown, the electronic device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0134] Multiple components in the electronic device 1100 are connected to the I / O interface 1105, including: an input unit 1106, an output unit 1107, a storage unit 1108, and a communication unit 1109. The input unit 1106 can be any type of device that can input information to the electronic device 1100, and the input unit 1106 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device. The output unit 1107 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1108 can include but is not limited to a disk, an optical disk. The communication unit 1109 allows the electronic device 1100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0135] The computing unit 1101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1101 performs the various methods and processes described above. For example, in some embodiments, the method for simulating a solar eclipse phenomenon in a full-scale scene may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1100 via the ROM 1102 and / or the communication unit 1109. In some embodiments, the computing unit 1101 may be configured to perform a method for simulating a solar eclipse phenomenon in a full-scale scene by any other appropriate means (e.g., by means of firmware).

[0136] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0137] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0138] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0139] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0140] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0141] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

Claims

1. A method for simulating a solar eclipse in a realistic scenario, wherein: The method comprises: Get the preset initial position coordinates and the radius of the sun in the sun image; Based on the initial position coordinates and the radius, a black circular image is generated; Using the black circular image as the moon image; In the process of simulating a solar eclipse phenomenon in a real scene, obtaining the degree of overlap between the moon image and the sun image; According to the overlap degree, determining the target environment brightness corresponding to the overlap degree; According to the target environment brightness, the transparency of the mask layer of the camera in the true scene is adjusted to simulate the brightness change of the scene during the solar eclipse phenomenon.

2. The method for simulating a solar eclipse in a realistic scene as claimed in claim 1, wherein: The obtaining the degree of overlap between the lunar image and the solar image comprises: Determining the moving distance of the moon image according to a preset moving step length and a current moving number; Determining the current position coordinates of the lunar image according to the initial position coordinates and the moving distance; Determine a relative distance between the lunar image and the solar image based on the current position coordinates of the lunar image and the current position coordinates of the solar image; determining an overlap length between the moon image and the sun image based on the relative distance and the radius; The overlapping degree is determined according to the overlapping length.

3. The method for simulating a solar eclipse in a realistic scene as claimed in claim 2, wherein: The overlap length is twice the radius minus the relative distance; And wherein, determining the overlap degree according to the overlap length comprises: In response to the overlap length being greater than 0, determining the overlap degree as a ratio between the overlap length and twice the radius; In response to the overlap length being not greater than 0, the overlap degree is determined to be 0.

4. The method for simulating a solar eclipse in a realistic scene as claimed in claim 1, wherein: The method further comprises: Obtaining the direction of the camera according to a preset frequency; According to the orientation of the camera, the orientations of the sun image and the moon image are adjusted so that the sun image and the moon image face the camera.

5. The method for simulating a solar eclipse in a realistic scene as claimed in claim 4, wherein: The obtaining the direction of the camera includes: Acquire a first position coordinate of the human character in the full-scale scene when the human character faces the sun image, and a second position coordinate of the human character's current position; Determining a moving direction and a moving angle of the character relative to the sun image according to the first position coordinates, the second position coordinates and the current position coordinates of the sun image; Based on the moving direction and the moving angle, the orientation of the camera is determined.

6. The method for simulating a solar eclipse in a realistic scene according to any one of claims 1 to 5, wherein: The target environment brightness is negatively correlated with the overlap degree.

7. A device for simulating a solar eclipse in a realistic scene, wherein: The device comprises: A parameter acquisition module is used to obtain the preset initial position coordinates and the radius of the sun in the sun image; A generating module, used for generating a black circular image based on the initial position coordinates and the radius, and using the black circular image as a moon image; An acquisition module, used for acquiring the degree of overlap between the moon image and the sun image in a process of simulating a solar eclipse phenomenon in a true scene; A determination module, configured to determine, according to the overlap degree, a target environment brightness corresponding to the overlap degree; The adjustment module is used to adjust the transparency of the mask layer of the camera in the true scene according to the brightness of the target environment to simulate the brightness change of the scene during the solar eclipse phenomenon.

8. An electronic device, comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, enable the processor to perform the method for simulating a solar eclipse phenomenon in a full-scale scenario according to any one of claims 1-6.

9. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the method for simulating a solar eclipse phenomenon in a full-scale scene according to any one of claims 1-6.

Citation Information

Patent Citations

  • Image processing method and device, electronic device and storage medium

    CN107393017A

  • Virtual object adjustment method and device, storage medium and augmented reality equipment

    CN111415422A