Virtual scenario rendering method and apparatus, device, medium, and program product
By using the geocentric coordinate system to establish a section coordinate system in the virtual scene, and calculating the rendering parameters in combination with the height values of the camera and reference position points, the problem of inaccurate fog effect display in three-dimensional virtual scenes is solved, and more realistic and accurate fog effect rendering is achieved.
Patent Information
- Application Number
- PCT/CN2025/074835
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-06
- Filing Date
- 2025-01-24
- Publication Date
- 2025-08-14
AI Technical Summary
In traditional technology, plane fog effect is inaccurately displayed in three-dimensional virtual scenes, and the height index fog effect cannot be accurately displayed.
The center of the earth is used to establish a tangent coordinate system. By obtaining the projection point of the virtual camera position point on the virtual earth surface, determining the tangent coordinate system, combining the camera height value and the height value of the reference position point, calculating the rendering height parameter value, and performing fog-effect rendering.
It realizes accurate rendering of fog effect in three-dimensional virtual scenes, improving the fit and immersion between fog effect and virtual scenes.
Smart Images

Figure CN2025074835_14082025_PF_FP_ABST
Abstract
Description
Virtual scene rendering method, device, equipment, medium and program product
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2024101721398, filed on February 6, 2024, entitled “Method, device, equipment, medium and program product for fog effect processing of virtual scenes”, the entire text of which is hereby incorporated by reference. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a virtual scene rendering method, apparatus, computer equipment, storage medium, and computer program product. Background Art
[0004] With the advancement of computer technology, the application of virtual scenes is becoming increasingly widespread. For example, in digital twin virtual scenes, sunlight is almost always used to illuminate the entire scene. In some virtual scenes, lighting effects and fog effects are combined for real-time display to enhance the real-time and immersive feeling of the entire scene.
[0005] However, in traditional technologies, fog effects in virtual scenes are generally displayed based on a plane. For a spherical three-dimensional virtual scene, directly applying the fog effect in the plane to the spherical three-dimensional virtual scene is likely to cause inaccurate fog effect display. Summary of the Invention
[0006] The present application provides a virtual scene rendering method, apparatus, computer equipment, computer-readable storage medium, and computer program product.
[0007] In a first aspect, the present application provides a virtual scene rendering method, which is executed by a computer device, and the method includes:
[0008] Obtaining a camera position point of a virtual camera of a virtual scene in a geocentric coordinate system of the virtual scene;
[0009] Determining the projection point of the camera position point on the surface of the virtual earth of the virtual scene in the geocentric coordinate system, and establishing a section coordinate system with the direction perpendicular to the section of the virtual earth surface at the coordinate origin as the height direction, with the projection point as the coordinate origin;
[0010] Acquire reference position points in the virtual scene, and determine a height value of each reference position point in the height direction in the section coordinate system;
[0011] Obtaining a camera height value of the virtual camera from the surface of the virtual earth, and adding the camera height value to the height value of each virtual reference point to obtain a rendering height parameter value of each virtual reference point; and
[0012] Under the viewing angle of the virtual camera, the fog effect of the virtual scene is rendered according to each of the rendering height parameter values.
[0013] In a second aspect, the present application further provides a virtual scene rendering device, the device comprising:
[0014] A camera position point acquisition module, used to acquire a camera position point of a virtual camera of a virtual scene in a geocentric coordinate system of the virtual scene;
[0015] a coordinate system establishment module, configured to determine, in the geocentric coordinate system, a projection point of the camera position point on the surface of the virtual earth of the virtual scene, and establish, with the projection point as the coordinate origin, a section coordinate system with a direction perpendicular to a section of the virtual earth surface at the coordinate origin as the height direction;
[0016] a height value determination module, configured to obtain reference position points in the virtual scene and determine a height value of each reference position point in the height direction in the section coordinate system;
[0017] a rendering height parameter value determination module, configured to obtain a camera height value of the virtual camera from the surface of the virtual earth, and add the camera height value to the height value of each virtual reference point to obtain a rendering height parameter value of each virtual reference point;
[0018] A fog effect rendering module is used to render the fog effect of the virtual scene according to each of the rendering height parameter values under the viewing angle of the virtual camera.
[0019] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned virtual scene rendering method when executing the computer program.
[0020] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned virtual scene rendering method when executed by a processor.
[0021] In a fifth aspect, the present application further provides a computer program product, which includes a computer program that implements the above-mentioned virtual scene rendering method when executed by a processor.
[0022] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0024] FIG1 is a diagram illustrating an application environment of a virtual scene rendering method according to an embodiment;
[0025] FIG2 is a schematic diagram of a flow chart of a virtual scene rendering method according to an embodiment;
[0026] FIG3 is a schematic diagram of establishing a section coordinate system based on a geocentric coordinate system in one embodiment;
[0027] FIG4 is a schematic diagram of fog effect display of a virtual scene in one embodiment;
[0028] FIG5 is a schematic diagram of fog effect display of a virtual scene in another embodiment;
[0029] FIG6 is a schematic diagram of a fusion rendering effect of fog effect and lighting effect of a virtual scene in one embodiment;
[0030] FIG7 is a schematic diagram of a flow chart of a virtual scene rendering method according to an embodiment;
[0031] FIG8 is a block diagram of a virtual scene rendering device according to an embodiment;
[0032] FIG9 is a diagram showing the internal structure of a computer device according to one embodiment;
[0033] FIG10 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0035] The virtual scene rendering method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 120 communicates with the server 140 through a network. The communication network can be a wired network or a wireless network. Therefore, the terminal 120 and the server 140 can be directly or indirectly connected through wired or wireless communication. For example, the terminal 120 can be indirectly connected to the server 140 through a wireless access point, or the terminal 120 can be directly connected to the server 140 through the Internet. This application does not limit this. The terminal 120 can load an application involving the display of a virtual scene, and when the application is started, the virtual scene is displayed through the display interface of the terminal 120. The user can trigger the configuration operation of the fog effect for the virtual scene, determine the fog effect to be displayed in the virtual scene, and interact with the terminal 120 on this basis. After determining the fog effect parameters configured by the configuration operation of the fog effect, the terminal 120 can interact with the server 140 of the application to obtain the functions provided by the server 140, which can be, for example, twin scene display, map navigation function, game service function, etc. For example, the terminal 120 may send fog effect configuration parameters of the exponential height fog to the server 140 , and the server 140 may perform fog effect rendering, and display the exponential height fog effect in the virtual scene displayed on the terminal 120 .
[0036] Furthermore, this application does not limit the specific form of the application, including but not limited to a client installed in the terminal 120, a mini-program, etc., and can also be in the form of a web page. Those skilled in the art will appreciate that the number of the above-mentioned terminals 120 can be one or more, and this application does not limit the number or device type of the terminals 120.
[0037] Among them, the terminal 120 includes but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 140 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The data storage system can store data that the server 140 needs to process. The data storage system can be set up separately, integrated on the server 140, or placed on the cloud or other servers.
[0038] In the virtual scene rendering method provided in the embodiments of the present application, each step may be performed by a computer device, which refers to an electronic device capable of computing, processing, and storing data. Taking the implementation environment shown in FIG1 as an example, the virtual scene rendering method may be performed by terminal 120, server 140, or both, although this embodiment of the present application does not limit this.
[0039] The virtual scene rendering method provided by the present application can be applied to the map field and the transportation field. For example, the present application can be applied to intelligent transportation systems and intelligent vehicle-road cooperative systems to display fog effects in three-dimensional maps in combination with weather conditions. Among them, the Intelligent Traffic System (ITS), also known as the Intelligent Transportation System (ITS), is an effective and comprehensive application of advanced science and technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operations research, artificial intelligence, etc.) to transportation, service control and vehicle manufacturing, strengthening the connection between vehicles, roads and users, thereby forming a comprehensive transportation system that ensures safety, improves efficiency, improves the environment and saves energy. Intelligent Vehicle Infrastructure Cooperative Systems (IVICS), referred to as vehicle-road cooperative systems, is a development direction of intelligent transportation systems (ITS). The vehicle-road cooperative system adopts advanced wireless communication and new generation Internet technologies to implement all-round dynamic real-time information interaction between vehicles and roads, and carries out vehicle active safety control and road cooperative management based on the collection and integration of dynamic traffic information in all time and space, fully realizing the effective coordination between people, vehicles and roads, ensuring traffic safety, and improving traffic efficiency, thus forming a safe, efficient and environmentally friendly road traffic system.
[0040] The following is a brief introduction to the terms involved in the embodiments of this application.
[0041] A geographic coordinate system uses a three-dimensional sphere to define locations on the Earth's surface, enabling reference to points on the Earth's surface using longitude and latitude. The coordinate axes in a geographic coordinate system are: the X-axis is longitude, representing longitude (the default is east longitude); the Y-axis is latitude, representing latitude (the default is north latitude); and the Z-axis is height, representing altitude (the default altitude on the virtual Earth's surface is 0). The coordinates of a specific point in a geographic coordinate system are expressed as Cartographic(longitude, latitude, height).
[0042] The Earth-Centered, Earth-Fixed (ECEF) coordinate system, also known as the spherical Cartesian coordinate system, has its origin, O(0,0,0), at the Earth's center of mass. The Z axis, parallel to the Earth's axis, points to the North Pole, typically 0 degrees east longitude and 90 degrees north latitude by default. The X axis points to the intersection of the prime meridian and the equator, typically 0 degrees east longitude and 0 degrees north latitude by default. The Y axis is perpendicular to the xOz plane (i.e., the intersection of 90 degrees east longitude and the equator), typically 90 degrees east longitude and 0 degrees north latitude by default, forming a right-handed coordinate system. In this geocentric coordinate system, the coordinates of each point are expressed using Cartesian3(x,y,z). The center of the Earth can be the Earth's center of mass in a virtual scene.
[0043] The tangent plane coordinate system, also known as the ENU coordinate system, is a right-handed coordinate system with a specific geographic location as its origin and the local horizontal plane at that location as its reference plane. E stands for East, N for North, and U for Up. The coordinates of each point in the tangent plane coordinate system are represented by EarthNorthUp(lx,ly,lz).
[0044] Height Exponential Fog: The fog effect decays exponentially as the height approaches the ground. The fog attenuation is as follows: larger values result in sparser fog in the upper half, while smaller values result in a more even density across the entire fog.
[0045] Take the case of a digital twin scene where the fog effect rendering scene is a three-dimensional sphere as an example. In traditional technology, the fog effect of mobile devices is generally rendered on a two-dimensional image, and only a flat fog effect can be displayed. However, the digital twin scene is a three-dimensional spherical scene. In the twin scene display, the sunlight element is almost always used to illuminate the entire scene. For the sunlight element in the scene, the existing production solution is to use a fixed parallel light to simulate the sunlight in the three-dimensional engine, and then render the simulation in the three-dimensional scene. In addition, in order to display the height index fog in the digital twin scene, the height index fog needs to be integrated with the sunlight effect. Traditional flat fog effects are generally only applicable to two-dimensional images. Therefore, the height index fog of the digital twin scene based on the geocentric coordinate system will also be affected, and there will be problems with incorrect display.
[0046] To address the problems existing in conventional technologies, the present application provides a virtual scene rendering method, as shown in FIG2 . The computer device may be the terminal or server shown in FIG1 . In this embodiment, the method is described by taking the terminal in FIG1 as an example, and includes the following steps:
[0047] Step 202: Obtain a camera position point of a virtual camera of the virtual scene in the geocentric coordinate system of the virtual scene.
[0048] Among them, the geocentric coordinate system is the abbreviation of the Earth-Centered, Earth-Fixed (ECEF) rectangular coordinate system, also known as the geocentric coordinate system spherical Cartesian coordinate system.
[0049] In one embodiment, the geocentric coordinate system can be a spherical coordinate system established with the center of the earth as the coordinate origin of the coordinate system, the center of the earth pointing to 0 degrees east longitude and 0 degrees north latitude as the X-axis; the center of the earth pointing to 90 degrees east longitude and 0 degrees north latitude as the Y-axis, and the center of the earth pointing to 0 degrees east longitude and 90 degrees north latitude as the Z-axis. Simply put, the X-axis points to the intersection of the prime meridian and the equator, the Z-axis is parallel to the earth's axis and points to the North Pole, and the Y-axis is perpendicular to the xOz plane, forming a right-handed coordinate system.
[0050] It is understandable that in other embodiments, the X-axis of the geocentric coordinate system may also be the intersection of other meridians and the equator, and the Y-axis is adjusted synchronously with the position of the X-axis.
[0051] A virtual scene is a three-dimensional scene simulated based on a geocentric coordinate system. Each location in the virtual scene has a corresponding geographic location, which is specifically represented by the location's longitude, latitude, and altitude relative to the ground plane, where the ground plane is defined as the Earth's surface at an altitude of 0. Specifically, virtual scenes can be digital twins, three-dimensional maps, or interactive game scenes. The specific type of virtual scene can be configured based on actual application needs and is not limited here.
[0052] The position of the virtual camera in the virtual scene is used to represent the user's field of view position in the virtual scene. By changing the position of the virtual camera in the virtual scene, content from different perspectives can be displayed in the spherical three-dimensional virtual scene. For example, by rotating the virtual camera 90 degrees horizontally to the left, the display content of the virtual scene can be adjusted from the scene directly in front to the scene directly to the left. For example, rotating the virtual camera up and down is equivalent to changing the pitch angle of the current field of view to adjust the content displayed in the virtual scene. The camera position point representing the position of the virtual camera is used to reflect the position of the virtual camera in the geocentric coordinate system. The camera position point can be specifically located by the coordinates in the geocentric coordinate system. Specifically, the camera position point can be a point representing the position of any virtual camera, a point at the geometric center of the virtual camera, or a point at the center of gravity of the virtual camera.
[0053] In one specific embodiment, the computer device can first determine a camera position point in the geocentric coordinate system that represents the position of the virtual camera in the virtual scene based on the area where the virtual scene is located in the geocentric coordinate system and the relative position of the virtual camera and the virtual scene.
[0054] In another specific embodiment, the computer device can first determine the coordinates of the virtual camera's position in the geographic coordinate system based on the geographic location information of the virtual scene, and then obtain the coordinates of the virtual camera's position in the geocentric coordinate system through coordinate conversion under different coordinate systems. The point represented by the coordinates in the geocentric coordinate system is the camera position point in the geocentric coordinate system.
[0055] In this embodiment, by obtaining the camera position point representing the position of the virtual camera in the virtual scene in the geocentric coordinate system, the height information of the position of the virtual camera in the three-dimensional virtual scene of the spherical surface can be accurately determined, which facilitates the rendering height parameter value analysis with the position of the virtual camera as a reference to obtain accurate rendering height parameter value analysis results.
[0056] Step 204: determine the projection point of the camera position on the virtual earth surface of the virtual scene in the geocentric coordinate system, take the projection point as the coordinate origin, and establish a section coordinate system with the direction perpendicular to the section of the virtual earth surface at the coordinate origin as the height direction.
[0057] The virtual earth surface refers to the surface layer on the earth with an altitude of zero. In this embodiment, the virtual earth surface in the virtual scene is the surface layer with an altitude of zero in the virtual scene. The projection of the camera position point on the virtual earth surface has a projection direction that is the direction of the line connecting the camera position point and the center of the earth, and the projection plane is a plane with an altitude of zero. That is, the projection point of the camera position point on the virtual earth surface is a point on the virtual earth surface. It can be understood that the distance between the projection point of the camera position point on the virtual earth surface and the camera position point is the camera height value of the virtual camera. The height direction of the section coordinate system refers to the direction that represents the height of any point in the section coordinate system. The component of any point in the section coordinate system in this height direction represents the height value of the point in the section coordinate system. The height direction can be a direction perpendicular to the section at the coordinate origin and pointing from the coordinate origin to the outside of the virtual earth.
[0058] As shown in Figure 3, the section coordinate system is a section coordinate system constructed with the projection point of the camera position point on the spherical coordinate line as the coordinate origin and with reference to the coordinate axis direction of the geocentric coordinate system. Specifically, the Z-axis direction of the section coordinate system can be the direction from the coordinate origin to the camera position point, which is consistent with the direction from the center of the earth to the camera position point. The X-axis direction of the section coordinate system is the longitude direction, and the Y-axis direction in the section coordinate system is the latitude direction. In the section coordinate system shown in Figure 3, the Z-axis direction can be used as the height direction of the section coordinate system. After the section coordinate system is established, any point in the geocentric coordinate system can be converted to the section coordinate system. The section coordinate system can also be called a local section coordinate system.
[0059] In one embodiment, determining the projection point of the camera position point on the surface of the virtual earth of the virtual scene in the geocentric coordinate system, taking the projection point as the coordinate origin, and establishing a section coordinate system with the direction perpendicular to the section of the virtual earth surface at the coordinate origin as the height direction includes:
[0060] Taking the projection point of the camera position point on the surface of the virtual earth as the tangent point, determine the tangent plane tangent to the sphere where the geocentric coordinate system is located; taking the projection point as the coordinate origin, the longitude and latitude directions on the tangent plane and the direction of the line connecting the coordinate origin of the geocentric coordinate system to the camera position point as the coordinate axis directions, establish a tangent plane coordinate system with the direction perpendicular to the tangent plane on the surface of the virtual earth at the coordinate origin as the height direction.
[0061] Specifically, the camera position is projected onto the Earth's surface at an altitude of 0 along the line connecting the camera position and the Earth's center. This yields the projection point of the camera position on the virtual Earth's surface. This projection point is then used as the tangent point to determine a sphere centered on the Earth's center and a tangent plane tangent to the sphere through the tangent point. The direction from the Earth's center to the camera position is used as the Z axis of the tangent plane coordinate system, and the tangent plane tangent to the sphere through the tangent point is used as the XOY plane of the tangent plane coordinate system. In the XOY plane, the direction parallel to the longitude is used as the X axis of the tangent plane coordinate system, and the direction parallel to the latitude is used as the Y axis of the tangent plane coordinate system. The X, Y, and Z axis directions of the tangent plane coordinate system are thus determined. The projection point of the camera position on the virtual Earth's surface is used as the coordinate origin, and the tangent plane coordinate system is established using the X, Y, and Z axis directions determined in this manner.
[0062] In this embodiment, the projection point of the camera position point on the virtual earth surface is used as the coordinate origin, and the tangent plane passing through the tangent point and tangent to the sphere is used as the XOY plane. The virtual earth surface within the viewing angle of the simulated virtual camera is approximated by the tangent plane coordinate system to approximate the height of each reference position point in the virtual scene compared to the virtual earth surface, which can reduce the difficulty of fog effect rendering.
[0063] Furthermore, by taking the direction parallel to the longitude as the X-axis direction of the section coordinate system and the direction parallel to the latitude as the Y-axis direction of the section coordinate system, the coordinate axis direction of the section coordinate system can be associated with the coordinate axis direction of the geocentric coordinate system, and the coordinate conversion relationship between the section coordinate system and the geocentric coordinate system can be simplified. When performing coordinate conversion, the data processing efficiency can be effectively improved and the occupation of computer processing resources can be reduced.
[0064] Step 206 : Acquire reference position points in the virtual scene, and determine the height value of each reference position point in the height direction of the section coordinate system.
[0065] The reference location point is the location in the virtual scene that is required to display the fog effect. There can be multiple reference locations. In specific applications, the reference location point can be any location in the virtual scene, or it can be a specific location selected from the virtual scene based on preset location filtering rules. The location filtering rules can be random filtering or filtering based on the location of virtual objects in the virtual scene.
[0066] The height value is the height coordinate value of the reference position point in the section coordinate system. For example, if the coordinates of point A in the section coordinate system are (100, 200, 50), then the height coordinate value of point A in the section coordinate system is 50 (meters), which means that the height difference between point A and the surface of the virtual earth is 50 meters.
[0067] In a specific embodiment, the computer device can obtain the geographic location information of the reference location point in the virtual scene based on the relative position of the reference location point in the virtual scene and the geographic location information of the virtual scene, and then perform coordinate conversion according to the geographic location information to calculate the coordinate value of the reference location point in the section coordinate system, and then determine the height coordinate value in the coordinate value as the height value of the reference location point in the section coordinate system.
[0068] In this embodiment, by determining the height value of each reference position point in the virtual scene in the section coordinate system, the height of the reference position point in the spherical three-dimensional virtual scene compared to the virtual earth surface can be accurately located, thereby facilitating the accurate determination of the rendering height parameter value required for each reference position point.
[0069] Step 208 : Obtain the camera height value of the virtual camera from the virtual earth surface, and add the camera height value to the height value of each virtual reference point to obtain the rendering height parameter value of each virtual reference point.
[0070] The camera height value of the virtual camera position can be obtained by projecting the camera position point representing the virtual camera position onto the surface of the virtual earth toward the center of the earth. The distance between the position of the projected point and the position of the virtual camera is the camera height value of the virtual camera position. The rendering height parameter value of each reference position point can be calculated by adding the camera height value of the virtual camera position to the height value of each reference position point.
[0071] The Render Height parameter controls the height of the rendered fog effect. The higher the Render Height parameter value, the higher the height of the fog effect that the user can visually see.
[0072] In one embodiment, the rendering height parameter value may be the height value at which the fog effect begins to fade from a high-concentration fog effect, that is, when the fog effect height value is lower than the rendering height parameter value, the preset high-concentration range is maintained. When the height value is greater than or equal to the rendering height parameter value, the concentration of the fog effect fades to a low-concentration fog until it is visually invisible or the concentration becomes 0. In a specific embodiment, the rendering height parameter value may be the height value of the exponential height fog. Any concentration within the high-concentration range is higher than any concentration within the low-concentration range. The high-concentration range and the low-concentration range can be set according to actual conditions.
[0073] In one embodiment, the fog effect has the highest concentration at the position where the height value is 0, and the fog effect concentration gradually decreases as the height increases. In this process, within a certain range (high concentration range), it belongs to the high concentration fog effect interval. After reaching a certain critical point, if it continues to fade, it enters the low concentration range. This critical point can be the rendering height parameter value.
[0074] In one embodiment, the rendering height parameter value may be the highest height value at which the fog effect is visually visible, that is, the fog effect is visually visible at a height less than the rendering height parameter value, and is visually invisible at a height greater than or equal to the rendering height parameter value.
[0075] By adding the camera height value of the virtual camera to the height value of the reference position point, on the one hand, the height value of the virtual camera is taken into account, and the rendering of the fog effect is positively correlated with the camera height value of the virtual camera. The picture captured by the virtual camera at any location in the virtual scene can effectively reflect the fog effect. On the other hand, since the height value in the section coordinate system is based on the section passing through the projection point as the reference plane, the farther the projection point of the reference position point in the virtual scene on the section is from the projection point of the virtual camera, the more the reference position point deviates from the surface of the virtual earth. After height superposition, the reference position point farther away from the virtual camera can present a more obvious fog effect. It can visually form a fog effect that matches the virtual scene, ensure that the fog effect in the virtual scene changes with the position of the virtual camera, and improve the degree of fit between the fog effect and the virtual scene.
[0076] Step 210 : Rendering the fog effect of the virtual scene according to the values of the rendering height parameters from the perspective of the virtual camera.
[0077] The rendering height parameter value is the basis for determining the fog effect displayed in the virtual scene. As shown in Figures 4 and 5, the superposition results of different virtual camera heights and reference position point heights correspond to different rendering height parameter values. Fog effect rendering refers to rendering the fog effect in the virtual scene so that the user can see the virtual scene with fog effect through the perspective of the virtual camera. Among them, fog effect can generally refer to meteorological phenomena that affect the user's vision and have concentration change properties. It can include smoke, haze, etc., or it can specifically refer to the fog effect formed by water vapor condensing when it is cold and floating in the air.
[0078] Once the virtual camera's camera position is determined, the starting point of the viewing angle is fixed. From this starting point, the viewing angle can be adjusted to view different angles of the virtual scene. The viewing angle can be adjusted in response to user operations or automatically triggered by preset events, such as specific plot triggers, specific game progress triggers, or reaching a specific time point. Regardless of whether the viewing angle is adjusted or remains fixed, invalid rendering is performed according to the rendering height parameter values at the current viewing angle of the virtual camera, adding a fog effect to the virtual scene at that perspective.
[0079] In one embodiment, taking the exponential height fog type displayed in a virtual scene as an example, after rendering the fog effect according to the rendering height parameter value, the virtual environment will display an effect in which the fog effect concentration decreases exponentially as the height decreases. The value of the rendering height parameter value will determine the display effect of the change in fog effect concentration. For example, the larger the rendering height parameter value, the smaller the range of high-concentration fog displayed in the virtual scene will be, and the larger the range of high-concentration fog will be. The smaller the rendering height parameter value, the larger the range of high-concentration fog displayed in the virtual scene will be, and the smaller the range of high-concentration fog will be.
[0080] During the rendering process, since the virtual scene is built based on a spherical coordinate system, fog rendering is also performed in the spherical coordinate system, resulting in a spherical three-dimensional fog effect. In one embodiment, taking exponential height fog as an example, the computer can perform fog rendering in the three-dimensional virtual environment according to the rendering height parameter value of the exponential height fog, so that the exponential height fog can be accurately displayed in the spherical three-dimensional virtual environment.
[0081] In the above embodiment, a tangent plane coordinate system is established on the basis of the geocentric coordinate system by using the projection point of the camera position of the virtual camera in the virtual scene on the surface of the virtual earth to determine the height value of each reference position point in the virtual scene in the tangent plane coordinate system. By combining the geocentric coordinate system and the tangent plane coordinate system, the camera height value of the virtual camera position and the height value of the reference position point are superimposed to accurately locate the rendering height parameter value of each reference position point in the virtual scene in the three-dimensional space of the sphere. The rendering height parameter value of each reference position point is used to render the fog effect, which is convenient for presenting the fog effect in the perspective of the virtual camera and conforms to the characteristics of the human eye's linear vision. Obvious fog effect can also be presented at a distance from the virtual camera. The multiple reference position points are far, near, high, and low from the virtual camera, presenting a variety of fog effects as a whole, making the display of the fog effect in the virtual scene more realistic and accurate.
[0082] In one embodiment, obtaining a camera position point of a virtual camera of a virtual scene in a geocentric coordinate system of the virtual scene includes:
[0083] Obtain the latitude and longitude parameters and camera altitude value representing the position of the virtual camera in the virtual scene; determine the reference coordinate point of the position of the virtual camera in the geographic coordinate system according to the latitude and longitude parameters and the camera altitude value; based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, perform coordinate conversion on the reference coordinate point to obtain the camera position point representing the position of the virtual camera in the geocentric coordinate system.
[0084] During the construction of a virtual scene, its longitude and latitude parameters and a reference height can be defined. By configuring corresponding virtual objects in the virtual scene, the camera height value of the object position in the virtual scene is determined based on the virtual object's own height and the reference height. The position of the virtual camera is the viewing angle position for the virtual scene. Users can configure the viewing angle position for the virtual scene through terminal operations, thereby obtaining the longitude and latitude parameters representing the position of the virtual camera in the virtual scene and the camera height value of the virtual camera position.
[0085] For example, using a virtual scene as a digital twin, a simulated digital twin can be constructed by acquiring the geographic location parameters of the actual environment. The geographic location parameters of each object in the digital twin can be mapped to the geographic location parameters of the actual environment. Based on the relative position of the virtual camera relative to the digital twin, the latitude and longitude parameters and camera altitude of the virtual camera can be determined from the relative position relationship.
[0086] A geographic coordinate system refers to a coordinate system using longitude, latitude, and altitude relative to the surface of a virtual Earth as coordinates. By expressing the position of a virtual camera in the geographic coordinate system, the reference coordinate point of the virtual camera's position in the geographic coordinate system is determined. Using the conversion relationship between the geographic coordinate system and the geocentric coordinate system, the reference coordinate point can be directly transformed to obtain the camera position point representing the virtual camera's position in the geocentric coordinate system. For computers, this coordinate transformation allows for the quick and direct acquisition of the camera position point representing the virtual camera's position in the geocentric coordinate system, improving the efficiency of coordinate conversion processing, simplifying the data processing complexity of determining the camera position point representing the virtual camera's position in the geocentric coordinate system, and improving the utilization of data processing resources.
[0087] In one embodiment, obtaining reference position points in a virtual scene and determining a height value of each reference position point in a height direction in a section coordinate system includes:
[0088] For each reference position point in the virtual scene, the coordinate parameters of the reference position point in the earth coordinate system are obtained; based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, and the conversion relationship between the geocentric coordinate system and the section coordinate system, the coordinate parameters of the reference position point in the earth coordinate system are converted into coordinate parameters in the section coordinate system; the height coordinate value of the reference position point in the section coordinate system is determined as the height value of the reference position point.
[0089] Among them, the computer device can process the height value of each reference position point in the virtual scene synchronously through multiple threads or sequentially through a single thread, which can be determined specifically based on the computing performance of the computer device. The calculation of the height value of each reference position point in the virtual scene can be obtained by coordinate conversion of the coordinate position of the reference position point in different coordinate systems.
[0090] In a specific embodiment, the reference position point of the virtual scene obtained by the computer device can be a longitude parameter, a latitude parameter, and a height relative to the surface of the virtual earth. The position data can be used as the coordinate parameters of the reference position point in the geographic coordinate system. Since the height value of the reference position point is the height coordinate value in the section coordinate system, it is necessary to determine the coordinate point of the reference position point in the section coordinate system. Based on this, during the processing, by obtaining the conversion relationship between the geographic coordinate system and the geocentric coordinate system, and the conversion relationship between the geocentric coordinate system and the section coordinate system, the coordinate position of the reference position point in the section coordinate system can be obtained through two coordinate conversions. During the conversion process, since the geographic coordinate system and the geocentric coordinate system are coordinate systems established based on the same coordinate origin, the coordinate conversion relationship between the geographic coordinate system and the geocentric coordinate system is simpler and more efficient. Furthermore, the section coordinate system is a coordinate system established based on the section of the geocentric coordinate system. The coordinate conversion between the geocentric coordinate system and the section coordinate system is also simpler and more efficient, thereby effectively improving the efficiency of the coordinate conversion.
[0091] In one embodiment, after constructing the slice coordinate system, the computer device can first obtain a target transformation relationship between the geographic coordinate system and the slice coordinate system based on the transformation relationship between the geographic coordinate system and the geocentric coordinate system, and the transformation relationship between the geocentric coordinate system and the slice coordinate system. The computer device can then directly perform coordinate transformation on the reference position points according to the target transformation relationship. In the process of performing coordinate transformation on each reference position point, the conversion efficiency can be effectively improved.
[0092] In another embodiment, coordinate conversion can be performed twice, sequentially according to the conversion relationship between the geographic coordinate system and the geocentric coordinate system, and the conversion relationship between the geocentric coordinate system and the section coordinate system, to obtain the coordinate position of the reference position point in the section coordinate system. The coordinate conversion of the reference position point according to the conversion relationship between the geographic coordinate system and the geocentric coordinate system can be performed after the virtual scene is constructed and before the section coordinate system is established, so that after the position of the virtual camera is subsequently adjusted, it is only necessary to update the conversion relationship between the geocentric coordinate system and the section coordinate system to update the data of the secondary conversion process, which helps to improve the data update response speed after the position of the virtual camera is switched.
[0093] In this embodiment, coordinate transformation is performed through the transformation relationship between the geographic coordinate system and the geocentric coordinate system, and the transformation relationship between the geocentric coordinate system and the section coordinate system. The coordinate transformation can be performed directly according to the transformation relationship, effectively improving the processing efficiency of determining the coordinate value of the reference position point in the section coordinate system.
[0094] In one embodiment, rendering the fog effect of the virtual scene according to each of the rendering height parameter values under the viewing angle of the virtual camera includes:
[0095] Based on the rendering height parameter value of each reference position point, the fog effect intensity and the fog effect rendering height factor of the virtual scene are determined; according to the influence of the fog effect rendering height factor on the fog effect intensity, the fog effect of the virtual scene from the perspective of the virtual camera is rendered.
[0096] The fog intensity is a parameter that represents the desired fog density in the virtual scene. The fog rendering height factor is a factor that affects the fog intensity, which can be determined by the rendering height parameter value at the reference location. The value of the fog rendering height factor changes with the height difference between the rendering height parameter value at the reference location and the virtual camera's position. A larger value for the fog rendering height factor has a greater impact on the fog intensity, while a smaller value for the fog rendering height factor has a lower impact.
[0097] In a specific embodiment, the computer device obtains the rendering height parameter value of each reference position point, first calculates the fog effect intensity and the fog effect rendering height factor of the virtual scene respectively, then multiplies the fog effect intensity and the fog effect rendering height factor, and uses the obtained result as the fog effect influence result of the fog effect rendering height factor on the fog effect intensity, and then performs fog effect rendering in the three-dimensional virtual scene of the spherical surface according to the fog effect influence result of each reference position point in the virtual scene to obtain a virtual scene with three-dimensional fog effect.
[0098] In this embodiment, by calculating the fog effect intensity and the fog effect rendering height factor of the virtual scene according to each rendering height parameter value, the fog effect rendering can be performed while considering the influence of the fog effect rendering height factor on the fog effect intensity, so that the fog effect rendered in the virtual scene is closely related to the rendering height parameter value, so that the fog effect seen by the user in the virtual scene is more realistic and immersive.
[0099] In one specific embodiment, determining the fog effect intensity and the fog effect rendering height factor of the virtual scene based on the rendering height parameter value of each reference position point includes:
[0100] Based on the influence of the rendering height parameter value of each reference position point on the overall fog intensity of the virtual scene, the fog effect intensity of the virtual scene is determined; based on the height difference between the height value of each reference position point and the camera height value of the virtual camera position, the fog effect rendering height factor of the virtual scene is determined.
[0101] The fog effect intensity is related to the rendering height parameter value at each reference location and the overall fog intensity of the virtual scene. The computer device can obtain the overall fog intensity of the virtual scene and calculate the fog effect intensity of the virtual scene based on the correlation between the rendering height parameter value, the overall fog intensity of the virtual scene, and the fog effect intensity. The correlation between the rendering height parameter value, the overall fog intensity of the virtual scene, and the fog effect intensity can be obtained through historical data analysis or by optimizing a traditional fog effect function based on optimized fog effect data.
[0102] Specifically, in one embodiment, determining the fog effect intensity of the virtual scene based on the influence of the rendering height parameter value of each reference position point on the overall fog intensity of the virtual scene includes:
[0103] The overall fog intensity and height fog smoothing curve of the virtual scene are obtained; based on the influence of the rendering height parameter value of each reference position point and the height fog smoothing curve on the overall fog intensity, the fog effect intensity of the virtual scene is determined.
[0104] Among them, the overall fog intensity and height fog smoothing curve of the virtual scene can be pre-configured data. The user can configure the fog effect parameters of the virtual scene through the display terminal of the computer device based on the desired fog effect. The specific configured fog effect parameters may include the overall fog intensity and height fog smoothing curve.
[0105] In order to allow users to observe the fog effects at different positions in the virtual scene, users can also configure and adjust the position of the virtual camera in the virtual scene on the display terminal of the computer device. The position of the virtual camera configured by the user for the first time is the position of the initial virtual camera. When the computer device performs the initial fog effect rendering in the virtual environment, it calculates the fog effect intensity based on the overall fog intensity and the height fog smoothing curve and renders it according to the position of the initial virtual camera. When the user needs to adjust the position of the virtual camera, the computer device responds to the user's adjustment operation on the position of the virtual camera, re-determines the position of the virtual camera, and recalculates the fog effect intensity and re-renders the fog effect based on the overall fog intensity and the height fog smoothing curve according to the updated virtual camera position, to obtain the fog effect display result corresponding to the adjusted virtual camera position.
[0106] In a specific embodiment, the calculation formula of the fog effect intensity FogDensity includes:
[0107] FogDensity=GlobalDensity*exp(-HeightFallOff*z);
[0108] z=CameraInLLH.Z–HeightFogEnd;
[0109] HeightFogEnd=CameraLLH.Z+PinENU.Z;
[0110] Among them, GlobalDensity represents the overall fog intensity, HeightFallOff represents the smoothness of the height fog smoothing curve, CameraInLLH.Z represents the position height of the virtual camera, HeightFogEnd represents the rendering height parameter value, and PinENU.Z represents the height value of the reference position point.
[0111] In this embodiment, the computer device can obtain the overall fog intensity of the virtual scene and the smoothness of the height fog smoothing curve, and calculate the fog effect intensity of the virtual scene in the above manner, which can effectively simplify the fog effect intensity calculation process and obtain accurate fog effect intensity calculation results.
[0112] In one embodiment, determining a fog rendering height factor of a virtual scene based on a height difference between a height value of each reference position point and a camera height value of a virtual camera position includes:
[0113] Obtain a height fog smooth curve of the virtual scene; calculate a fog effect rendering height factor of the virtual scene according to the height difference between a preset fog effect height value and a camera height value of a virtual camera position, and a smoothness parameter of the height fog smooth curve.
[0114] Specifically, after the user configures the complete fog intensity and height fog smoothing curve, in addition to calculating the fog effect intensity through the overall fog intensity, height fog smoothing curve and the position of the virtual camera, the user can further calculate the fog effect rendering height factor based on the height fog smoothing curve and the position of the virtual camera, and then use the fog effect rendering height factor to represent the influence of the virtual camera position on the fog effect intensity of the reference position point in the virtual scene.
[0115] In a specific embodiment, the calculation formula of the fog effect rendering height factor FogFactor is as follows:
[0116] FogFactor=(1-exp2(-falloff)) / Falloff;
[0117] Falloff=(HeightFallOff*Effect.Z);
[0118] Effect.Z=PInENU.Z-CameraInLLH.Z
[0119] Effect.Z represents the relative height between the virtual camera and the reference position. When the virtual camera's height remains unchanged, the lower the reference position, the higher the fog density.
[0120] In this embodiment, the computer device can obtain the smoothness of the height fog smoothing curve of the virtual scene, calculate the fog effect rendering height factor of the virtual scene according to the above method, and obtain accurate fog effect rendering height factor calculation results, determine the influence of the position of the virtual camera on the fog effect intensity of the reference position point in the virtual scene, and the influence of the height of the reference position point on the fog effect intensity, so that the fog effect displayed in the virtual scene is more realistic and immersive.
[0121] In the virtual scene, as shown in FIG6 , the rendering of the fog effect can be combined with the rendering of the light effect. In one embodiment, the method further includes:
[0122] A target time configured for the virtual scene is obtained; and a lighting effect corresponding to the target time is rendered in the virtual scene to obtain a virtual scene with the lighting effect.
[0123] Furthermore, from the perspective of the virtual camera, the fog effect of the virtual scene is rendered according to the values of the rendering height parameters, including:
[0124] According to the rendering height parameter value, the fog effect of the virtual scene with lighting effect is rendered from the perspective of the virtual camera.
[0125] Among them, the target time is a parameter that reflects the effect of sunlight exposure, which can specifically include a specific date and a specific time point on a specific date. Based on the rotation and revolution of the earth, the lighting parameters of the location of the virtual scene can be determined based on the target time, and then the lighting effect is rendered according to the lighting parameters to obtain a virtual scene with lighting effects.
[0126] Furthermore, the lighting effect corresponding to the target time is rendered in the virtual scene to obtain a virtual scene with the lighting effect, including:
[0127] Based on the sun's direct point that matches the date, the sun's inclination angle and sun's altitude angle that match the time point are determined; according to the sun's inclination angle and sun's altitude angle, light effect rendering is performed in the virtual scene to obtain a virtual scene with lighting effects.
[0128] The specific date in the target time can be used to determine the sun's direct point on Earth. The direct point is the point on Earth where direct sunlight reaches its maximum angle during the year. This angle is the solar altitude, meaning that at 12 noon local time, the angle between the sun's rays and the virtual Earth's surface is 90 degrees. The direct point is not a fixed position but changes with the Earth's rotation and revolution, as well as the tilt of its axis relative to the Sun, resulting in different direct point locations at different times and locations.
[0129] Specifically, the movement of the sun's direct point on the Earth's surface follows a certain pattern: starting from the spring equinox on March 21, the sun's direct point is first at the equator (longitude 0°) and then moves north. Starting from the summer solstice on June 22, the sun's direct point reaches the Tropic of Cancer (longitude 23°26′N) and then moves south. Starting from the autumnal equinox on September 23, the sun's direct point returns to the equator and continues to move south. Starting from the winter solstice on December 22, the sun's direct point reaches the Tropic of Capricorn (longitude 23°26′S) and then moves north. The local time of the meridian where the sun's direct point is located is 12 noon, which means that the sun's direct point occurs at noon locally on this meridian. Therefore, the corresponding sun's direct point can be determined based on a specific date.
[0130] Specifically, the latitude of the sun's direct point is calculated as follows:
[0131] If the current date and time is from the vernal equinox to the autumnal equinox, that is, from March 21 to September 23, the latitude of the sun's direct point is:
[0132] Where δ is the latitude of the sun's direct point, and n is the number of days between the current date and March 21;
[0133] If the current date is from the autumnal equinox to the winter solstice, that is, from September 23 to December 22, the latitude of the sun's direct point is:
[0134] Where δ is the latitude of the sun's direct point, and n is the number of days between the current date and March 21;
[0135] If the current date is from the winter solstice to the spring equinox, that is, from December 22 to March 21 of the following year, the latitude of the sun's direct point is:
[0136] δ is the latitude of the sun's direct point, and n is the number of days between the current date and March 21.
[0137] In this embodiment, based on the revolution of the earth, the latitude of the sun's direct point is calculated according to the current date, and the sunlight exposure effect at each time point on the current date can be accurately calculated based on the latitude of the sun's direct point, thereby improving the accuracy of the lighting effect displayed in the virtual scene, so that the combination of the lighting effect and the fog effect in the virtual scene is more similar to the real scene, further improving the fog effect display effect of the virtual scene.
[0138] In one embodiment, determining the sun inclination angle and the sun altitude angle that match the time point based on the sun direct point that matches the date includes:
[0139] Based on the sun's direct point that matches the date, the day-night separation time point of the virtual scene's geographical location is determined; according to the day-night separation time point and the time point, the sun's inclination angle and sun's altitude angle corresponding to the time point are calculated.
[0140] Obtain the latitude of the twin scene's location through the longitude and latitude query website. Substitute the latitude of the sun's direct point and the latitude of the twin scene's location into the following formula to calculate the day length:
[0141] Where h is the day length, φ is the latitude of the twin scene, and δ is the latitude of the sun’s direct point.
[0142] Substitute the day length into the following formula to find the sunrise time: s1=12-h / 2
[0143] Then substitute the sunrise time and the day length into the following formula to calculate the sunset time: s2=s1+h
[0144] Calculate the sun's tilt angle: Substitute the latitude of the twin scene and the latitude of the sun's direct point into the following formula to calculate the current sun's tilt angle:
[0145] Calculate the solar altitude angle: Substitute the day length into the following formula to calculate the solar altitude angle per minute: b = 180° / 60h
[0146] Substitute the current time, the solar altitude angle b per minute, and the sunrise time s1 into the following formula to calculate the current solar altitude angle: c = b(60 hours + minute - s1)
[0147] Where c is the current solar altitude angle, hour is the current hour, minute is the current minute, and s1 is the sunrise time.
[0148] In this embodiment, the latitude of the sun's direct point is calculated according to the current date and time, and based on the latitude of the sun's direct point and the latitude of the geographical location of the twin scene, the day length, sunrise time and sunset time of the day are calculated, and then the solar inclination angle and solar altitude angle are calculated. The calculated solar inclination angle and solar altitude angle are set as the X-axis rotation value and Y-axis rotation value of the parallel light in the three-dimensional engine respectively, and then the virtual scene is rendered, and a real-time sunlight effect is simulated in the virtual scene based on the current date and time.
[0149] Furthermore, the computer device obtains the computer date and time and the latitude information of the virtual scene in real time, and calculates the latitude information of the sun's direct point on the current date through computer recognition and calculation. Then, the sunrise and sunset times can be obtained through the latitude information, and finally the rotation angle of the sun at each time point is comprehensively obtained. The angle value is assigned to the X-axis, Y-axis, and Z-axis rotation values of the parallel light of the three-dimensional scene. As time goes by, the light and shadow of the entire scene will also change in real time, thereby matching the lighting conditions of the real scene. By superimposing the lighting conditions and fog effects and rendering them, real sunlight and fog effects are simulated in real time, which increases the real-time and immersive feeling of the entire virtual scene.
[0150] This application also provides an application scenario, which applies the above-mentioned virtual scene rendering method. Specifically, the application of the virtual scene rendering method in this application scenario is as follows:
[0151] At present, the scope of use of digital twin technology is becoming more and more extensive. In the twin scene display, sunlight elements are almost always used to illuminate the entire scene, and fog effects are added to the scene to enhance the immersion and realism of the scene. For the sunlight elements in the scene, the existing production solution is to use fixed parallel light to simulate sunlight in a three-dimensional engine, and then perform rendering simulation in the three-dimensional scene. However, the atmospheric fog in the sky is generally displayed based on a plane, which will cause the fog effect of the scene based on the spherical coordinate system to be displayed incorrectly. In order to solve the above problems, the present application discloses a virtual scene rendering method, which can synchronize the fog effect in the spherical scene with the real lighting effect to the virtual scene, and simulate the real sunlight effect and fog effect in the spherical three-dimensional virtual scene in real time, thereby increasing the authenticity and immersion of the entire scene and improving the problem of display errors in the atmospheric fog based on the spherical coordinate system.
[0152] Specifically, the computer device imports the twin model into a three-dimensional engine and sets parallel light to simulate sunlight; and configures specific time information of the virtual scene, and at the same time, fog effect parameters can be configured in the virtual scene.
[0153] As shown in Figure 7, the latitude of the sun's direct point is calculated according to the current date and time, and based on the latitude of the sun's direct point and the latitude of the twin scene's geographical location, the day length, sunrise time, and sunset time are calculated. Then, the solar inclination angle and solar altitude angle are calculated, and the calculated solar inclination angle and solar altitude angle are set as the X-axis rotation value and Y-axis rotation value of the parallel light in the three-dimensional engine respectively. Then, the virtual scene is rendered, and a real-time sunlight effect is simulated in the virtual scene based on the current date and time.
[0154] Specifically, based on the specific date in the target time, the sun's direct point on Earth can be determined. The direct point is the point on Earth where direct sunlight reaches its maximum angle during the year. This angle is the solar altitude, meaning that at 12 noon local time, the angle between the sun's rays and the virtual Earth's surface is 90 degrees. The direct point is not a fixed position; it changes with the Earth's rotation and revolution, as well as the tilt of its axis relative to the Sun, resulting in different direct point locations at different times and locations.
[0155] The latitude of the sun's direct point is calculated as follows:
[0156] If the current date and time is from the vernal equinox to the autumnal equinox, that is, from March 21 to September 23, the latitude of the sun's direct point is:
[0157] Where δ is the latitude of the sun's direct point, and n is the number of days between the current date and March 21;
[0158] If the current date is from the autumnal equinox to the winter solstice, that is, from September 23 to December 22, the latitude of the sun's direct point is:
[0159] Where δ is the latitude of the sun's direct point, and n is the number of days between the current date and March 21;
[0160] If the current date is from the winter solstice to the spring equinox, that is, from December 22 to March 21 of the following year, the latitude of the sun's direct point is:
[0161] δ is the latitude of the sun's direct point, and n is the number of days between the current date and March 21.
[0162] Obtain the latitude of the twin scene's location through the longitude and latitude query website. Substitute the latitude of the sun's direct point and the latitude of the twin scene's location into the following formula to calculate the day length:
[0163] Where h is the day length, φ is the latitude of the twin scene, and δ is the latitude of the sun’s direct point.
[0164] Substitute the day length into the following formula to find the sunrise time: s1=12-h / 2
[0165] Then substitute the sunrise time and the day length into the following formula to calculate the sunset time: s2=s1+h
[0166] Calculate the sun's tilt angle: Substitute the latitude of the twin scene and the latitude of the sun's direct point into the following formula to calculate the current sun's tilt angle:
[0167] Calculate the solar altitude angle: Substitute the day length into the following formula to calculate the solar altitude angle per minute: b = 180° / 60h
[0168] Substitute the current time, the solar altitude angle b per minute, and the sunrise time s1 into the following formula to calculate the current solar altitude angle: c = b(60 hours + minute - s1)
[0169] Where c is the current solar altitude angle, hour is the current hour, minute is the current minute, and s1 is the sunrise time.
[0170] Furthermore, the computer device obtains the computer date and time and the latitude information of the virtual scene in real time, and calculates the latitude information of the sun's direct point on the current date through computer recognition and calculation. Then, the sunrise and sunset times can be obtained through the latitude information. Finally, the rotation angle of the sun at each time point is comprehensively calculated, and the angle value is assigned to the X-axis, Y-axis, and Z-axis rotation values of the parallel light of the three-dimensional scene. As time goes by, the light and shadow of the entire scene will also change in real time, thereby matching the lighting conditions of the real scene.
[0171] Through the projection point of the camera position point of the virtual camera position in the virtual scene on the surface of the virtual earth, a tangent coordinate system is established on the basis of the geocentric coordinate system to determine the height value of each reference position point in the virtual scene in the tangent coordinate system. Through the combination of the geocentric coordinate system and the tangent coordinate system, the camera height value of the virtual camera position and the height value of the reference position point are superimposed to accurately locate the rendering height parameter value of each reference position point in the virtual scene in the three-dimensional space of the sphere, ensuring the accuracy and validity of the rendering height parameter value data of each reference position point in the three-dimensional space of the sphere, thereby realizing spherical rendering of fog effect based on the rendering height parameter value, so that the fog effect can be accurately displayed in the three-dimensional space of the sphere, thereby improving the accuracy of the fog effect display in the virtual scene.
[0172] Finally, the lighting conditions and fog effects are superimposed and rendered to simulate real sunlight and fog effects in real time, increasing the real-time nature and immersion of the entire virtual scene.
[0173] In one embodiment, a method for rendering a virtual scene fog effect is provided, the method comprising the following steps:
[0174] Step 701: Obtain latitude and longitude parameters and a camera height value representing the position of a virtual camera in a virtual scene.
[0175] Step 702: Determine the reference coordinate point of the virtual camera's position in the geographic coordinate system according to the latitude and longitude parameters and the camera altitude value.
[0176] Step 703 : Based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, coordinate conversion is performed on the reference coordinate point to obtain a camera position point representing the position of the virtual camera in the geocentric coordinate system.
[0177] Step 704 : Taking the projection point of the camera position point on the surface of the virtual earth as the tangent point, determine a tangent plane tangent to the spherical surface where the geocentric coordinate system is located.
[0178] In step 705, a section coordinate system is established with the projection point as the coordinate origin, the longitude and latitude directions on the section, and the direction of the line connecting the coordinate origin of the geocentric coordinate system to the camera position point as the coordinate axis directions, and the direction of the section perpendicular to the virtual earth surface at the coordinate origin as the height direction.
[0179] Step 706 : For each reference position point in the virtual scene, obtain the coordinate parameters of the reference position point in the earth coordinate system.
[0180] Step 707 : Based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, and the conversion relationship between the geocentric coordinate system and the tangent coordinate system, the coordinate parameters of the reference position point in the earth coordinate system are converted into coordinate parameters in the tangent coordinate system.
[0181] Step 708: Determine the height coordinate value of the reference position point in the section coordinate system as the height value of the reference position point.
[0182] Step 709 : Obtain the camera height value of the virtual camera from the virtual earth surface, and add the camera height value to the height value of each virtual reference point to obtain the rendering height parameter value of each virtual reference point.
[0183] Step 710: Obtain the overall fog intensity and height fog smoothing curve of the virtual scene.
[0184] Step 711 : Determine the fog effect intensity of the virtual scene based on the rendering height parameter value of each reference position point and the influence of the height fog smoothing curve on the overall fog intensity.
[0185] Step 712 : Calculate the fog effect rendering height factor of the virtual scene according to the height difference between the preset fog effect height value and the camera height value of the virtual camera position, and the smoothness parameter of the height fog smoothing curve.
[0186] Step 713 : Render the fog effect of the virtual scene from the perspective of the virtual camera according to the influence of the fog effect rendering height factor on the fog effect intensity.
[0187] Step 714 , obtaining the date and time point configured for the virtual scene, and determining the day and night separation time point of the geographical location of the virtual scene based on the sun's direct point that matches the date.
[0188] Step 715 , according to the time point divided into day and night and the time point, calculate the solar inclination angle and solar altitude angle corresponding to the time point.
[0189] Step 716 , performing light effect rendering in the virtual scene according to the sun's inclination angle and the sun's altitude angle, to obtain a virtual scene with lighting effects.
[0190] Step 717 , rendering the fog effect of the virtual scene with the lighting effect from the perspective of the virtual camera according to the rendering height parameter value.
[0191] The above-mentioned virtual scene rendering method establishes a tangent coordinate system on the basis of the geocentric coordinate system through the projection point of the camera position point of the virtual camera position in the virtual scene on the surface of the virtual earth, so as to determine the height value of each reference position point in the virtual scene in the tangent coordinate system. By combining the geocentric coordinate system and the tangent coordinate system, the camera height value of the virtual camera position and the height value of the reference position point are superimposed to accurately locate the rendering height parameter value of each reference position point in the virtual scene in the three-dimensional space of the sphere, ensuring the accuracy and validity of the rendering height parameter value data of each reference position point in the three-dimensional space of the sphere, thereby realizing spherical rendering of fog effect based on the rendering height parameter value, so that the fog effect can be accurately displayed in the three-dimensional space of the sphere, thereby improving the accuracy of the fog effect display in the virtual scene.
[0192] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0193] Based on the same inventive concept, embodiments of the present application also provide a virtual scene rendering device for implementing the aforementioned virtual scene rendering method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more virtual scene rendering device embodiments provided below can be found in the above-described limitations of the virtual scene rendering method and will not be further elaborated here.
[0194] In one embodiment, as shown in FIG8 , a virtual scene rendering device is provided, including: a camera position point acquisition module 802 , a coordinate system establishment module 804 , a height value determination module 806 , a rendering height parameter value determination module 808 and a fog effect rendering module.
[0195] A camera position point acquisition module 802 is used to acquire a camera position point of a virtual camera of a virtual scene in a geocentric coordinate system of the virtual scene;
[0196] A coordinate system establishment module 804 is configured to determine the projection point of the camera position on the surface of the virtual earth of the virtual scene in the geocentric coordinate system, and to establish a section coordinate system with the direction perpendicular to the section of the virtual earth surface at the coordinate origin as the height direction, using the projection point as the coordinate origin;
[0197] A height value determination module 806 is used to obtain reference position points in the virtual scene and determine the height value of each reference position point in the height direction of the section coordinate system;
[0198] The rendering height parameter value determination module 808 is used to obtain the camera height value of the virtual camera from the surface of the virtual earth, and add the camera height value to the height value of each virtual reference point to obtain the rendering height parameter value of each virtual reference point;
[0199] The fog effect rendering module 810 is used to render the fog effect of the virtual scene according to various rendering height parameter values from the perspective of the virtual camera.
[0200] In one embodiment, the camera position point acquisition module 802 is specifically used to obtain the latitude and longitude parameters and camera altitude value representing the position of the virtual camera in the virtual scene; determine the reference coordinate point of the position of the virtual camera in the geographic coordinate system according to the latitude and longitude parameters and the camera altitude value; based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, perform coordinate conversion on the reference coordinate point to obtain the camera position point representing the position of the virtual camera in the geocentric coordinate system.
[0201] In one embodiment, the coordinate system establishment module 804 is specifically used to determine a tangent plane tangent to the spherical surface where the geocentric coordinate system is located, using the projection point of the camera position point on the virtual earth surface as the tangent point; using the projection point as the coordinate origin, the longitude and latitude directions on the tangent plane, and the direction of the line connecting the coordinate origin of the geocentric coordinate system to the camera position point as the coordinate axis directions, to establish a tangent plane coordinate system with the direction of the tangent plane perpendicular to the virtual earth surface at the coordinate origin as the height direction.
[0202] In one embodiment, the height value determination module 806 is specifically used to obtain the coordinate parameters of the reference position point in the earth coordinate system for each reference position point in the virtual scene; based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, and the conversion relationship between the geocentric coordinate system and the section coordinate system, the coordinate parameters of the reference position point in the earth coordinate system are converted into coordinate parameters in the section coordinate system; and the height coordinate value of the reference position point in the section coordinate system is determined as the height value of the reference position point in the height direction in the section coordinate system.
[0203] In one embodiment, the fog effect rendering module 810 is specifically used to determine the fog effect intensity and the fog effect rendering height factor of the virtual scene based on the rendering height parameter value of each reference position point; and render the fog effect of the virtual scene from the perspective of the virtual camera according to the degree of influence of the fog effect rendering height factor on the fog effect intensity.
[0204] In one embodiment, the fog effect rendering module 810 is specifically used to determine the fog effect intensity of the virtual scene based on the influence of the rendering height parameter value of each reference position point on the overall fog intensity of the virtual scene; and determine the fog effect rendering height factor of the virtual scene based on the height difference between the height value of each reference position point and the camera height value of the position of the virtual camera.
[0205] In one embodiment, the fog effect rendering module 810 is specifically used to obtain the overall fog intensity and height fog smoothing curve of the virtual scene; based on the rendering height parameter value of each reference position point and the influence of the height fog smoothing curve on the overall fog intensity, the fog effect intensity of the virtual scene is determined.
[0206] In one embodiment, the fog effect rendering module 810 is specifically used to obtain a height fog smooth curve of a virtual scene; calculate the fog effect rendering height factor of the virtual scene according to the height difference between a preset fog effect height value and a camera height value of a virtual camera position, and a smoothness parameter of the height fog smooth curve.
[0207] In one embodiment, the device further includes a lighting effect processing module configured to obtain a target time configured for the virtual scene; render the lighting effect corresponding to the target time in the virtual scene to obtain a virtual scene with the lighting effect;
[0208] The fog effect rendering module 810 is specifically configured to render the fog effect of the virtual scene with lighting effects from the perspective of the virtual camera according to the rendering height parameter value.
[0209] In one embodiment, the target time includes a date and a time point; the lighting effect processing module is used to determine the solar inclination angle and solar altitude angle matching the time point based on the solar direct point matching the date; according to the solar inclination angle and solar altitude angle, light effect rendering is performed in the virtual scene to obtain a virtual scene with lighting effects.
[0210] In one embodiment, the lighting effect processing module is specifically used to determine the day and night division time point of the geographical location of the virtual scene based on the sun's direct point matching the date; according to the day and night division time point and the time point, calculate the solar inclination angle and solar altitude angle corresponding to the time point.
[0211] The above-mentioned virtual scene rendering device establishes a tangent coordinate system on the basis of the geocentric coordinate system through the projection point of the camera position point of the virtual camera position in the virtual scene on the surface of the virtual earth, so as to determine the height value of each reference position point in the virtual scene in the tangent coordinate system. By combining the geocentric coordinate system and the tangent coordinate system, the camera height value of the virtual camera position and the height value of the reference position point are superimposed to accurately locate the rendering height parameter value of each reference position point in the virtual scene in the three-dimensional space of the sphere, ensuring the accuracy and validity of the rendering height parameter value data of each reference position point in the three-dimensional space of the sphere, thereby realizing spherical rendering of fog effect based on the rendering height parameter value, so that the fog effect can be accurately displayed in the three-dimensional space of the sphere, thereby improving the accuracy of the fog effect display in the virtual scene.
[0212] Each module in the aforementioned virtual scene rendering device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0213] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in Figure 9. The computer device includes a processor, a memory, an input / output interface (I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a virtual scene rendering method is implemented.
[0214] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in Figure 10. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via wired or wireless communication, and the wireless communication may be implemented via Wi-Fi, a mobile cellular network, NFC (near field communication), or other technologies. When the computer program is executed by the processor, it implements a virtual scene rendering method. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0215] Those skilled in the art will understand that the structure shown in Figure 9 or Figure 10 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0216] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0217] The computer device that executes the above-mentioned virtual scene rendering method establishes a tangent coordinate system on the basis of the geocentric coordinate system through the projection point of the camera position point of the virtual camera position in the virtual scene on the surface of the virtual earth, so as to determine the height value of each reference position point in the virtual scene in the tangent coordinate system. By combining the geocentric coordinate system and the tangent coordinate system, the camera height value of the virtual camera position and the height value of the reference position point are superimposed to accurately locate the rendering height parameter value of each reference position point in the virtual scene in the three-dimensional space of the sphere, ensuring the accuracy and validity of the rendering height parameter value data of each reference position point in the three-dimensional space of the sphere, thereby realizing spherical rendering of fog effect based on the rendering height parameter value, so that the fog effect can be accurately displayed in the three-dimensional space of the sphere, thereby improving the accuracy of the fog effect display in the virtual scene.
[0218] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0219] The computer-readable storage medium for executing the above-mentioned virtual scene rendering method establishes a tangent coordinate system on the basis of the geocentric coordinate system through the projection point of the camera position point of the virtual camera position in the virtual scene on the surface of the virtual earth, so as to determine the height value of each reference position point in the virtual scene in the tangent coordinate system, and accurately locates the rendering height parameter value of each reference position point in the virtual scene in the three-dimensional space of the sphere by combining the geocentric coordinate system and the tangent coordinate system, and superimposing the camera height value of the virtual camera position and the height value of the reference position point, thereby ensuring the accuracy and validity of the rendering height parameter value data of each reference position point in the three-dimensional space of the sphere, thereby realizing spherical rendering of the fog effect based on the rendering height parameter value, so that the fog effect can be accurately displayed in the three-dimensional space of the sphere, thereby improving the accuracy of the fog effect display in the virtual scene.
[0220] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0221] The computer program product for executing the above-mentioned virtual scene rendering method establishes a tangent coordinate system on the basis of the geocentric coordinate system through the projection point of the camera position point of the virtual camera position in the virtual scene on the surface of the virtual earth, so as to determine the height value of each reference position point in the virtual scene in the tangent coordinate system. By combining the geocentric coordinate system and the tangent coordinate system, the camera height value of the virtual camera position and the height value of the reference position point are superimposed to accurately locate the rendering height parameter value of each reference position point in the virtual scene in the three-dimensional space of the sphere, ensuring the accuracy and validity of the rendering height parameter value data of each reference position point in the three-dimensional space of the sphere, thereby realizing spherical rendering of fog effect based on the rendering height parameter value, so that the fog effect can be accurately displayed in the three-dimensional space of the sphere, thereby improving the accuracy of the fog effect display in the virtual scene.
[0222] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0223] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0224] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0225] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A virtual scene rendering method, executed by a computer device, comprising: Obtaining a camera position point of a virtual camera of a virtual scene in a geocentric coordinate system of the virtual scene; Determining, in the geocentric coordinate system, a projection point of the camera position point on the surface of the virtual earth of the virtual scene; Taking the projection point as the coordinate origin, establishing a section coordinate system with the direction perpendicular to the section of the virtual earth surface at the coordinate origin as the height direction; Acquire reference position points in the virtual scene, and determine a height value of each reference position point in the height direction in the section coordinate system; Obtaining a camera height value of the virtual camera from the surface of the virtual earth, and adding the camera height value to the height value of each virtual reference point to obtain a rendering height parameter value of each virtual reference point; and Under the viewing angle of the virtual camera, the fog effect of the virtual scene is rendered according to each of the rendering height parameter values.
2. The method according to claim 1, wherein obtaining a camera position point of a virtual camera of a virtual scene in a geocentric coordinate system of the virtual scene comprises: Obtaining the latitude and longitude parameters and camera height value representing the position of the virtual camera in the virtual scene; Determine the reference coordinate point of the position of the virtual camera in the geographic coordinate system according to the latitude and longitude parameters and the camera height value; Based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, the reference coordinate point is subjected to coordinate conversion to obtain a camera position point representing the position of the virtual camera in the geocentric coordinate system.
3. The method according to claim 1 or 2, wherein the step of establishing a section coordinate system with the projection point as the coordinate origin and the direction of the section perpendicular to the surface of the virtual earth at the coordinate origin as the height direction comprises: Taking the projection point of the camera position point on the surface of the virtual earth as the tangent point, determining a tangent plane tangent to the spherical surface where the geocentric coordinate system is located; With the projection point as the coordinate origin, the longitude and latitude directions on the section and the direction of the line from the coordinate origin of the geocentric coordinate system to the camera position point as the coordinate axis directions, a section coordinate system is established with the direction of the section perpendicular to the virtual earth surface at the coordinate origin as the height direction.
4. The method according to any one of claims 1 to 3, wherein obtaining reference position points in the virtual scene and determining the height value of each reference position point in the height direction in the section coordinate system comprises: For each reference position point in the virtual scene, obtaining coordinate parameters of the reference position point in the earth coordinate system; Based on the conversion relationship between the geographic coordinate system and the geocentric coordinate system, and the conversion relationship between the geocentric coordinate system and the tangent plane coordinate system, the coordinate parameters of the reference position point in the earth coordinate system are converted into coordinate parameters in the tangent plane coordinate system; The height coordinate value of the reference position point in the section coordinate system is determined as the height value of the reference position point in the height direction in the section coordinate system.
5. The method according to any one of claims 1 to 4, wherein rendering the fog effect of the virtual scene according to each of the rendering height parameter values under the viewing angle of the virtual camera comprises: Determining the fog effect intensity and the fog effect rendering height factor of the virtual scene based on the rendering height parameter value of each reference position point; The fog effect of the virtual scene under the viewing angle of the virtual camera is rendered according to the degree of influence of the fog effect rendering height factor on the fog effect intensity.
6. The method according to claim 5, wherein determining the fog effect intensity and the fog effect rendering height factor of the virtual scene based on the rendering height parameter value of each reference position point comprises: Determining the fog effect intensity of the virtual scene based on the influence of the rendering height parameter value of each reference position point on the overall fog intensity of the virtual scene; A fog effect rendering height factor of the virtual scene is determined based on a height difference between a height value of each reference position point and a camera height value of the position of the virtual camera.
7. The method according to claim 6, wherein determining the fog effect intensity of the virtual scene based on the influence of the rendering height parameter value of each reference position point on the overall fog intensity of the virtual scene comprises: Obtaining the overall fog intensity and height fog smoothing curve of the virtual scene; The fog effect intensity of the virtual scene is determined based on the rendering height parameter value of each of the reference position points and the influence of the height fog smoothing curve on the overall fog intensity.
8. The method according to claim 6 or 7, wherein determining the fog rendering height factor of the virtual scene based on the height difference between the height value of each reference position point and the camera height value of the position of the virtual camera comprises: Obtaining a height fog smooth curve of the virtual scene; A fog effect rendering height factor of the virtual scene is calculated according to a height difference between the preset fog effect height value and a camera height value of the position of the virtual camera, and a smoothness parameter of the height fog smooth curve.
9. The method according to any one of claims 1 to 8, further comprising: Obtaining a target time configured for the virtual scene; Rendering the lighting effect corresponding to the target time in the virtual scene to obtain a virtual scene with the lighting effect; Rendering the fog effect of the virtual scene according to each rendering height parameter value under the viewing angle of the virtual camera includes: According to the rendering height parameter value, the fog effect of the virtual scene with the lighting effect under the perspective of the virtual camera is rendered.
10. The method according to claim 9, wherein the target time comprises a date and a time point; The step of rendering the lighting effect corresponding to the target time in the virtual scene to obtain a virtual scene with the lighting effect includes: Determining the sun's inclination angle and the sun's altitude angle that match the time point based on the sun's direct point that matches the date; According to the sun inclination angle and the sun altitude angle, light effect rendering is performed in the virtual scene to obtain a virtual scene with lighting effects.
11. The method according to claim 10, wherein determining the solar inclination angle and solar altitude angle matching the time point based on the solar direct point matching the date comprises: Determining the day-night separation time point of the geographical location of the virtual scene based on the sun's direct point that matches the date; According to the day-night division time point and the time point, the solar inclination angle and the solar altitude angle corresponding to the time point are calculated.
12. A virtual scene rendering device, comprising: A camera position point acquisition module, used to acquire a camera position point of a virtual camera of a virtual scene in a geocentric coordinate system of the virtual scene; a coordinate system establishment module, configured to determine, in the geocentric coordinate system, a projection point of the camera position point on the surface of the virtual earth of the virtual scene, and establish, with the projection point as the coordinate origin, a section coordinate system with a direction perpendicular to a section of the virtual earth surface at the coordinate origin as the height direction; a height value determination module, configured to obtain reference position points in the virtual scene and determine a height value of each reference position point in the height direction in the section coordinate system; a rendering height parameter value determination module, configured to obtain a camera height value of the virtual camera from the surface of the virtual earth, and add the camera height value to the height value of each virtual reference point to obtain a rendering height parameter value of each virtual reference point; and A fog effect rendering module is used to render the fog effect of the virtual scene according to each of the rendering height parameter values under the viewing angle of the virtual camera.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 11 when executing the computer program.
14. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
15. A computer program product comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Method and device for solving CCD image ground position, electronic equipment and medium
CN109975836A
Fog effect implementation method and device, equipment and storage medium
CN114255184A
Weather change simulation method and system
CN117272698A
Fog effect processing method and device for virtual scene, equipment, medium and program product
CN117934675A
Image processing system
US20100134516A1
Cited By
Visualization processing method and system for Web end SAR field projection based on four corners
CN121564240A