Environment rendering method and device based on parameterization adjustment and storage medium

Through the environmental rendering method based on parameterization adjustment, the color value of the color point of the cube space is dynamically adjusted using the environment parameter model and the environment state parameters input by the user, which solves the discrete switching problem of environmental change simulation methods in the existing technology, and realizes efficient and accurate dynamic rendering of three-dimensional scenes.

CN119672203APending Publication Date: 2025-03-21HANGZHOU HIKVISION SYST TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411719125.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the prior art, the simulation method of environmental changes belongs to discrete environment switching, resulting in poor overall performance of the three-dimensional scene and cannot meet the user's need to simulate environmental changes visible during rendering tests.

Method used

A method of environmental rendering based on parameterization adjustment is proposed. By obtaining the environment state parameters input by the user, the environment parameter model is used to determine the color color values ​​of multiple shading points in the cube space, and coloring them on the cube space to generate the target rendering environment.

Benefits of technology

The stepless switching dynamic simulation of the surrounding environment is realized, the overall expressiveness of the three-dimensional scene is improved, the ambiguity problem is solved, and the accuracy and convenience of dynamic rendering is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119672203A_ABST
    Figure CN119672203A_ABST
Patent Text Reader

Abstract

The invention discloses an environment rendering method and device based on parameterization adjustment and a storage medium, and relates to the technical field of three-dimensional rendering, and the method comprises the steps: obtaining environment state parameters inputted by a user; wherein the environment state parameters comprise at least one color parameter; inputting the environment state parameters into an environment parameter model, and determining coloring color values respectively corresponding to a plurality of coloring points on a pre-constructed cubic space by the environment parameter model based on the at least one color parameter; and respectively coloring the plurality of coloring points on the cubic space by using the coloring color values corresponding to the plurality of coloring points, and taking the obtained colored cubic space as a target rendering environment corresponding to the environment state parameters. According to the method, the environment parameter model with the adjustable parameters is constructed to assist in rendering the environment, the change of the surrounding environment can be simulated in a stepless switching mode, and the overall expressive force of the three-dimensional scene is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of three-dimensional rendering technology, and in particular to an environment rendering method, device and storage medium based on parameterized adjustment. Background Art

[0002] In the field of computer graphics or 3D rendering, the concept of skybox is involved. Skybox is a technology used to simulate an environment or scene at an infinite distance. It is usually expressed as a cube or hemispherical texture map surrounding the camera. The six faces (or five faces plus a curved surface) of this cube or hemispherical shape contain corresponding maps to simulate distant scenes such as the sky and the horizon. The role of the skybox is to make players feel that they are in an environment that is much larger than the actual environment with less computational overhead, thereby enhancing the immersion and realism of games, for example.

[0003] At present, the sky box is usually simulated in a panorama mode, that is, six pictures are used to correspond to the six faces of the cubic box, the top corresponds to the sky, the bottom corresponds to the ground, and the front, back, left and right are half sky and half ground, or a high dynamic range (HDR) file is used to build a cubic box space, and the camera is located in the middle of the cubic box. Inspired by the panorama, various surrounding environments can be effectively simulated, such as sunny days, cloudy days, and haze days. When simulating different environmental changes, it is achieved by switching the panoramas corresponding to different environments. The main work of the simulation is in the shooting and production of the panorama.

[0004] However, the above-mentioned simulation method of environmental changes is a discrete environmental switching, which cannot meet the user's demand for visibly simulating environmental changes during rendering tests, and the overall expression of the three-dimensional scene is poor. Summary of the invention

[0005] The main purpose of this application is to provide an environment rendering method, device and storage medium based on parameterized adjustment, aiming to solve the technical problem that the simulation method of environmental changes in related technologies is a discrete environment switching, resulting in poor overall expression of the three-dimensional scene.

[0006] To achieve the above objectives, the present application proposes an environment rendering method based on parameterized adjustment, the method comprising:

[0007] Acquire environmental state parameters input by a user; wherein the environmental state parameters include at least one color parameter;

[0008] Inputting the environmental state parameter into an environmental parameter model, and using the environmental parameter model to determine coloring color values ​​corresponding to a plurality of coloring points on a pre-constructed cubic space based on the at least one color parameter;

[0009] In the cubic space, the plurality of shading points are respectively colored using the coloring color values ​​respectively corresponding to the plurality of shading points, and the colored cubic space is obtained as the target rendering environment corresponding to the environmental state parameter.

[0010] Optionally, the at least one color parameter includes at least one of a sky color value and a ground color value, the cubic space is divided into a sky area and a ground area, and a plurality of shading points on the cubic space are divided into at least one ground shading point corresponding to the ground area and at least one sky shading point corresponding to the sky area;

[0011] The step of inputting the environmental state parameter into the environmental parameter model, and determining, by the environmental parameter model based on the at least one color parameter, the coloring color values ​​corresponding to the plurality of coloring points in the pre-constructed cubic space, respectively, comprises:

[0012] The environmental state parameters are input into an environmental parameter model, and the environmental parameter model determines the first coloring color values ​​corresponding to the ground coloring points based on the ground color value, and / or the environmental parameter model determines the second coloring color values ​​corresponding to the sky coloring points based on the sky color value;

[0013] The step of coloring the plurality of shading points respectively using the coloring color values ​​respectively corresponding to the plurality of shading points to obtain the colored cubic space as the target rendering environment corresponding to the environmental state parameter comprises:

[0014] Each of the ground shading points is colored using the first shading color value corresponding to each of the ground shading points, and / or each of the sky shading points is colored using the second shading color value corresponding to each of the sky shading points, to obtain a colored cubic space as the target rendering environment corresponding to the environmental state parameter.

[0015] Optionally, the at least one color parameter further includes a fog color value;

[0016] The step of determining the second coloring color value corresponding to each of the sky coloring points based on the sky color value by the environmental parameter model comprises:

[0017] The environment parameter model determines the second shading color value corresponding to each of the sky shading points based on the sky color value and the fog color value.

[0018] Optionally, the step of determining the second shading color value corresponding to each of the sky shading points based on the sky color value and the fog color value comprises:

[0019] Obtain the shading point coordinates of each of the sky shading points in the cubic space;

[0020] Based on the shading point coordinates corresponding to each of the sky shading points and the center point coordinates of the cubic space, determining a first angle between each of the sky shading points and a ground plane of the cubic space; wherein the ground plane is used to divide the cubic space into the sky area and the ground area;

[0021] Determine whether the first angle corresponding to the sky shading point is within a preset target atomization range; wherein the target atomization range is used to indicate the angle range to be atomized;

[0022] When the first angle is within the target atomization range, based on the first angle corresponding to the sky shading point, a mixing function is used to mix and calculate the sky color value and the fog color value to obtain a second shading color value corresponding to the sky shading point; wherein the first angle is related to a mixing coefficient in the mixing function;

[0023] When the first angle is not within the target atomization range, the sky color value is determined as a second shading color value corresponding to the sky shading point.

[0024] Optionally, the environmental state parameters further include an atomization start point and an atomization end point, wherein the atomization start point and the atomization end point are selected by a user from a plurality of colored points on the cubic space to indicate the target atomization range;

[0025] Before the step of determining whether the first angle corresponding to the sky shading point is within a preset target atomization range, the method further includes:

[0026] Determine a second angle between the atomization starting point and the ground plane based on the shading point coordinates of the atomization starting point in the cubic space and the center point coordinates of the cubic space;

[0027] Determine a third angle between the atomization cutoff point and the ground plane based on the shading point coordinates of the atomization cutoff point in the cubic space and the center point coordinates of the cubic space;

[0028] The angle range between the second angle and the third angle is determined as the target atomization range.

[0029] Optionally, the step of performing a mixing calculation on the sky color value and the fog color value using a mixing function based on the first angle corresponding to the sky shading point to obtain a second shading color value corresponding to the sky shading point includes:

[0030] Determine a mixing coefficient corresponding to the sky shading point based on a first angle corresponding to the sky shading point; wherein the mixing coefficient is inversely proportional to the first angle;

[0031] Determining a mixing function corresponding to the sky shading point based on a mixing coefficient corresponding to the sky shading point;

[0032] The sky color value and the fog color value are mixed and calculated using the mixing function corresponding to the sky shading point to obtain a second shading color value corresponding to the sky shading point; wherein the mixing coefficient of the mixing function is positively correlated with the proportion of the fog color value in the mixing calculation.

[0033] Optionally, the environmental state parameter further includes indication information for indicating whether sunlight is simulated in the environment;

[0034] Before the step of coloring the plurality of shading points respectively using the coloring color values ​​respectively corresponding to the plurality of shading points in the cubic space to obtain the colored cubic space as the target rendering environment corresponding to the environmental state parameter, the method further includes:

[0035] In the case where the indication information indicates simulating sunlight in the environment, determining the sunlight irradiation direction corresponding to the preset current time;

[0036] Determine a fourth angle between the sunlight irradiation direction and a ground plane; wherein the ground plane is used to divide the cubic space into a sky area and a ground area;

[0037] Based on the fourth angle and the preset sunlight influence coefficient, determine the sunlight intensity value corresponding to the sunlight irradiation direction; wherein the fourth angle is inversely proportional to the sunlight intensity value, and the sunlight influence coefficient is directly proportional to the sunlight intensity value;

[0038] The sunlight intensity value is superimposed with the shading color values ​​respectively corresponding to the plurality of shading points on the cubic space, and the superimposed value is used as the shading color values ​​respectively corresponding to the plurality of shading points after update.

[0039] In addition, to achieve the above purpose, the present application also proposes an environment rendering device based on parameterized adjustment, and the environment rendering device based on parameterized adjustment includes:

[0040] An acquisition module, used to acquire environmental state parameters input by a user; wherein the environmental state parameters include at least one color parameter;

[0041] A determination module, configured to input the environmental state parameter into an environmental parameter model, and determine, by the environmental parameter model based on the at least one color parameter, coloring color values ​​corresponding to a plurality of coloring points in a pre-constructed cubic space;

[0042] The shading module is used to color the plurality of shading points respectively in the cubic space using the shading color values ​​respectively corresponding to the plurality of shading points, and obtain the colored cubic space as the target rendering environment corresponding to the environmental state parameter.

[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the environment rendering method based on parameterized adjustment as described above.

[0044] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the environment rendering method based on parameterized adjustment as described above are implemented.

[0045] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the environment rendering method based on parameterized adjustment as described above are implemented.

[0046] One or more technical solutions proposed in this application have at least the following technical effects:

[0047] 1) An adjustable parameter environment parameter model is constructed. By inputting the environment state parameters into the environment parameter model, the environment parameter model determines the coloring color values ​​corresponding to the multiple coloring points in the pre-constructed cubic space based on at least one color parameter in the environment state parameters. Then, the multiple coloring points can be colored in the cubic space using the coloring color values ​​corresponding to the multiple coloring points determined by the environment parameter model, and the colored cubic space is obtained as the target rendering environment corresponding to the environment state parameters. For the user side, different environment state parameters can be obtained by dynamically sampling the relevant color parameters of the environment to be simulated and inputting them into the environment parameter model. The environment parameter model assists in rendering the environment, supports real-time dynamic simulation of changes in the surrounding environment in the form of stepless switching, and effectively improves the overall expressiveness of the three-dimensional scene.

[0048] 2) Compared with the related art in which the sky and objects in the scene are rendered as a whole, and then further adjusted by identifying the sky part in the rendered image, the recognition process may be difficult to accurately identify the sky part due to the ambiguity between the sky and the objects in the scene, which in turn leads to errors in updating the rendered image. The present application uses the environmental parameter model and the environmental state parameter to render the surrounding environment separately and simulate environmental changes. There is no need to identify the sky part and then make adjustments. When adjusting the environmental changes through the environmental parameter model, it does not affect the rendering of the objects in the scene. The above-mentioned ambiguity problem is solved, the accuracy of dynamic rendering is improved, and complex calculations are avoided to distinguish between the sky environment and the objects in the scene. The dynamic rendering process is more convenient. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0051] Figure 1 A schematic diagram of constructing a cubic box space by means of a panoramic image in the related art;

[0052] Figure 2 One of the schematic diagrams of a cubic box space constructed in the related art;

[0053] Figure 3 The second schematic diagram of the cubic box space constructed in the related art;

[0054] Figure 4 This is a flow chart of a first embodiment of the environment rendering method based on parameterized adjustment of the present application;

[0055] Figure 5 This is a flow chart of a second embodiment of the environment rendering method based on parameterized adjustment of the present application;

[0056] Figure 6 A schematic diagram of an environment rendered by the environment rendering method based on parameterized adjustment in this application;

[0057] Figure 7 This is a flow chart of a third embodiment of the environment rendering method based on parameterized adjustment of the present application;

[0058] Figure 8A schematic diagram of parameters required for constructing an environment parameter model in the environment rendering method based on parameterized adjustment in this application;

[0059] Fig. 9 This is a schematic diagram of the module structure of the environment rendering device based on parameterized adjustment according to an embodiment of the present application;

[0060] Fig.10 Schematic diagram of the device structure of the hardware operating environment involved in the environment rendering method based on parameterized adjustment in the embodiment of the present application.

[0061] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0062] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0063] Unless otherwise defined, all technical and scientific terms used in this application have the same meanings as those commonly understood by technicians in the technical field to which this application belongs; the terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.

[0064] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0065] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0066] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0067] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0068] In the related art, the sky and objects in the three-dimensional scene are treated as a whole scene to form a panoramic image for rendering; corresponding panoramas are established for the surrounding environments in different scenes (such as sunny days, cloudy days, foggy days, etc.), and then the changes in the surrounding environment in the scene can be simulated by switching the corresponding panoramas in different scenes for rendering in the cubic box space.

[0069] For example, the surrounding environment currently being rendered is a sunny day, which is specifically performed by using a pre-established panoramic view corresponding to a sunny day. If the next moment needs to simulate the change from sunny day to cloudy day, it is necessary to replace the panoramic view corresponding to the sunny day with the panoramic view corresponding to the cloudy day for rendering to simulate the change of the surrounding environment from sunny day to cloudy day.

[0070] Based on the above examples, it can be seen that the discrete switching method is used to simulate the changes in the surrounding environment in the above scenes, which is quite different from the real-time dynamic changes in the surrounding environment in the actual scene. That is, it is difficult for related technologies to simulate the changes in the surrounding environment that are visible in the actual rendering test, and the overall expressiveness of the three-dimensional scene is poor.

[0071] Specifically, through the panorama method, six pictures or an HDR file can be used to construct a cubic box space, and the camera is located in the middle of the box. Figure 1 It is a schematic diagram of constructing a cubic box space by means of a panoramic image in the related technology, such as Figure 1 As shown, Figure 1 The three small pictures above represent the pictures corresponding to the negative directions of the x, y, and z axes when constructing a cubic box space. Figure 1 The following three small pictures respectively represent the pictures corresponding to the positive directions of the x, y, and z axes when constructing a cubic box space. Using the above six pictures, a cubic box space can be constructed in a panoramic way.

[0072] Figure 2 One of the schematic diagrams of the cubic box space constructed in the related art, such as Figure 2 As shown, the cubic box space includes a sky part and a ground part, which are divided by a horizon. In the scene of the cubic box space, objects such as rivers, roads and houses are also rendered. After the cubic box space is constructed, the canvas background color can be used as the ground color of the ground part, and then part of the cubic box space can be identified as the sky part through certain algorithm logic and then processed, such as atomization, to make the effect more realistic.

[0073] There are usually two methods for simulating the sky in the field of computer graphics or 3D rendering:

[0074] Method 1: Inspired by the panorama, you can effectively simulate various surrounding environments (such as sunny days, cloudy days, and foggy days). However, each environmental change requires switching the panorama. The main adjustment work is in the shooting and production of the panorama. It is a discrete environment switch and cannot meet the user's needs for visible and available adjustment of environmental changes during rendering tests.

[0075] Method 2: You can adjust the sky, but since the sky and the objects in the scene are rendered as a whole scene, you can only identify and adjust the sky through an algorithm based on the rendered image. Figure 3 The second schematic diagram of the cubic box space constructed in the related art, that is, from e.g. Figure 3 In the image, the sky is identified by the algorithm and then adjusted. However, this method must face the following situation: the same pixel position in the rendered image is both the sky and the house, for example Figure 3 At this time, there is ambiguity in pixel A (it represents both the sky and the house), and the computer can only process the pixel as the sky or as the house, which makes it difficult to accurately identify the sky part and make adjustments, which can easily lead to errors in the adjusted image and low adjustment accuracy.

[0076] In response to the above problems, the present application provides an environment rendering method based on parameterized adjustment, constructs an environment parameter model with adjustable parameters, and renders the surrounding environment in the scene separately by inputting environment state parameters into the environment parameter model. The user can simulate changes in the surrounding environment by inputting different environment state parameters into the environment parameter model. There is no need to identify the sky part through an algorithm in the image that has rendered the sky and objects in the scene and then make adjustments. When the environment changes are adjusted through the environment parameter model and the environment state parameters, the rendering of objects in the scene is not affected. The above-mentioned ambiguity problem is solved, the accuracy of dynamic rendering in three-dimensional scenes is improved, and complex calculations (that is, the algorithm identification mentioned above) are avoided to distinguish between the sky environment and objects in the scene, making the dynamic rendering process in three-dimensional scenes more convenient.

[0077] In addition, for the user side, the relevant color parameters of the environment to be simulated can be dynamically sampled to obtain different environmental state parameters and input them into the environmental parameter model. The environmental parameter model can then assist in rendering the environment, supporting real-time dynamic simulation of changes in the surrounding environment in the form of stepless switching, effectively improving the overall expressiveness of the three-dimensional scene.

[0078] It can be seen from the above embodiments that the present application constructs an environmental parameter model with adjustable parameters, and by inputting different environmental state parameters into the environmental parameter model, it is possible to render the environmental part separately and simulate the changes in the surrounding environment steplessly, thereby improving the overall expressiveness of the three-dimensional scene; in addition, the stepless real-time dynamic environmental adjustment can approximately simulate weather conditions, and can be applied to scenarios such as dynamic updates of weather in digital twin systems.

[0079] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, personal computer, mobile phone, etc., or other electronic devices that can achieve the same or similar functions. This embodiment does not impose any restrictions on this.

[0080] Based on this, the embodiment of the present application provides an environment rendering method based on parameterized adjustment, which can be applied to three-dimensional rendering scenes such as maps. Figure 4 , Figure 4 This is a flow chart of the first embodiment of the environment rendering method based on parameterized adjustment of the present application.

[0081] In this embodiment, the environment rendering method based on parameterized adjustment includes steps S10 to S30:

[0082] Step S10, obtaining the environmental state parameters input by the user;

[0083] Wherein, the environmental state parameter includes at least one color parameter.

[0084] It should be noted that the user can obtain different environmental state parameters by dynamically sampling the relevant color parameters of the environment to be simulated in real time.

[0085] In some embodiments, at least one color parameter included in the environmental state parameters may be represented by an RGB (RedGreenBlue) color value.

[0086] Step S20, inputting the environmental state parameter into an environmental parameter model, and allowing the environmental parameter model to determine the shading color values ​​corresponding to a plurality of shading points in a pre-constructed cubic space based on the at least one color parameter.

[0087] In some embodiments, in the process of constructing an environmental parameter model, the cube space can be constructed first by setting the vertices of the cube space, or by other related parameters, and then the environment is subsequently rendered on the cube space. This application does not limit the method of constructing the cube space.

[0088] For example, if you need to pre-build a 2*2*2 cube space, you can construct a 2*2*2 cube space by setting the eight vertices of the cube space to: 1,1,-1; -1,1,-1; 1,-1,-1; -1,-1,-1; 1,1,1; -1,1,1; 1,-1,1; -1,-1,1; -1,-1,1.

[0089] Exemplarily, a cubic space may also be constructed by setting each vertex and each edge of the cubic space. For example, a cubic space may be constructed by the following steps:

[0090] const boxPosition=new Float32Array([

[0091] 1,1,-1,

[0092] -1,1,-1,

[0093] 1,-1,-1,

[0094] -1,-1,-1,

[0095] 1,1,1,

[0096] -1,1,1,

[0097] 1,-1,1,

[0098] -1,-1,1]); / / Vertex of cube space;

[0099] const boxIndices=new Uint16Array([

[0100] 0,2,1,

[0101] 2,3,1,

[0102] 4,5,6,

[0103] 5,7,6,

[0104] 4,0,5,

[0105] 0,1,5,

[0106] 6,7,2,

[0107] 7,3,2,

[0108] 6,0,4,

[0109] 6,2,0,

[0110] 5,1,7,

[0111] 1,3,7]); / / The edge of the cube space.

[0112] Step S30, in the cubic space, the plurality of shading points are respectively colored using the coloring color values ​​respectively corresponding to the plurality of shading points, and the colored cubic space is obtained as the target rendering environment corresponding to the environmental state parameter.

[0113] It should be noted that after constructing the above-mentioned cubic space, multiple shading points can be divided on the surface of the cubic space. The shading points here can be understood as shading point fragments, which actually represent a small shading area. Each small shading area on the surface of the cubic space supports shading according to the corresponding shading color value to render the environment on the cubic space. The number of divided shading points can be set according to actual conditions. The more the number, the more realistic the rendered environment.

[0114] After the present application inputs at least one color parameter in the environmental state parameters into the environmental parameter model, the environmental parameter model can determine the shading color values ​​corresponding to multiple shading points in the cube space based on the at least one color parameter, and then color the multiple shading points in the cube space using the shading color values ​​corresponding to the multiple shading points, to obtain the colored cube space as the target rendering environment corresponding to the environmental state parameter input by the user.

[0115] It should also be noted that if the target rendering environment needs to be updated, the user can input new environment state parameters. After the new environment state parameters are input into the environment parameter model, the environment parameter model can redetermine the shading color values ​​corresponding to the multiple shading points in the cube space based on at least one new color parameter to update the shading color values ​​corresponding to the multiple shading points; then, on the cube space, the multiple shading points are colored respectively using the shading color values ​​corresponding to the updated multiple shading points to obtain the colored cube space, which can be used as the updated target rendering environment corresponding to the new environment state parameters, thereby realizing dynamic updating of the target rendering environment.

[0116] In some embodiments, the environment state parameters most recently input by the user may be obtained at preset time intervals, and the target rendering environment may be dynamically updated using the environment state parameters. The preset time may be set according to actual conditions and is not limited in this application.

[0117] In other embodiments, after rendering the target rendering environment on one layer using the environmental parameter model, objects in the scene, such as houses, rivers, trees, roads, etc., can be rendered separately on another layer, that is, the target rendering environment and objects in the scene are rendered separately on two layers.

[0118] This embodiment provides an environment rendering method based on parameterized adjustment, constructs an environment parameter model with adjustable parameters, and inputs environment state parameters into the environment parameter model. The environment parameter model determines the coloring color values ​​corresponding to multiple coloring points in the pre-constructed cubic space based on at least one color parameter in the environment state parameters. Then, the multiple coloring points can be colored respectively in the cubic space using the coloring color values ​​corresponding to the multiple coloring points determined by the environment parameter model, and the colored cubic space is obtained as the target rendering environment corresponding to the environment state parameters. For the user side, different environment state parameters can be obtained by dynamically sampling the relevant color parameters of the environment to be simulated and inputting them into the environment parameter model. The environment parameter model assists in rendering the environment, and supports real-time dynamic simulation of changes in the surrounding environment in the form of stepless switching, which effectively improves the overall expressiveness of the three-dimensional scene. In addition, compared with the related art in which the sky and objects in the scene are rendered as a whole, and then further adjusted by identifying the sky part in the rendered image, the recognition process may be difficult to accurately identify the sky part due to the ambiguity between the sky and the objects in the scene, which in turn leads to errors in updating the rendered image. The present application uses environmental parameter models and environmental state parameters to separately render the surrounding environment and simulate environmental changes. There is no need to identify the sky part and then make adjustments. When adjusting the environmental changes through the environmental parameter model, it does not affect the rendering of objects in the scene. The above-mentioned ambiguity problem is solved, the accuracy of dynamic rendering is improved, and complex calculations are avoided to distinguish between the sky environment and the objects in the scene. The dynamic rendering process is more convenient.

[0119] Reference Figure 5 , Figure 5 This is a flow chart of the second embodiment of the environment rendering method based on parameterized adjustment of the present application. Figure 4 The first embodiment shown proposes a second embodiment of the environment rendering method based on parameterized adjustment of the present application. The contents of the second embodiment that are the same or similar to the above-mentioned first embodiment can be referred to the above introduction and will not be repeated later.

[0120] In a second embodiment, the at least one color parameter may include at least one of a sky color value and a ground color value, the cubic space is divided into a sky area and a ground area, and a plurality of shading points on the cubic space are divided into at least one ground shading point corresponding to the ground area and at least one sky shading point corresponding to the sky area;

[0121] In addition, the above step S20 includes the following specific steps:

[0122] Step S201, input the environmental state parameters into the environmental parameter model, and the environmental parameter model determines the first shading color value corresponding to each of the ground shading points based on the ground color value, and / or, the environmental parameter model determines the second shading color value corresponding to each of the sky shading points based on the sky color value.

[0123] Accordingly, the above step S30 includes the following specific steps:

[0124] Step S301, using the first shading color value corresponding to each of the ground shading points, to color each of the ground shading points, and / or using the second shading color value corresponding to each of the sky shading points, to color each of the sky shading points, to obtain a colored cubic space as the target rendering environment corresponding to the environmental state parameter.

[0125] Specifically, the at least one color parameter may include at least one of a sky color value and a ground color value, and the cubic space is also divided into a sky area and a ground area, respectively representing the sky part in the cubic box; a plurality of shading points on the cubic space are divided into at least one ground shading point corresponding to the ground area and at least one sky shading point corresponding to the sky area;

[0126] In some embodiments, the sky area and the ground area may be divided by setting a ground plane in the cubic space.

[0127] Exemplarily, for a 2*2*2 cubic space constructed by 8 vertices: 1,1,-1; -1,1,-1; 1,-1,-1; -1,-1,-1; 1,1,1; -1,1,1; 1,-1,1,1; -1,-1,1, the center point of the cubic space is the origin 0,0,0 of the three-dimensional coordinate system, and the plane with z=0 can be set as the ground plane to divide the sky area and the ground area, for example, z<0 is calibrated as the ground area, and z>0 is calibrated as the sky area.

[0128] Among them, calibration refers to: the process of calibrating an object as B, and in this application, it specifically refers to the calibration of the sky in a three-dimensional scene, that is, the process of calibrating which areas are the sky.

[0129] In some embodiments, since the sky and the objects in the three-dimensional scene are a whole, and the sky has its own special feature - infinity, the present application can use calibration rather than algorithm recognition to pick up the sky, for example, the z value of the normal vector is set to 0.9999 to simulate infinity as the calibration of the sky. Since the normal vector will not be used in the drawing of geometric bodies, it can be calibrated as a calibration item to avoid interference between the calibration process and the drawing process of the geometric body. Here, z = 0.9999 is calibrated as the sky so that when there are objects in the scene, the upper limit of the sky box (i.e., the above-mentioned sky area) can be calibrated through it, so as to quickly distinguish whether the pixel point is in the area of ​​the sky box or the area of ​​the non-sky box. The pixel points in the area calibrated at 0.9999 are rendered according to the logic of the sky box.

[0130] After the cubic space is divided into the sky area and the ground area, correspondingly, a plurality of shading points on the cubic space can be divided into at least one ground shading point corresponding to the ground area and at least one sky shading point corresponding to the sky area.

[0131] For at least one ground shading point, if the environmental state parameters include ground color values, then after the environmental state parameters are input into the environmental parameter model, the environmental parameter model will determine the first shading color values ​​corresponding to each ground shading point based on the ground color values. For example, the ground color value is directly used as the first shading color value corresponding to each ground shading point. For another example, the first shading color values ​​corresponding to each ground shading point can be determined in a customized manner based on multiple ground color values. After determining the first shading color values, the corresponding ground shading points are colored using these first shading color values ​​to complete the rendering of the ground area.

[0132] For at least one sky shading point, if the environmental state parameters include sky color values, then after the environmental state parameters are input into the environmental parameter model, the environmental parameter model will determine the second shading color values ​​corresponding to each sky shading point based on the sky color values. For example, the sky color value is directly used as the second shading color value corresponding to each sky shading point. For another example, the second shading color value corresponding to each sky shading point can be determined in a customized manner based on multiple sky color values. After determining the second shading color values, the corresponding sky shading points are colored using these second shading color values ​​to complete the rendering of the sky area.

[0133] It should be noted that, according to the three situations that the environmental state parameters only include sky color values, only include ground color values, and include both sky color values ​​and ground color values, correspondingly, only the sky area can be rendered, or only the ground area can be rendered, or both the sky area and the ground area can be rendered.

[0134] In some embodiments, during the process of updating the target rendering environment, assuming that the new environment state parameters input by the user only include the sky color value, the sky color value can be used alone through the above rendering method to re-render only the sky area, while the last rendering result of the ground area remains unchanged.

[0135] In some embodiments, the at least one color parameter may also include a fog color value.

[0136] In the above step S301: the step of determining the second coloring color value corresponding to each of the sky coloring points based on the sky color value by the environmental parameter model can be replaced by the following implementation:

[0137] The environment parameter model determines the second shading color value corresponding to each of the sky shading points based on the sky color value and the fog color value.

[0138] Specifically, in order to simulate the blurred fog effect of the actual environment at a very far distance, at least one color parameter input by the user may also include a fog color value. The environmental parameter model can jointly determine the second shading color value corresponding to each sky shading point based on the sky color value and the fog color value to simulate the fog effect in the sky area.

[0139] It should be noted that a similar method to the above can also be used to simulate the atomization effect in the ground area, which is not elaborated in this application.

[0140] In some embodiments, the step of determining the second shading color value corresponding to each of the sky shading points based on the sky color value and the fog color value may specifically include the following sub-steps:

[0141] Sub-step 1, obtaining the shading point coordinates of each of the sky shading points in the cubic space.

[0142] Sub-step 2, determining a first angle between each of the sky shading points and the ground plane of the cubic space based on the shading point coordinates corresponding to each of the sky shading points and the center point coordinates of the cubic space;

[0143] The ground plane is used to divide the cubic space into the sky area and the ground area.

[0144] For example, Figure 6 This is a schematic diagram of an environment rendered by the environment rendering method based on parameterized adjustment in this application, such as Figure 6 As shown, first obtain the shading point coordinates of each sky shading point in the cube space. For example, if the sky shading point is point P in the figure, then the shading point coordinates (x1 ,y 1 ,z 1 ).

[0145] Then, based on the shading point coordinates corresponding to each sky shading point and the center point coordinates of the cube space (that is, the coordinates of point O, (0,0,0) in the figure), the first angle between each sky shading point and the ground plane (z=0) of the cube space is determined.

[0146] For example, for a sky shading point P, we can calculate the sky shading point coordinates (x 1 ,y 1 ,z 1 ) and the center point coordinates (0,0,0), determine the first angle A between the sky shading point P and the ground plane (z=0) of the cubic space. Specifically, the spherical normal vector OP of the inscribed sphere surface in the cubic space and the ordinate z of the sky shading point P can be used. 1 , the first angle A is obtained by trigonometric functions, or the first angle A between the sky shading point P and the point O can be calculated by linear interpolation coordinates in the fragment shader. The present application does not limit the method for determining the first angle A.

[0147] It should be noted that the above-mentioned spherical normal vector specifically refers to: the cross product of the tangent lines in two directions passing through a point on the sphere is the normal line of a point on the sphere; if the coordinates of the center of the sphere (that is, the coordinates of the center point of the cube) are known, the normal vector of a point on the sphere can be obtained by subtracting the coordinates of the center of the sphere from the coordinates of a point on the sphere.

[0148] Sub-step 3, determining whether the first angle corresponding to the sky shading point is within a preset target atomization range;

[0149] The target atomization range is used to indicate the angle range to be atomized.

[0150] It should be noted that, in the process of constructing the environmental parameter model, the target atomization range may be preset and calibrated, or the target atomization range may be calibrated by user input, and this application does not impose any restrictions on this.

[0151] Sub-step 4-1, when the first angle is within the target atomization range, based on the first angle corresponding to the sky shading point, using a mixing function to mix and calculate the sky color value and the fog color value to obtain a second shading color value corresponding to the sky shading point;

[0152] The first angle is related to the mixing coefficient in the mixing function.

[0153] Sub-step 4-2, when the first angle is not within the target atomization range, determining the sky color value as the second coloring color value corresponding to the sky coloring point.

[0154] Specifically, after determining the first angle corresponding to each sky shading point, it can be determined whether the first angle corresponding to each sky shading point is within the target atomization range to be atomized. The following two situations are divided according to the judgment result:

[0155] Case 1: If it is determined that the first angle is within the target fogging range, execute sub-step 4-1. Based on the first angle corresponding to each sky shading point, use a mixing function to mix and calculate the sky color value and the fog color value to obtain the second shading color value corresponding to each sky shading point. Then use the second shading color value obtained in this way to color the corresponding sky shading point to achieve a fogging effect within the target fogging range of the sky area.

[0156] It should be noted that the range of the first angle is set to 0-90°, 0° represents the ground plane (z=0), and 90° represents the top of the cubic space (the position where the planes z=1, x=0 and y=0 intersect).

[0157] It should also be noted that the first angle can be set to be related to the mixing coefficient in the above-mentioned mixing function so that the colors mixed at different angles present a gradual fog effect. For example, the smaller the first angle, the closer the shading point is considered to be to the ground plane. In this case, a larger mixing coefficient can be set accordingly to mix in more fog color and simulate the blurred fog effect at a very far distance. The larger the first angle, the closer the shading point is considered to be to the top of the head. In this case, a smaller mixing coefficient can be set accordingly to mix in less fog color.

[0158] Case 2: If it is determined that the first angle is not within the target atomization range, execute sub-step 4-2 to directly determine the sky color value as the second shading color value corresponding to each sky shading point, so as not to apply atomization effect to the area outside the target atomization range.

[0159] In some embodiments, Figure 6 As shown, the horizon color can also be set, and the shading point at z=0 in the cube space is colored using the horizon color to simulate the horizon in the cube space.

[0160] It should be noted that, during the rendering process, the fragment coordinates of each shading point (that is, the above-mentioned shading point coordinates) can be determined according to the normal vector of the surface of the inscribed sphere in the cube space, and then different first angles are calculated in combination with the center point O, and the shading point color corresponding to each shading point is obtained, and then the above parameters are passed to the fragment shader, so that the fragment shader can color the multiple shading points on the inner surface of the cube space to realize the rendering of the cube space.

[0161] In some embodiments, a specific implementation method for the user to indicate the target atomization range is provided. The environmental state parameter may also include an atomization start point and an atomization end point, which are selected by the user from a plurality of colored points on the cubic space to indicate the target atomization range.

[0162] Specifically, before the above sub-step 3, the above method further includes:

[0163] Sub-step 5, determining a second angle between the atomization starting point and the ground plane based on the shading point coordinates of the atomization starting point in the cubic space and the center point coordinates of the cubic space;

[0164] Sub-step 6, determining a third angle between the atomization cutoff point and the ground plane based on the shading point coordinates of the atomization cutoff point in the cubic space and the center point coordinates of the cubic space;

[0165] Sub-step 7: determining the angle range between the second angle and the third angle as the target atomization range.

[0166] Specifically, the environmental state parameters input by the user may also include an atomization start point and an atomization end point. Specifically, the user may select the atomization start point and the atomization end point from a plurality of shading points on the cubic space to indicate the above target atomization range.

[0167] Since the target atomization range is used to indicate the angle range to be atomized, it is necessary to first convert the atomization starting point and the atomization end point into angles with the ground plane. Specifically, based on the shading point coordinates of the atomization starting point in the cube space and the center point coordinates of the cube space, the second angle between the atomization starting point and the ground plane is determined, and based on the shading point coordinates of the atomization end point in the cube space and the center point coordinates of the cube space, the third angle between the atomization end point and the ground plane is determined; and then the angle range between the second angle and the third angle is determined as the target atomization range.

[0168] It should be noted that the second angle and the third angle corresponding to the atomization start point and the atomization end point selected by the user are usually different.

[0169] In some embodiments, the environmental state parameters input by the user may also only include the atomization cutoff point. In this case, the second angle corresponding to the atomization starting point is considered to be 0, that is, the atomization is cut off from the horizon to the third angle corresponding to the atomization cutoff point.

[0170] It should also be noted that if Figure 6As shown, the center point O of the cube space and any point P on the spherical surface of the inscribed sphere in the cube space form the inscribed circle normal vector. The angle A between the point P and the point O can be calculated by linear interpolation coordinates in the fragment shader, and the color of the point P is calculated and colored according to the angle A. Here, the corresponding relationship between the angle A and the color of the point P can be pre-set according to the actual situation, so that the fragment shader can be used to color the fragment with different colors according to different angles A to achieve the fog effect.

[0171] In some embodiments, a specific implementation of how to mix color values ​​based on a first angle of a sky shading point is provided.

[0172] In the above sub-step 4-1: the step of mixing and calculating the sky color value and the fog color value using a mixing function based on the first angle corresponding to the sky shading point to obtain a second shading color value corresponding to the sky shading point may specifically include the following sub-steps:

[0173] Sub-step 4-11, determining a mixing coefficient corresponding to the sky shading point based on a first angle corresponding to the sky shading point;

[0174] The mixing coefficient is inversely proportional to the first angle.

[0175] For example, the factor mixing coefficient can be calculated by the following process:

[0176] let factor:f32=clamp(0.0,1.0,angle1*fogIntensity);

[0177] Among them, clamp() represents a function used to limit the value within a specified range, where angle1 represents the first angle, and fogInstensity represents the fog intensity, which can be preset according to actual conditions.

[0178] Sub-step 4-12, determining the mixing function corresponding to the sky shading point based on the mixing coefficient corresponding to the sky shading point.

[0179] Exemplarily, based on the mixing coefficient factor corresponding to each sky shading point, the mixing function mix(fogColor,skyColor,factor) corresponding to each sky shading point can be determined. Depending on the factor, the mixing function can be considered to be different; wherein fogColor represents the fog color value, and skyColor represents the sky color value.

[0180] Sub-step 4-13, using the mixing function corresponding to the sky shading point, performing a mixing calculation on the sky color value and the fog color value to obtain a second shading color value corresponding to the sky shading point;

[0181] The mixing coefficient of the mixing function is directly proportional to the proportion of the fog color value in the mixing calculation.

[0182] Exemplarily, the second shading color value corresponding to each empty shading point may be determined as this.color=mix(fogColor, skyColor, factor);

[0183] It should be noted that for the mixing function mix(fogColor,skyColor,factor), factor represents the proportion of fogColor and skyColor in the mixing calculation. If the factor is larger, the proportion of fogColor in the mixing calculation is larger, and correspondingly, the proportion of skyColor in the mixing calculation is smaller; conversely, if the factor is smaller, the proportion of fogColor in the mixing calculation is smaller, and correspondingly, the proportion of skyColor in the mixing calculation is larger.

[0184] Specifically, the present application sets the mixing coefficient factor to be inversely proportional to the first angle angle1, and the mixing coefficient factor to be directly proportional to the proportion of the fog color value fogColor in the mixing calculation. For sky shading points with larger first angle angle1 (closer to the top of the sky box), the mixing coefficient factor is smaller, and thus the mixing proportion of the fog color value fogColor is smaller, that is, the shading color value corresponding to the shading point closer to the top of the sky box is closer to the sky color. Conversely, for sky shading points with smaller first angle angle1 (closer to the horizon of the sky box), the mixing coefficient factor is larger, and thus the mixing proportion of the fog color value fogColor is larger, that is, the shading color value corresponding to the shading point closer to the horizon of the sky box is mixed with more fog colors, so as to simulate the blurred fogging effect at a very far distance near the horizon.

[0185] Reference Figure 7 , Figure 7 This is a flow chart of the third embodiment of the environment rendering method based on parameterized adjustment of the present application. Figure 4 The first embodiment shown proposes a third embodiment of the environment rendering method based on parameterized adjustment of the present application. The contents in the third embodiment that are the same or similar to the above-mentioned first embodiment can be referred to the above introduction and will not be repeated later.

[0186] In the third embodiment, the environmental state parameter may further include indication information for indicating whether sunlight is simulated in the environment; in addition, before the above step S30, the following steps are also included:

[0187] Step S40, when the indication information indicates simulating sunlight in the environment, determining the sunlight irradiation direction corresponding to the preset current time.

[0188] Step S50, determining a fourth angle between the sunlight irradiation direction and the ground plane;

[0189] The ground plane is used to divide the cubic space into a sky area and a ground area.

[0190] Step S60, determining the sunlight intensity value corresponding to the sunlight irradiation direction based on the fourth angle and a preset sunlight influence coefficient;

[0191] The fourth angle is inversely proportional to the sunlight intensity value, and the sunlight influence coefficient is directly proportional to the sunlight intensity value.

[0192] Step S70, superimposing the sunlight intensity value with the shading color values ​​respectively corresponding to the plurality of shading points on the cubic space, and using the superimposed value as the updated shading color values ​​respectively corresponding to the plurality of shading points.

[0193] It should be noted that when rendering sunlight at different times, the effect of different sun altitudes on the sky will be simulated. Here, it can be considered that sunlight is not part of the environmental parameters, but external lighting, and is an external variable of environmental rendering. Ultimately, external lighting is needed to enhance the original rendering results.

[0194] Specifically, the user can use indication information to indicate the simulation of sunlight in the environment. At this time, it is necessary to first determine the sunlight direction corresponding to the preset current time. This is for the subsequent simulation of the effects of sunlight exposure at different times, and then determine the fourth angle between the sunlight direction and the ground plane. Based on the fourth angle and the preset sunlight influence coefficient, determine the sunlight intensity value corresponding to the sunlight direction.

[0195] Among them, the fourth angle is inversely correlated with the sunlight intensity value. The smaller the fourth angle is (simulating the sun just rising), the greater the sunlight intensity value is considered to be, and the larger the fourth angle is (simulating the sun is overhead), the smaller the sunlight intensity value is considered to be. The sunlight influence coefficient is directly proportional to the sunlight intensity value, and the sunlight influence coefficient can be pre-set according to actual conditions.

[0196] After determining the sunlight intensity value corresponding to the sunlight direction, superimpose the sunlight intensity value with the shading color values ​​corresponding to multiple shading points on the cube space, and use the superimposed value as the updated shading color value corresponding to the multiple shading points for subsequent rendering.

[0197] The following example illustrates the setting of external parameters of sunlight:

[0198] const angle4=angle(sun.direction,sky.normal);

[0199] const intensity=acos(angle4)*factor2; / / intensity is the sunlight intensity value, factor2 is the sunlight influence coefficient;

[0200] this.color+=this.color*intensity; / / Use the intensity of sunlight to enhance the original rendering result. When the sunlight is 0 degrees, the impact on the horizon is the greatest, and it gradually weakens at 90 degrees, and vice versa.

[0201] this.color = clamp (0, 0.99, this.color) / / Avoid overexposure.

[0202] Among them, angle4 represents the fourth angle, sun.direction represents the direction of sunlight, and sky.normal represents the direction of the horizon.

[0203] In some embodiments, the parameters related to sunlight act on the sky to simulate the changes in scene environment over time. The illumination intensity corresponding to sunlight at different times is different. This application will need to provide the direction of sunlight abstracted as 0 degrees for the horizon and 90 degrees for the top of the head. Here, we take the direct setting of the direction of sunlight to simulate sunlight as an example. Without tracing the relationship between the sun angle, time and celestial movement, we can also change the corresponding relationship between the current time and the direction of sunlight according to the specific situation. For the calculation of the sunlight intensity value, the current time can also be considered for adjustment, for example, by setting corresponding weights in different months and places, etc. This application does not limit this.

[0204] In this embodiment, taking into account the influence of external sunlight on the surrounding environment, the environmental state parameters may also include indication information for indicating whether to simulate sunlight in the environment. When the user indicates the indication information for simulating sunlight in the environment, the relevant parameters of sunlight can be used to enhance the rendering of the sky area and the ground area. When enhancing the rendering, the illumination direction of the sunlight and the corresponding influence coefficient are taken into account, so that the influence of external sunlight on the surrounding environment can be simulated more realistically, further enhancing the overall expressiveness of the three-dimensional scene.

[0205] The following example illustrates the environment rendering method based on parameterized adjustment provided in the embodiment of the present application. The method can be applied to the following usage scenarios:

[0206] 1) The simulation of the global environment in a three-dimensional scene requires dynamic changes.

[0207] 2) Real-time dynamic simulation of surrounding environment changes in three-dimensional electronics.

[0208] First, the principle of the environment rendering method based on parameterized adjustment of this application is explained:

[0209] 1. Parameterization of environmental composition:

[0210] By understanding the sky environment, we can build a parametric model of the sky environment (that is, the above-mentioned environmental parameter model). Figure 8 A schematic diagram of parameters required for constructing an environment parameter model in the environment rendering method based on parameterized adjustment in this application, such as Figure 8 As shown, building a skybox requires the following parameters:

[0211] 1) Cube box (also known as cube space): the physical space that constitutes the entire environment;

[0212] 2) Sky color: Set a solid color to simulate the sky;

[0213] 3) Two noise images: used to simulate clouds in the sky or stars at night. They do not provide a source of illumination for the scene.

[0214] 4) Ground color: Set a solid color to simulate the ground;

[0215] 5) Fog range: By default, fog starts from the horizon and the fog cut-off point is calculated according to the angle;

[0216] 6) Fog color: simulates the blurred fog effect at a very far distance, and specifically presents the fog effect within the fog range.

[0217] In addition, when rendering at different times, you can simulate the impact of the sun on the sky at different heights. Sunlight is not part of the environmental parameters, but external lighting and an external variable of environmental rendering.

[0218] (ii) Determine the coloring point:

[0219] The fragment coordinates of the shading point (that is, the above-mentioned shading point coordinates) are determined according to the normal vector of the surface of the inscribed sphere in the cube space, and the angle is calculated in combination with the center point of the cube space, and the shading color value of the fragment is obtained together with the input angle value.

[0220] (III) Parametric rendering:

[0221] The shading point coordinates and the corresponding shading color values ​​of each shading point are passed to the fragment shader, and the fragment shader colors the inner surface color of the cube space.

[0222] The process of the method of this application is described below, and the process mainly includes the following two parts:

[0223] (1) Construction and calibration of environmental parameter model.

[0224] (2) Rendering.

[0225] Specifically, it can be divided into the following points:

[0226] 1) First, build the environment parameter model, construct the cube space by setting vertices and edges, and calibrate it using the specific value of the normal vector.

[0227] For example, when the cubic space is the 2*2*2 cubic space mentioned in the above embodiment, the z value of the normal vector is set to 0.9999 as a calibration for the sky.

[0228] 2) Environment scene construction: Divide the scene according to the ground plane z=0, construct the upper half of the cube space (for example, the part of the cube space where z>0) as the sky area, and construct the lower half of the cube space (for example, the part of the cube space where z<0) as the ground area. This can be achieved in the following ways:

[0229] if(position,z<0){

[0230] this.color = landColor; / / For each shading point in the lower half of the cube space, the ground color (landColor) is used uniformly for drawing, and the rendered visual appearance is a plane.

[0231] }else{

[0232] const angle = asin(position,z / cube,size); / / 0 degrees from the horizon to 90 degrees above the head, position,z represents the z coordinate value of each shading point in the sky area, cube,size represents the radius of the inscribed sphere in the cube space.

[0233] / / Atomization range setting.

[0234] / / Calculate atomization parameters (such as atomization effect).

[0235] let factor:f32=clamp(0.0,1.0,angle1*fogIntensity);

[0236] this.color=mix(fogColor,skyColor,factor);

[0237] }

[0238] 3) The relevant parameters of sunlight act on the sky to simulate the changes in the scene environment over time. The direction of parallel light provided by sunlight at different times is different, and the corresponding illumination intensity is also different. This application abstracts the direction of parallel light that needs to be provided as 0 degrees for the horizon and 90 degrees for the top of the head. Here, we take the direct setting of sunlight illumination direction to simulate sunlight as an example, without tracing the relationship between the sun angle, time and celestial movement.

[0239] The following example illustrates the setting of external parameters of sunlight:

[0240] const angle4=angle(sun.direction,sky.normal);

[0241] const intensity=acos(angle4)*factor2; / / intensity is the sunlight intensity value, factor2 is the sunlight influence coefficient;

[0242] this.color+=this.color*intensity; / / Use the intensity of sunlight to enhance the original rendering result. When the sunlight is 0 degrees, the impact on the horizon is the greatest, and it gradually weakens at 90 degrees, and vice versa.

[0243] this.color = clamp (0, 0.99, this.color) / / Avoid overexposure.

[0244] 4) Other environmental elements simulation of the sky, such as clouds and stars at night, can be realized by referring to the noise cloud map.

[0245] In the embodiments of the present application, there are at least the following beneficial effects:

[0246] (1) The simulation of the surrounding environment is parameterized and modeled to achieve dynamic real-time adjustment without relying on pre-generation. What you see is what you get, which improves the overall expressiveness of the three-dimensional scene. In addition, the stepless real-time dynamic environment adjustment can approximate the simulation of weather conditions and can be applied to the dynamic update of weather in the digital twin system.

[0247] 2) Avoid complex algorithm recognition to distinguish the sky environment part from the scene entity part.

[0248] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the environment rendering method based on parameterized adjustment of the present application. More forms of simple transformations based on this technical concept are all within the protection scope of the present application.

[0249] This application also provides an environment rendering device based on parameterized adjustment, please refer to Fig. 9 , Fig. 9 This is a schematic diagram of the module structure of an environment rendering device based on parameterized adjustment according to an embodiment of the present application. The environment rendering device based on parameterized adjustment includes:

[0250] The acquisition module 901 is used to acquire the environment state parameters input by the user; wherein the environment state parameters include at least one color parameter;

[0251] A determination module 902 is used to input the environmental state parameter into an environmental parameter model, and the environmental parameter model determines the coloring color values ​​corresponding to a plurality of coloring points in a pre-constructed cubic space based on the at least one color parameter;

[0252] The coloring module 903 is used to color the multiple shading points respectively in the cubic space using the coloring color values ​​respectively corresponding to the multiple shading points, and obtain the colored cubic space as the target rendering environment corresponding to the environmental state parameter.

[0253] The environment rendering device based on parametric adjustment provided by the present application adopts the environment rendering method based on parametric adjustment in the above-mentioned embodiment, which can solve the technical problem of poor overall expression of three-dimensional scenes. Compared with the related art, the beneficial effects of the environment rendering device based on parametric adjustment provided by the present application are the same as the beneficial effects of the environment rendering method based on parametric adjustment provided by the above-mentioned embodiment, and the other technical features in the environment rendering device based on parametric adjustment are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.

[0254] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the environment rendering method based on parameterized adjustment in at least one of the above-mentioned method embodiments.

[0255] Reference below Fig.10 , Fig.10 The device structure diagram of the hardware operating environment involved in the environment rendering method based on parameterized adjustment in the embodiment of the present application shows a structural diagram of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.10 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0256] like Fig.10As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM 1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM 1002, and RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0257] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0258] The electronic device provided by the present application adopts the environment rendering method based on parameterized adjustment in the above embodiment, which can solve the technical problem of poor overall expression of three-dimensional scenes. Compared with the relevant technology, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the environment rendering method based on parameterized adjustment provided in the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0259] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0260] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0261] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the environment rendering method based on parameterized adjustment in the above-mentioned embodiment.

[0262] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared systems, systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0263] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0264] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the electronic device performs the following steps:

[0265] Acquire environmental state parameters input by a user; wherein the environmental state parameters include at least one color parameter;

[0266] Inputting the environmental state parameter into an environmental parameter model, and using the environmental parameter model to determine coloring color values ​​corresponding to a plurality of coloring points on a pre-constructed cubic space based on the at least one color parameter;

[0267] In the cubic space, the plurality of shading points are respectively colored using the coloring color values ​​respectively corresponding to the plurality of shading points, and the colored cubic space is obtained as the target rendering environment corresponding to the environmental state parameter.

[0268] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0269] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0270] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0271] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned environment rendering method based on parameterized adjustment, and can solve the technical problem of poor overall expression of three-dimensional scenes. Compared with the related art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the environment rendering method based on parameterized adjustment provided by the above-mentioned embodiment, and will not be repeated here.

[0272] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned environment rendering method based on parameterized adjustment when executed by a processor.

[0273] The computer program product provided by this application can solve the technical problem of poor overall performance of three-dimensional scenes. Compared with the related art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the environment rendering method based on parameterized adjustment provided by the above embodiment, which will not be repeated here.

[0274] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for environment rendering based on parameterized adjustment, characterized in that: The method comprises: Acquire environmental state parameters input by a user; wherein the environmental state parameters include at least one color parameter; Inputting the environmental state parameter into an environmental parameter model, and using the environmental parameter model to determine coloring color values ​​corresponding to a plurality of coloring points on a pre-constructed cubic space based on the at least one color parameter; In the cubic space, the plurality of shading points are respectively colored using the coloring color values ​​respectively corresponding to the plurality of shading points, and the colored cubic space is obtained as the target rendering environment corresponding to the environmental state parameter.

2. The method according to claim 1, characterized in that The at least one color parameter includes at least one of a sky color value and a ground color value, the cubic space is divided into a sky area and a ground area, and a plurality of shading points on the cubic space are divided into at least one ground shading point corresponding to the ground area and at least one sky shading point corresponding to the sky area; The step of inputting the environmental state parameter into the environmental parameter model, and determining, by the environmental parameter model based on the at least one color parameter, the coloring color values ​​corresponding to the plurality of coloring points in the pre-constructed cubic space, respectively, comprises: The environmental state parameters are input into an environmental parameter model, and the environmental parameter model determines the first coloring color values ​​corresponding to the ground coloring points based on the ground color value, and / or the environmental parameter model determines the second coloring color values ​​corresponding to the sky coloring points based on the sky color value; The step of coloring the plurality of shading points respectively using the coloring color values ​​respectively corresponding to the plurality of shading points to obtain the colored cubic space as the target rendering environment corresponding to the environmental state parameter comprises: Each of the ground shading points is colored using the first shading color value corresponding to each of the ground shading points, and / or each of the sky shading points is colored using the second shading color value corresponding to each of the sky shading points, to obtain a colored cubic space as the target rendering environment corresponding to the environmental state parameter.

3. The method according to claim 2, characterized in that The at least one color parameter also includes a fog color value; The step of determining the second coloring color value corresponding to each of the sky coloring points based on the sky color value by the environmental parameter model comprises: The environment parameter model determines the second shading color value corresponding to each of the sky shading points based on the sky color value and the fog color value.

4. The method according to claim 3, characterized in that The step of determining the second shading color value corresponding to each of the sky shading points based on the sky color value and the fog color value comprises: Obtain the shading point coordinates of each of the sky shading points in the cubic space; Based on the shading point coordinates corresponding to each of the sky shading points and the center point coordinates of the cubic space, determining a first angle between each of the sky shading points and a ground plane of the cubic space; wherein the ground plane is used to divide the cubic space into the sky area and the ground area; Determine whether the first angle corresponding to the sky shading point is within a preset target atomization range; wherein the target atomization range is used to indicate the angle range to be atomized; When the first angle is within the target atomization range, based on the first angle corresponding to the sky shading point, a mixing function is used to mix and calculate the sky color value and the fog color value to obtain a second shading color value corresponding to the sky shading point; wherein the first angle is related to a mixing coefficient in the mixing function; When the first angle is not within the target atomization range, the sky color value is determined as a second shading color value corresponding to the sky shading point.

5. The method according to claim 4, characterized in that The environmental state parameters also include an atomization start point and an atomization end point, wherein the atomization start point and the atomization end point are selected by a user from a plurality of colored points on the cubic space and are used to indicate the target atomization range; Before the step of determining whether the first angle corresponding to the sky shading point is within a preset target atomization range, the method further includes: Determine a second angle between the atomization starting point and the ground plane based on the shading point coordinates of the atomization starting point in the cubic space and the center point coordinates of the cubic space; Determine a third angle between the atomization cutoff point and the ground plane based on the shading point coordinates of the atomization cutoff point in the cubic space and the center point coordinates of the cubic space; The angle range between the second angle and the third angle is determined as the target atomization range.

6. The method according to claim 4 or 5, characterized in that The step of performing a mixing calculation on the sky color value and the fog color value using a mixing function based on the first angle corresponding to the sky shading point to obtain a second shading color value corresponding to the sky shading point comprises: Determine a mixing coefficient corresponding to the sky shading point based on a first angle corresponding to the sky shading point; wherein the mixing coefficient is inversely proportional to the first angle; Determining a mixing function corresponding to the sky shading point based on a mixing coefficient corresponding to the sky shading point; The sky color value and the fog color value are mixed and calculated using the mixing function corresponding to the sky shading point to obtain a second shading color value corresponding to the sky shading point; wherein the mixing coefficient of the mixing function is positively correlated with the proportion of the fog color value in the mixing calculation.

7. The method according to any one of claims 1 to 5, characterized in that: The environmental state parameters also include indication information for indicating whether sunlight is simulated in the environment; Before the step of coloring the plurality of shading points respectively using the coloring color values ​​respectively corresponding to the plurality of shading points in the cubic space to obtain the colored cubic space as the target rendering environment corresponding to the environmental state parameter, the method further includes: In the case where the indication information indicates simulating sunlight in the environment, determining the sunlight irradiation direction corresponding to the preset current time; Determine a fourth angle between the sunlight irradiation direction and a ground plane; wherein the ground plane is used to divide the cubic space into a sky area and a ground area; Based on the fourth angle and the preset sunlight influence coefficient, determine the sunlight intensity value corresponding to the sunlight irradiation direction; wherein the fourth angle is inversely proportional to the sunlight intensity value, and the sunlight influence coefficient is directly proportional to the sunlight intensity value; The sunlight intensity value is superimposed with the shading color values ​​respectively corresponding to the plurality of shading points on the cubic space, and the superimposed value is used as the shading color values ​​respectively corresponding to the plurality of shading points after update.

8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the environment rendering method based on parameterized adjustment according to any one of claims 1 to 7.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the environment rendering method based on parameterized adjustment as described in any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the environment rendering method based on parameterized adjustment according to any one of claims 1 to 7 are implemented.