Method, device and electronic device for simulating three-dimensional scene visual effects

By combining two-dimensional coordinates and camera vectors in the patch model to update three-dimensional coordinates, the balance problem between memory consumption and visual effects in three-dimensional scene rendering is solved, and an efficient three-dimensional perspective effect is achieved.

CN115100336BActive Publication Date: 2025-09-23NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210590367.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2025-09-23
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

Existing technologies have difficulty striking a balance between visual effects and memory consumption when rendering three-dimensional scenes that do not need to be entered. Two-dimensional rendering methods lack three-dimensional dynamic perspective effects, while full three-dimensional rendering leads to excessive memory consumption.

Method used

By determining the two-dimensional coordinates in the patch model, combining the camera vector and the three-dimensional coordinates, and using the sampled camera movement to update the three-dimensional coordinates, a dynamic perspective effect is achieved and memory usage is reduced.

Benefits of technology

While reducing memory consumption, it achieves realistic three-dimensional perspective effects and improves rendering efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115100336B_ABST
    Figure CN115100336B_ABST
Patent Text Reader

Abstract

The present application provides a method, device and electronic device for simulating the visual effects of a three-dimensional scene; the method comprises: determining two-dimensional coordinates in a preset patch model, and storing a pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera according to the two-dimensional coordinates; setting a first dimension perpendicular to the two-dimensional coordinates in the patch model, combining the first dimension with the two-dimensional coordinates to obtain the three-dimensional coordinates of the patch model; determining a camera vector in the sampling camera, and in response to movement of the sampling camera, determining an updated three-dimensional coordinate after the movement using the camera vector and the three-dimensional coordinates before the camera movement; sampling the texture according to the updated three-dimensional coordinates, and rendering it to the screen to obtain a dynamic three-dimensional perspective effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of scene rendering, and in particular to a method, device, and electronic device for simulating three-dimensional scene visual effects. Background Art

[0002] In the relevant 3D scene rendering technology, for some scenes that do not need to be entered, there are mainly two rendering methods:

[0003] One way is to place a two-dimensional plane picture of the scene image at the scene. Although this method takes up little memory and saves resources, since the placed image is two-dimensional, it does not have a three-dimensional dynamic perspective effect. Therefore, except for observing at a specific angle and a specific position, the visual effect is not realistic enough when observed at any other angle or position.

[0004] Another way is to build 3D scenes for scenes that do not need to be entered. Although this method has the best visual effect, the same 3D rendering is required for scenes that do not need to be entered, which often leads to huge pressure on runtime memory consumption.

[0005] Based on this, a rendering solution is needed that can achieve low memory consumption and three-dimensional visual effects. Summary of the Invention

[0006] In view of this, the purpose of this application is to provide a method and related device for simulating three-dimensional scene visual effects.

[0007] Based on the above objectives, the present application provides a method for simulating the visual effects of a three-dimensional scene, comprising:

[0008] Determining two-dimensional coordinates in a preset patch model, and storing the pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera according to the two-dimensional coordinates;

[0009] Setting a first dimension perpendicular to the two-dimensional coordinates in the patch model, and combining the first dimension with the two-dimensional coordinates to obtain three-dimensional coordinates of the patch model;

[0010] Determining a camera vector in the sampling camera, and in response to movement of the sampling camera, determining updated three-dimensional coordinates after movement using the camera vector and the three-dimensional coordinates of the sampling camera before movement;

[0011] The texture is sampled according to the updated three-dimensional coordinates and rendered to the screen to obtain a dynamic three-dimensional perspective effect.

[0012] Furthermore, in response to the movement of the sampling camera, determining updated three-dimensional coordinates after the movement using the camera vector and the three-dimensional coordinates before the movement of the sampling camera includes:

[0013] In response to the sampled camera movement, determining a camera vector updated after the movement in the three-dimensional coordinates;

[0014] Calculating a difference between the updated camera vector and the three-dimensional coordinates to obtain preliminary three-dimensional coordinates;

[0015] The preliminary three-dimensional coordinates are rotated to obtain the updated three-dimensional coordinates.

[0016] Furthermore, the rotating the prepared three-dimensional coordinates to obtain the updated three-dimensional coordinates includes:

[0017] Putting the prepared three-dimensional coordinates into a preset rotation function;

[0018] Setting the rotation axis, rotation angle and rotated coordinate point of the preliminary three-dimensional coordinates in the rotation function;

[0019] Rotating the preliminary three-dimensional coordinates according to the settings of the rotation function to obtain an offset of the preliminary three-dimensional coordinates after rotation;

[0020] The offset and the prepared three-dimensional coordinates before rotation are summed to obtain the updated three-dimensional coordinates.

[0021] Furthermore, sampling the map according to the updated three-dimensional coordinates includes:

[0022] In response to the sampled camera movement, determining the updated camera vector after the sampled camera movement;

[0023] Determining a dynamic perspective relationship of the texture in the patch model using the updated camera vector after the movement;

[0024] Based on the dynamic perspective relationship, the map is sampled again.

[0025] Furthermore, combining the first dimension with the two-dimensional coordinates to obtain the three-dimensional coordinates of the patch model includes:

[0026] performing normalization processing on the first dimension;

[0027] determining a second dimension and a third dimension of the two-dimensional coordinate;

[0028] The first dimension, the second dimension and the third dimension are used as the current three-dimensional coordinates of the patch model.

[0029] Furthermore, determining a camera vector in the sampling camera includes:

[0030] Moving the sampling camera so that the camera vector of the sampling camera is located in the tangent space of the patch model;

[0031] The camera vector is normalized.

[0032] Furthermore, the storing of the pre-constructed three-dimensional scene as a texture in the patch model by using a preset sampling camera includes:

[0033] In the three-dimensional scene, each frame is captured using a sampling camera rendered to a texture, and the capture is triggered when the sampling camera moves;

[0034] Based on the shooting of the three-dimensional scene, a texture in the patch model is formed.

[0035] Furthermore, forming the texture in the patch model based on shooting the three-dimensional scene includes:

[0036] Based on the shooting of the sampling camera in the three-dimensional scene, six images are respectively taken from the front, rear, top, bottom, left and right sides of the sampling camera;

[0037] All of the images are used as textures in the patch model.

[0038] Furthermore, pre-constructing the three-dimensional scene includes:

[0039] At least one of a closed indoor scene, an open outdoor scene, a plane sunken scene, and a plane convex scene is pre-constructed and used as the three-dimensional scene.

[0040] Furthermore, the mobile sampling camera includes:

[0041] determining an observation angle for observation in the three-dimensional space;

[0042] The movement of the observation angle is regarded as the movement of the sampling camera.

[0043] Based on the same inventive concept, the present application also provides a device for simulating the visual effects of a three-dimensional scene, comprising: a pre-processing module, a static perspective module, a dynamic perspective module and a sampling rendering module;

[0044] The pre-processing module is configured to determine two-dimensional coordinates in a preset patch model, and store the pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera according to the two-dimensional coordinates;

[0045] The static perspective module is configured to set a first dimension perpendicular to the two-dimensional coordinate in the patch model, and combine the first dimension with the two-dimensional coordinate to obtain the three-dimensional coordinate of the patch model;

[0046] The dynamic perspective module is configured to determine a camera vector in the sampling camera, and in response to movement of the sampling camera, determine updated three-dimensional coordinates after movement using the camera vector and the three-dimensional coordinates of the sampling camera before movement;

[0047] The sampling and rendering module is configured to sample the map according to the updated three-dimensional coordinates and render it to the screen to obtain a dynamic three-dimensional perspective effect.

[0048] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the program, the method for simulating the visual effect of a three-dimensional scene as described in any one of the above items is implemented.

[0049] Based on the same inventive concept, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method of simulating three-dimensional scene visual effects as described above.

[0050] From the above, it can be seen that the method, device and electronic device for simulating the visual effects of three-dimensional scenes provided by the present application construct virtual three-dimensional coordinates based on the two-dimensional coordinates in the patch model, and comprehensively consider the dynamic perspective relationship between the two-dimensional mapping and the virtual three-dimensional coordinates in the patch model. On the basis of the two-dimensional mapping, the three-dimensional coordinates are switched in real time by changing the camera vector in the corresponding sampling camera, thereby establishing a dynamic relationship between the two-dimensional mapping and the three-dimensional perspective, realizing the operation of two-dimensional images in a way that takes up little memory, and having a three-dimensional perspective effect, thereby improving operation efficiency and enhancing visual effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in this application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are merely embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0052] Figure 1 A flowchart of a method for simulating a three-dimensional scene visual effect according to an embodiment of the present application;

[0053] Figure 2A schematic diagram of a device module for simulating a three-dimensional scene visual effect according to an embodiment of the present application;

[0054] Figure 3 A flowchart of determining updated three-dimensional coordinates according to an embodiment of the present application;

[0055] Figure 4 The embodiment of the present application provides a flowchart for rotating three-dimensional coordinates;

[0056] Figure 5 Flowchart of dynamic sampling in an embodiment of the present application;

[0057] Figure 6 Effect comparison diagram of the embodiment of the present application;

[0058] Figure 7 Schematic diagram of the electronic device structure according to an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to make the objectives, technical solutions and advantages of this application more clear, this application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0060] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0061] As described in the background technology section, the related methods for simulating the visual effects of three-dimensional scenes are still unable to meet the needs of rendering the scenes in the actual modeling process.

[0062] In the process of implementing this application, the applicant discovered that the main problem with the related methods of simulating three-dimensional scene visual effects is that in the related scene rendering technology, for some specific scenes, the rendering method is often difficult to strike a balance between effect and memory consumption.

[0063] These specific scenes are mostly scenes that do not need to be entered or used in the three-dimensional scene, but are indispensable. For example, in the game scene, there are interior scenes of street shops, interior scenes of office buildings, interior scenes of spaceship cabins, etc. In the created three-dimensional game scene, these areas are often inaccessible to players, but at the same time, these scenes play a very important role in the effect experience and the overall expression of the game scene.

[0064] The applicant found that for these specific scenes, there are mainly two relevant rendering methods:

[0065] One way is to place a two-dimensional plane picture of the scene image at the scene. Although this method takes up little memory and saves resources, since the placed image is two-dimensional, it does not have a three-dimensional dynamic perspective effect. Therefore, except for observing at a specific angle and a specific position, the visual effect is not realistic enough when observed at any other angle or position, which greatly affects the expression and experience of the overall scene.

[0066] Another way is to build 3D scenes for scenes that do not need to be entered. Although this method has the best visual effect, the same 3D rendering is required for scenes that do not need to be entered, which often leads to huge pressure on runtime memory consumption.

[0067] Furthermore, the applicant also found in the research that in an actually constructed three-dimensional scene, such as a three-dimensional game scene, the change in the player's perspective in the three-dimensional scene is the change in the sampling camera in the three-dimensional scene. That is to say, in order to obtain a realistic three-dimensional visual effect, the camera vector of the sampling camera needs to be placed in the three-dimensional environment. In addition to actually constructing the three-dimensional scene, the three-dimensional environment can also be achieved by creating a virtual three-dimensional coordinate in a two-dimensional patch model. In addition, when the sampling camera is constantly moving, a dynamic three-dimensional visual effect can be achieved by continuously calculating new virtual three-dimensional coordinates.

[0068] The technical method of the present application is described in detail below through specific embodiments.

[0069] refer to Figure 1 A method for simulating a three-dimensional scene visual effect according to an embodiment of the present application includes the following steps:

[0070] Step S101 : determining two-dimensional coordinates in a preset patch model, and storing the pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera according to the two-dimensional coordinates.

[0071] In this step, the constructed three-dimensional scene is converted into a two-dimensional image.

[0072] Specifically, first, a three-dimensional scene is constructed. In this embodiment, the constructed three-dimensional scene can be a closed scene inside a building, or a non-closed scene outdoors, or a scene such as a pit on flat ground.

[0073] In this embodiment, there is no limitation on the specific tool for building the three-dimensional scene, and any three-dimensional software or other virtual engine can be used.

[0074] Furthermore, a sampling camera pre-installed in the three-dimensional software or other virtual engines is placed in the above-constructed three-dimensional scene, and images of the three-dimensional scene in various directions are collected.

[0075] Furthermore, a patch model is created in the above-mentioned three-dimensional software or virtual engine.

[0076] Furthermore, based on the created patch model, two-dimensional coordinates may be set in the model, where the two-dimensional coordinates include two dimensions.

[0077] In this embodiment, the two-dimensional coordinate is expressed as UV, where U and V each represent a dimension of the two-dimensional coordinate.

[0078] Furthermore, through the above-mentioned image acquisition operation, a two-dimensional image at each viewing angle in the three-dimensional scene can be obtained. In some other embodiments, two-dimensional images can be acquired only at required viewing angles.

[0079] Furthermore, each of the two-dimensional images collected above is rendered into the aforementioned constructed patch model, that is, in the patch model, each of the two-dimensional images is rendered as a texture in a patch.

[0080] Based on the two-dimensional coordinates set above, it can be determined that the texture in the patch model is also located in the two-dimensional coordinate UV.

[0081] It should be noted that, in some other embodiments, only a portion of the two-dimensional image may be selected from the acquired two-dimensional image and rendered as a texture in a patch.

[0082] Step S102: setting a first dimension perpendicular to the two-dimensional coordinates in the mesh model, and combining the first dimension with the two-dimensional coordinates to obtain the three-dimensional coordinates of the mesh model.

[0083] In this step, first, based on the aforementioned two-dimensional patch model, another dimension needs to be introduced to make the patches therein become virtual three-dimensional patches.

[0084] In this embodiment, the introduced dimension is defined as the first dimension and is represented by dimension W.

[0085] Furthermore, by adding the introduced first dimension to the two dimensions of the patch model, a virtual three-dimensional coordinate can be obtained in the patch model.

[0086] Step S103 : determining a camera vector in the sampling camera, and in response to movement of the sampling camera, determining updated three-dimensional coordinates after movement using the camera vector and the three-dimensional coordinates of the sampling camera before movement.

[0087] In this step, first, the camera vector of the sampling camera needs to be determined. The camera vector in this embodiment can be regarded as the direction from the pixel to the camera, and can change with the change of the camera perspective. Among them, when the three-dimensional scene of this embodiment is used in a game scene, the camera perspective in this embodiment can be regarded as the player's perspective, that is, the change of the camera vector can be regarded as a change in the player's perspective.

[0088] Furthermore, based on the virtual three-dimensional space obtained in the patch model, it is represented by virtual three-dimensional coordinates. In this embodiment, the virtual three-dimensional coordinates are UVW.

[0089] It can be determined that the camera vector can be regarded as a three-dimensional vector in the three-dimensional coordinate. When the camera vector, that is, the player's perspective changes due to displacement, it can be used as a three-dimensional vector to calculate another three-dimensional coordinate using the changed updated camera vector and the aforementioned three-dimensional coordinate. In this embodiment, the above-calculated other three-dimensional coordinate is defined as a preliminary three-dimensional coordinate.

[0090] In this embodiment, since the prepared three-dimensional coordinates are obtained based on the change of the camera vector, based on the current position after movement, the prepared three-dimensional coordinates and the two-dimensional map have a dynamic perspective relationship in the virtual three-dimensional space. This dynamic perspective relationship can also be regarded as a mapping relationship between the two-dimensional map in the virtual three-dimensional space.

[0091] In a specific example, the above mapping relationship can be specifically expressed as a mapping relationship between the two-dimensional coordinate UV and the virtual three-dimensional coordinate UVW.

[0092] Furthermore, the above-mentioned prepared three-dimensional coordinates are not sufficient for use in mesh models.

[0093] Specifically, the texture saved in the patch model is multi-angle information about the three-dimensional scene. In this embodiment, the texture is 720-degree panoramic information of the closed indoor three-dimensional scene. However, when using the texture on the patch model, only half of the pixels can be used, which is not enough to make full use of the texture.

[0094] In order to fully utilize all pixel resources of the texture in the patch model, the prepared three-dimensional coordinates can be rotated in the patch model. Through the rotation operation, the pixels in every direction of the texture can be fully utilized.

[0095] Here, a rotation function built into the three-dimensional software or virtual engine may be used to rotate the prepared three-dimensional coordinates.

[0096] Furthermore, after rotating the prepared three-dimensional coordinates, updated three-dimensional coordinates can be obtained.

[0097] Step S104: sampling the texture according to the updated three-dimensional coordinates and rendering it to the screen to obtain a dynamic three-dimensional perspective effect.

[0098] In this step, based on the updated three-dimensional coordinates determined above, it can be seen that based on the change of the camera vector, after each movement, the patch model can establish a new preliminary three-dimensional coordinate in the above manner, and by rotating the new preliminary three-dimensional coordinate, obtain an updated three-dimensional coordinate corresponding to the sampling camera movement this time.

[0099] In this embodiment, the updated camera vector after each sampling camera movement and the updated three-dimensional coordinates obtained therefrom can be used as a set of dynamic relationships. Based on this dynamic relationship, the texture in the patch model can be dynamically sampled according to the movement of the sampling camera.

[0100] Furthermore, the sampling result is rendered to the screen.

[0101] Specifically, based on the three-dimensional dynamic perspective relationship of the two-dimensional texture in the patch model described above, after each sampling camera or player perspective movement, the three-dimensional perspective effect of the texture can be obtained on the screen, instead of obtaining the three-dimensional perspective effect by running the actually created three-dimensional scene.

[0102] It can be seen that the three-dimensional perspective effect obtained by the method of this embodiment not only does not require running the actually created three-dimensional scene, but is based only on the two-dimensional map. The perspective effect of the two-dimensional map in the three-dimensional scene is obtained by establishing virtual three-dimensional coordinates in the patch model, making the perspective effect realistic and effectively reducing the memory consumption of running the actual three-dimensional scene.

[0103] like Figure 3 As shown, in another embodiment of the present application, in response to the movement of the sampling camera, determining the updated three-dimensional coordinates after the movement using the camera vector and the three-dimensional coordinates before the movement of the sampling camera includes the following steps:

[0104] Step S301: In response to the sampled camera movement, determine an updated camera vector after the movement in the three-dimensional coordinates.

[0105] In this embodiment, based on the sampling camera used in the patch model in the aforementioned embodiment, when the sampling camera moves on the three-dimensional coordinates in the virtual three-dimensional space, its camera vector will change along with the movement of the sampling camera.

[0106] Furthermore, based on the change of the camera vector and the setting that the camera vector is a three-dimensional vector, a new three-dimensional vector after the movement, that is, an updated camera vector, can be determined on the three-dimensional coordinates.

[0107] Step S302: Calculate the difference between the updated camera vector and the three-dimensional coordinates to obtain preliminary three-dimensional coordinates.

[0108] In this step, the difference between the updated camera vector and the original three-dimensional coordinates before the sampling camera moves is calculated, and the obtained difference is used as the preliminary three-dimensional coordinate. In some embodiments, the absolute value of the difference can also be taken and used as the preliminary three-dimensional coordinate.

[0109] In a specific example, as mentioned above, the sampling camera can also be regarded as the player's perspective in a three-dimensional game scene. That is, based on the change of the player's perspective, an updated camera vector after the player's perspective changes can be obtained.

[0110] Furthermore, based on the updated camera vector, preliminary three-dimensional coordinates regarding the changed player perspective may be determined.

[0111] Step S303: Rotate the prepared three-dimensional coordinates to obtain the updated three-dimensional coordinates.

[0112] In this embodiment, if Figure 4 As shown, rotating the prepared three-dimensional coordinates to obtain the updated three-dimensional coordinates includes the following steps:

[0113] Step S401: Place the prepared three-dimensional coordinates into a preset rotation function.

[0114] As described in the above embodiment, the prepared three-dimensional coordinates obtained above are not sufficient for use in sampling, and they need to be rotated to obtain updated three-dimensional coordinates for sampling.

[0115] Specifically, the prepared three-dimensional coordinates calculated above are placed into a preset rotation function.

[0116] The rotation function may be pre-packaged in three-dimensional software or other virtual engines.

[0117] Step S402: setting the rotation axis, rotation angle, and rotated coordinate point of the preliminary three-dimensional coordinates in the rotation function.

[0118] In this step, for the pre-packaged rotation function, it is necessary to set its relevant parameters.

[0119] Specifically, in this embodiment, the rotation axis, the rotation angle, and the rotated coordinate point are used as specific examples of parameter settings, and the above three parameters are input into the rotation function to control the rotation of the preliminary three-dimensional coordinates.

[0120] Among them, the rotation axis represents the axis around which the prepared three-dimensional coordinate rotates; the rotation angle represents the amplitude of rotation around the rotation axis required to rotate the prepared three-dimensional coordinate; and the rotated coordinate point represents the coordinate of the point where no relative displacement occurs during the rotation of the prepared three-dimensional coordinate.

[0121] Step S403: Rotate the preliminary three-dimensional coordinates according to the setting of the rotation function to obtain the offset of the rotated preliminary three-dimensional coordinates.

[0122] In this step, based on the above-mentioned rotation process, after the process is completed, the offset of the preliminary three-dimensional coordinate after rotation can be obtained from the result of the rotation function.

[0123] Step S404: sum the offset and the preliminary three-dimensional coordinates before rotation to obtain the updated three-dimensional coordinates.

[0124] In this step, the updated three-dimensional coordinates can be obtained by adding the prepared three-dimensional coordinates before rotation to the obtained offset.

[0125] In another embodiment of the present application, Figure 5 As shown, sampling the map according to the updated three-dimensional coordinates includes the following steps:

[0126] Step S501: In response to the sampled camera movement, determine the updated camera vector after the sampled camera movement.

[0127] In this embodiment, according to the method of generating updated three-dimensional coordinates in the above embodiment, dynamic sampling of the map can be achieved based on the dynamic perspective relationship determined in the above embodiment.

[0128] Specifically, each time the sampling camera positioned in the updated three-dimensional coordinates moves, an updated camera vector after the movement may be generated.

[0129] Step S502: Determine the dynamic perspective relationship of the texture in the patch model using the updated camera vector after movement.

[0130] In this step, based on the updated camera vector after the movement, the preliminary three-dimensional coordinates for the movement can be determined.

[0131] Furthermore, after performing a rotation function on the prepared three-dimensional coordinates of the movement, updated three-dimensional coordinates of the movement can be generated.

[0132] Furthermore, in the updated three-dimensional coordinates related to the movement, the dynamic transmission relationship of the two-dimensional map in the patch model during the movement can be determined.

[0133] Step S5003: based on the dynamic perspective relationship, sample the map again.

[0134] In this step, sampling of the movement is performed according to the above-mentioned dynamic perspective relationship.

[0135] It can be seen that the dynamic perspective relationship is based on the movement of the sampling camera. Through the dynamic perspective relationship, the movement of the sampling camera and the sampling operation are dynamically combined.

[0136] In one embodiment of the present application, combining the first dimension with the two-dimensional coordinates to obtain the three-dimensional coordinates of the patch model includes:

[0137] performing normalization processing on the first dimension;

[0138] determining a second dimension and a third dimension of the two-dimensional coordinate;

[0139] The first dimension, the second dimension and the third dimension are used as the current three-dimensional coordinates of the patch model.

[0140] In this embodiment, the native two-dimensional coordinates of the patch model in the above embodiment are defined as the second dimension and the third dimension respectively.

[0141] On the basis of the two-dimensional coordinates, another dimension is introduced as the first dimension, and the introduced first dimension is normalized so that the three dimensions can maintain consistency in the mapping relationship.

[0142] In this embodiment, the introduced first dimension is not specifically limited, and the dimension W may be any dimension except the second dimension and the third dimension in the two-dimensional coordinate.

[0143] Furthermore, for any dimension in the second-dimensional two-dimensional coordinate, the third dimension can be another dimension. In this embodiment, if the second dimension is defined as U, the third dimension is V; if the second dimension is defined as V, the third dimension is U.

[0144] Furthermore, the above-mentioned first dimension is added to the two-dimensional coordinates to form a three-dimensional vector space together with the second dimension and the third dimension, that is, the virtual three-dimensional space in the aforementioned embodiment.

[0145] In one embodiment of the present application, determining a camera vector in the sampling camera includes:

[0146] Moving the sampling camera so that the camera vector of the sampling camera is located in the tangent space of the patch model;

[0147] The camera vector is normalized.

[0148] In this embodiment, it is necessary to determine the camera vector of the sampling camera so that the camera vector can be applicable to the patch model in the aforementioned embodiment.

[0149] Specifically, the implementation object of this method is a patch in a patch model, but in some other embodiments, the implementation object can also be a cube in a cube model, etc. In order to ensure the scalability of the camera vector in the calculation, it can be used not only in the patch model, but also in other models such as the cube model. The sampling camera placed in the patch model can be rotated so that the camera vector of the sampling camera can be located in the tangent space of the patch.

[0150] Furthermore, the rotated camera vector can be normalized so that its size remains between 0 and 1, so as to be suitable for the virtual three-dimensional coordinates in the patch model.

[0151] In one embodiment of the present application, storing the pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera includes:

[0152] In the three-dimensional scene, each frame is captured using a sampling camera rendered to a texture, and the capture is triggered when the sampling camera moves;

[0153] Based on the shooting of the three-dimensional scene, a texture in the patch model is formed.

[0154] In this embodiment, the sampling camera in the 3D software or virtual engine needs to be reasonably set so that it can capture images in the 3D scene as required and render them into a mesh model.

[0155] Specifically, first, a sampling camera is placed in a pre-built 3D scene.

[0156] In this embodiment, a closed indoor scene is taken as a specific example. When building a specific three-dimensional scene, for a closed indoor scene, objects in the scene can be placed as close to the wall as possible to reduce visual distortion in the visual effect.

[0157] Furthermore, in this embodiment, the sampling camera can be placed at the center of the three-dimensional scene to adapt to the sampling environment of a closed indoor scene. In some other embodiments, the sampling camera can also be placed in other positions. For example, in an open scene, if the environment near the ground is more important, the sampling camera can be placed on the ground.

[0158] Furthermore, in the 3D software or virtual engine, the sampling camera is configured to render to a texture.

[0159] Specifically, this configuration can be used as a process of assigning a rendering target to a sampling camera. When the rendering target is a patch in a patch model, it can be considered that the sampling camera is bound to the patch.

[0160] Based on this, the sampling of the sampling camera in the three-dimensional scene can be rendered into the patch model.

[0161] Furthermore, it is necessary to configure conditions for triggering a shooting operation for the sampling camera, that is, conditions for triggering the sampling camera to sample the three-dimensional scene.

[0162] Specifically, in order to ensure that the texture rendered into the patch can be updated in real time, the shooting or sampling interval of the sampling camera can be set to shoot every frame. On this basis, the sampling camera can also be set to shoot when displacement occurs.

[0163] Furthermore, based on the above settings of the sampling camera, the shooting of the sampling camera can be automatically controlled by three-dimensional software or a virtual engine.

[0164] Furthermore, during the acquisition process, the resolution can be set according to specific accuracy requirements.

[0165] Specifically, when the accuracy requirement is higher, the resolution of rendering to the texture can be set to be larger. When the resolution is larger, not only will the resulting mapping effect be finer, but the rendering process will also occupy more memory. Therefore, it is necessary to make a trade-off based on the actual memory situation.

[0166] Furthermore, the configured sampling camera is used to sample and shoot the three-dimensional scene.

[0167] In one embodiment of the present application, forming a texture in the patch model based on photographing the three-dimensional scene includes:

[0168] Based on the shooting of the sampling camera in the three-dimensional scene, six images are respectively taken from the front, rear, top, bottom, left and right sides of the sampling camera;

[0169] All of the images are used as textures in the patch model.

[0170] In this embodiment, based on the closed indoor scene of the aforementioned embodiment and based on the above-mentioned setting of the sampling camera, images are collected in the six wall directions in the three-dimensional scene of this embodiment, that is, 720-degree image collection is performed.

[0171] Specifically, in this three-dimensional scene, when the sampling camera is facing any wall direction, it is necessary to capture the current front, back, top, bottom, left and right directions respectively, and obtain 6 images in each direction.

[0172] Furthermore, all six images are connected according to a certain rule, and after being connected into one image, they are put into the patch model and stored as a texture in the face-edge model.

[0173] The six images may be connected horizontally or vertically, and the connection method is not specifically limited in this embodiment.

[0174] It can be seen that the method for simulating the visual effect of a three-dimensional scene in the embodiment of the present application constructs virtual three-dimensional coordinates based on the two-dimensional coordinates in the patch model, and comprehensively considers the dynamic perspective relationship between the two-dimensional mapping in the patch model and the virtual three-dimensional coordinates. On the basis of the two-dimensional mapping, the three-dimensional coordinates are switched in real time by changing the camera vector in the corresponding sampling camera, thereby establishing a dynamic relationship between the two-dimensional mapping and the three-dimensional perspective, realizing the operation of two-dimensional images in a way that takes up little memory, and having a three-dimensional perspective effect, thereby improving operation efficiency and enhancing visual effects.

[0175] Furthermore, the method for simulating the three-dimensional scene visual effect of any of the above embodiments of the present application may have the following specific examples: Figure 6 The visual effect shown.

[0176] Specifically, Figure 6 The view on the left shows the constructed three-dimensional scene, and the view on the right shows the perspective effect obtained on a two-dimensional surface.

[0177] It can be seen that when the visual effect of the three-dimensional scene is compared with the visual effect of the two-dimensional patch, the two-dimensional patch on the right has a perspective effect that is extremely similar to that on the left.

[0178] Specifically, when the viewing angle is in the middle position, the perspective effect of the three-dimensional scene on the left appears to be contracted toward the far end of the left wall, while the perspective effect of the two-dimensional surface on the right appears to be contracted toward the far end of the right wall. The three-dimensional scene and the two-dimensional surface each maintain the correct perspective effect. It can be seen that the visual effect of the two-dimensional surface on the right is not consistent with the three-dimensional scene on the left, but based on the position of the viewing angle, it presents a symmetrical effect with the three-dimensional scene in the perspective relationship. In other words, the perspective effect of the two-dimensional surface will not be distorted due to the movement of the viewing angle, and the correct perspective effect can always be maintained.

[0179] In actual operation, the memory and computing power required for rendering two-dimensional patches are obviously less than those for rendering three-dimensional scenes. Therefore, the method of simulating the visual effect of three-dimensional scenes in the embodiment of the present application can make two-dimensional patches appear as Figure 6 On the basis of the correct perspective effect shown, the operating pressure is effectively reduced, or in other words, the operating efficiency is improved.

[0180] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied in a distributed scenario and completed by multiple devices working together. In the case of such a distributed scenario, one of the multiple devices may only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the method described.

[0181] It should be noted that the above description is limited to some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0182] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, an embodiment of the present application further provides a device for simulating the visual effects of a three-dimensional scene.

[0183] refer to Figure 2 The device for simulating the visual effect of a three-dimensional scene includes: a pre-processing module 201, a static perspective module 202, a dynamic perspective module 203 and a sampling rendering module 204;

[0184] The pre-processing module 201 is configured to determine two-dimensional coordinates in a preset patch model, and store the pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera according to the two-dimensional coordinates.

[0185] The static perspective module 202 is configured to set a first dimension perpendicular to the two-dimensional coordinates in the patch model, and combine the first dimension with the two-dimensional coordinates to obtain the three-dimensional coordinates of the patch model.

[0186] The dynamic perspective module 203 is configured to determine a camera vector in the sampling camera, and in response to movement of the sampling camera, determine updated three-dimensional coordinates after movement using the camera vector and the three-dimensional coordinates of the sampling camera before movement.

[0187] The sampling and rendering module 204 is configured to sample the texture according to the updated three-dimensional coordinates and render it to the screen to obtain a dynamic three-dimensional perspective effect.

[0188] As an optional embodiment, the pre-processing module 201 is specifically configured to pre-construct at least one of a closed indoor scene, an open outdoor scene, a planar concave scene, and a planar convex scene as the three-dimensional scene.

[0189] In the three-dimensional scene, each frame is captured using a sampling camera rendered to a texture, and the capture is triggered when the sampling camera moves;

[0190] Based on the shooting of the three-dimensional scene, a texture in the patch model is formed.

[0191] Specifically, based on the shooting of the sampling camera in the three-dimensional scene, six images are taken from the front, rear, top, bottom, left and right of the sampling camera respectively;

[0192] All of the images are used as textures in the patch model.

[0193] As an optional embodiment, the static perspective module 202 is specifically configured to perform normalization processing on the first dimension;

[0194] determining a second dimension and a third dimension of the two-dimensional coordinate;

[0195] The first dimension, the second dimension and the third dimension are used as the current three-dimensional coordinates of the patch model.

[0196] As an optional embodiment, the dynamic perspective module 203 is specifically configured to determine an observation angle for observation in the three-dimensional space;

[0197] The movement of the observation angle is regarded as the movement of the sampling camera.

[0198] Moving the sampling camera so that the camera vector of the sampling camera is located in the tangent space of the patch model;

[0199] The camera vector is normalized.

[0200] In response to the sampled camera movement, determining a camera vector updated after the movement in the three-dimensional coordinates;

[0201] Calculating a difference between the updated camera vector and the three-dimensional coordinates to obtain preliminary three-dimensional coordinates;

[0202] The preliminary three-dimensional coordinates are rotated to obtain the updated three-dimensional coordinates.

[0203] Furthermore, rotating the preliminary three-dimensional coordinates to obtain the updated three-dimensional coordinates includes:

[0204] Putting the prepared three-dimensional coordinates into a preset rotation function;

[0205] Setting the rotation axis, rotation angle and rotated coordinate point of the preliminary three-dimensional coordinates in the rotation function;

[0206] Rotating the preliminary three-dimensional coordinates according to the settings of the rotation function to obtain an offset of the preliminary three-dimensional coordinates after rotation;

[0207] The offset and the prepared three-dimensional coordinates before rotation are summed to obtain the updated three-dimensional coordinates.

[0208] As an optional embodiment, the sampling rendering module 204 is specifically configured to, in response to the sampling camera movement, determine the updated camera vector after the sampling camera moves;

[0209] Determining a dynamic perspective relationship of the texture in the patch model using the updated camera vector after the movement;

[0210] Based on the dynamic perspective relationship, the map is sampled again.

[0211] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0212] The device of the above embodiment is used to implement the corresponding method of simulating three-dimensional scene visual effects in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0213] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, an embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the program, the method for simulating the visual effect of a three-dimensional scene as described in any of the above embodiments is implemented.

[0214] Figure 7 10 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.

[0215] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.

[0216] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of the present application are implemented through software or firmware, the relevant program codes are stored in the memory 1020 and called and executed by the processor 1010.

[0217] The input / output interface 1030 is used to connect an input / output module to implement information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.

[0218] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WiFi, Bluetooth, etc.).

[0219] The bus 1050 comprises a path for transmitting information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).

[0220] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of the present application, and does not necessarily include all the components shown in the figure.

[0221] The device of the above embodiment is used to implement the corresponding method of simulating three-dimensional scene visual effects in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0222] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the method of simulating three-dimensional scene visual effects as described in any of the above embodiments.

[0223] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0224] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method of simulating three-dimensional scene visual effects as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0225] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0226] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the drawings provided. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the following fact, that is, the details of the implementation of these block diagram devices are highly dependent on the platform of the embodiment to be implemented in the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). When specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.

[0227] Although the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may utilize the embodiments discussed.

[0228] The embodiments of the present application are intended to encompass all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.

Claims

1. A method for simulating a three-dimensional scene visual effect, characterized in that: include: Determining two-dimensional coordinates in a preset patch model, and storing the pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera according to the two-dimensional coordinates; Setting a first dimension perpendicular to the two-dimensional coordinates in the patch model, and combining the first dimension with the two-dimensional coordinates to obtain three-dimensional coordinates of the patch model; Determining a camera vector in the sampling camera, and in response to movement of the sampling camera, determining updated three-dimensional coordinates after movement using the camera vector and the three-dimensional coordinates of the sampling camera before movement; Sampling the texture according to the updated three-dimensional coordinates and rendering it to the screen to obtain a dynamic three-dimensional perspective effect; In response to the movement of the sampling camera, determining updated three-dimensional coordinates after the movement using the camera vector and the three-dimensional coordinates before the movement of the sampling camera includes: In response to the sampled camera movement, determining a camera vector updated after the movement in the three-dimensional coordinates; Calculating a difference between the updated camera vector and the three-dimensional coordinates to obtain preliminary three-dimensional coordinates; The preliminary three-dimensional coordinates are rotated to obtain the updated three-dimensional coordinates.

2. The method according to claim 1, characterized in that The rotating the prepared three-dimensional coordinates to obtain the updated three-dimensional coordinates includes: Putting the prepared three-dimensional coordinates into a preset rotation function; Setting the rotation axis, rotation angle and rotated coordinate point of the preliminary three-dimensional coordinates in the rotation function; Rotating the preliminary three-dimensional coordinates according to the settings of the rotation function to obtain an offset of the preliminary three-dimensional coordinates after rotation; The offset and the prepared three-dimensional coordinates before rotation are summed to obtain the updated three-dimensional coordinates.

3. The method according to any one of claims 1 to 2, characterized in that The sampling of the map according to the updated three-dimensional coordinates includes: In response to the sampled camera movement, determining the updated camera vector after the sampled camera movement; Determining a dynamic perspective relationship of the texture in the patch model using the updated camera vector after the movement; Based on the dynamic perspective relationship, the map is sampled again.

4. The method according to claim 1, wherein Combining the first dimension with the two-dimensional coordinates to obtain the three-dimensional coordinates of the patch model includes: performing normalization processing on the first dimension; determining a second dimension and a third dimension of the two-dimensional coordinate; The first dimension, the second dimension and the third dimension are used as the current three-dimensional coordinates of the patch model.

5. The method according to claim 1, wherein The determining of a camera vector in the sampling camera comprises: Moving the sampling camera so that the camera vector of the sampling camera is located in the tangent space of the patch model; The camera vector is normalized.

6. The method according to claim 1, characterized in that The step of storing the pre-constructed three-dimensional scene as a texture in the patch model by using a preset sampling camera includes: In the three-dimensional scene, each frame is captured using a sampling camera rendered to a texture, and the capture is triggered when the sampling camera moves; Based on the shooting of the three-dimensional scene, a texture in the patch model is formed.

7. The method according to claim 6, characterized in that The forming of the texture in the patch model based on the shooting of the three-dimensional scene includes: Based on the shooting of the sampling camera in the three-dimensional scene, six images are obtained in front, behind, above, below, left and right of the sampling camera; All of the images are used as textures in the patch model.

8. The method according to claim 1, characterized in that Pre-building the three-dimensional scene, including: At least one of a closed indoor scene, an open outdoor scene, a plane sunken scene, and a plane convex scene is pre-constructed and used as the three-dimensional scene.

9. The method according to claim 5, characterized in that The mobile sampling camera comprises: Determining an observation angle for observing the three-dimensional scene; The movement of the observation angle is regarded as the movement of the sampling camera.

10. A device for simulating a three-dimensional scene visual effect, comprising: Preprocessing module, static perspective module, dynamic perspective module and sampling rendering module; The pre-processing module is configured to determine two-dimensional coordinates in a preset patch model, and store the pre-constructed three-dimensional scene as a texture in the patch model using a preset sampling camera according to the two-dimensional coordinates; The static perspective module is configured to set a first dimension perpendicular to the two-dimensional coordinate in the patch model, and combine the first dimension with the two-dimensional coordinate to obtain the three-dimensional coordinate of the patch model; The dynamic perspective module is configured to determine a camera vector in the sampling camera, and in response to movement of the sampling camera, determine updated three-dimensional coordinates after movement using the camera vector and the three-dimensional coordinates of the sampling camera before movement; The sampling and rendering module is configured to sample the texture according to the updated three-dimensional coordinates and render it to the screen to obtain a dynamic three-dimensional perspective effect; In response to the movement of the sampling camera, determining updated three-dimensional coordinates after the movement using the camera vector and the three-dimensional coordinates before the movement of the sampling camera includes: In response to the sampled camera movement, determining a camera vector updated after the movement in the three-dimensional coordinates; Calculating a difference between the updated camera vector and the three-dimensional coordinates to obtain preliminary three-dimensional coordinates; The preliminary three-dimensional coordinates are rotated to obtain the updated three-dimensional coordinates.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.

12. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Image processing method, device and system and storage medium

    CN109658365A

  • Rendering method and device, computer readable storage medium and electronic equipment

    CN112288873A