Virtual scene image processing method, display method, device, and electronic device
By mapping the three-dimensional data of the virtual scene to the two-dimensional space, and using the two-dimensional disturbance map to offset the scene depth and opacity map, the rendering parameters for the target object are generated, which solves the problem of difficulty in creating a real fog effect in the game. Efficient fog effect rendering is achieved.
Patent Information
- Application Number
- CN202111680063.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2041-12-31
AI Technical Summary
In the game, it is difficult to achieve a real fog effect in a scene composed of light-transmitting media, especially when the fog effect is displayed in the interior area.
By maping the 3D data of the virtual scene to the two -dimensional space, the two -dimensional scene data is obtained, and the depth of the two -dimensional scene depth and opaque sticker are used to obtain the fog depth range parameters and refractive effect parameters. The permeable mist effect parameters are generated to generate rendering parameters for target objects.
It achieves the creation of a close-to-real fog effect in the game scene, making the fog effect outside the internal area more realistic, improving the authenticity of the game screen, and improving the image processing efficiency.
Smart Images

Figure CN114288650B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a virtual scene image processing method, a virtual scene image display method, a device, an electronic device, and a computer storage medium. Background Art
[0002] At present, as the types of games continue to increase, gamers pay more and more attention to whether the game can reflect the scene more realistically. For example, for some game scenes containing light-transmitting media, it is necessary to create a fog effect (referred to as fog effect) in the game display screen to increase the authenticity of the game scene.
[0003] Specifically, when a game player walks in an internal area composed of a light-transmitting medium in the game, he may see fog effects outside the area. In this game scene, a fog effect needs to be rendered, and the rendered fog effect can make the internal area fog-free and only have fog effects outside the area. This can ensure that the rendered fog effect is closer to reality. Therefore, how to create a fog effect close to reality in this game scene has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The present application provides a virtual scene image processing method to solve the technical problem of how to create a fog effect close to reality in the game scene. The present application also provides a virtual scene image display method, a virtual scene image processing device, a virtual scene image display device, an electronic device and a computer storage medium.
[0005] The present application provides a virtual scene image processing method, comprising:
[0006] Mapping three-dimensional scene data of a virtual scene in a three-dimensional space to a two-dimensional space corresponding to a display device screen to obtain two-dimensional scene data of the virtual scene in the two-dimensional space;
[0007] Obtaining a two-dimensional disturbance map for a target object in the virtual scene according to the two-dimensional scene data;
[0008] Obtaining a two-dimensional scene depth map for the virtual scene according to the two-dimensional scene data, and performing an offset process on the two-dimensional scene depth map using the two-dimensional disturbance map to obtain a fog depth range parameter for representing a fog depth range in the virtual scene;
[0009] Obtaining a two-dimensional opaque map for the virtual scene according to the two-dimensional scene data, and performing an offset process on the two-dimensional opaque map using the two-dimensional disturbance map to obtain a refraction effect parameter for representing the refraction effect of the target object;
[0010] Obtaining light-transmitting fog effect parameters of the virtual scene;
[0011] Rendering parameters for the target object are obtained according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter.
[0012] Optionally, the two-dimensional disturbance map includes a refraction offset parameter of a first pixel point, and the two-dimensional scene depth map includes coordinates of a second pixel point;
[0013] The using the two-dimensional disturbance map to perform offset processing on the two-dimensional scene depth map to obtain a fog depth range parameter for representing the fog depth range in the virtual scene includes:
[0014] The refraction offset parameter of the first pixel point is used to offset the coordinates of the corresponding second pixel point in the two-dimensional scene depth map to obtain a fog depth range parameter for representing the fog depth range in the virtual scene.
[0015] Optionally, the two-dimensional disturbance map includes a refraction offset parameter of a first pixel point, and the two-dimensional opaque map includes coordinates of a third pixel point;
[0016] The using the two-dimensional disturbance map to perform offset processing on the two-dimensional opaque map to obtain a refraction effect parameter for representing the refraction effect of the target object includes:
[0017] The coordinates of the corresponding third pixel point in the two-dimensional opaque map are offset by using the refraction offset parameter of the first pixel point to obtain a refraction effect parameter for representing the refraction effect of the target object.
[0018] Optionally, obtaining the light-transmitting fog effect parameters of the virtual scene includes:
[0019] Determine the current light position in the virtual scene;
[0020] Based on the light direction, light-transmitting fog effect parameters of the virtual scene are obtained.
[0021] Optionally, determining the current light direction in the virtual scene includes:
[0022] Determine the current light source direction in the virtual scene and the current sight direction of the virtual character in the virtual scene;
[0023] Based on the light source direction and the sight line direction, a current light direction in the virtual scene is determined.
[0024] Optionally, determining the current light direction in the virtual scene based on the light source direction and the sight line direction includes:
[0025] A dot product operation is performed on the parameter used to represent the light source direction and the parameter used to represent the sight line direction to determine the current light direction in the virtual scene.
[0026] Optionally, obtaining the light-transmitting fog effect parameters of the virtual scene based on the light direction includes:
[0027] Determine a light color parameter for representing a current light color and a fog color parameter for representing a fog color in a virtual scene;
[0028] The light direction parameter used to represent the light direction is used as a weight, and the light color parameter and the fog color parameter are mixed to obtain a light-transmitting fog effect parameter of the virtual scene.
[0029] Optionally, the step of taking the light direction parameter used to represent the light direction as a weight, mixing the light color parameter and the fog color parameter, and obtaining the light-transmitting fog effect parameter of the virtual scene includes:
[0030] The light azimuth parameter, the light color parameter and the fog color parameter are processed by a linear interpolation function to obtain the light-transmitting fog effect parameter of the virtual scene.
[0031] Optionally, obtaining rendering parameters for the target object according to the fog depth range parameter, the refraction effect parameter, and the light-transmitting fog effect parameter includes:
[0032] The refraction effect parameter and the light-transmitting fog effect parameter are mixed with the fog depth range parameter as a weight to obtain a rendering parameter for the target object.
[0033] Optionally, the step of taking the fog depth range parameter as a weight, mixing the refraction effect parameter and the light-transmitting fog effect parameter, and obtaining the rendering parameter for the target object includes:
[0034] The fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter are processed using a linear interpolation function to obtain rendering parameters for the target object.
[0035] Optionally, the method is used on a server; the method further includes:
[0036] The rendering parameters for the target object are provided to a user terminal, wherein the user terminal is used to render on a display device screen based on the rendering parameters for the target object.
[0037] Optionally, the method is used at a user end; the method further includes:
[0038] Rendering is performed on a display device screen of the user terminal based on the rendering parameters for the target object.
[0039] The present application provides a virtual scene image display method, comprising:
[0040] Obtaining rendering parameters for the target object; the rendering parameters for the target object are obtained by processing using the above-mentioned virtual scene image processing method;
[0041] Rendering is performed on a display device screen based on the rendering parameters for the target object.
[0042] The present application provides a virtual scene image processing device, comprising:
[0043] A mapping unit, used to map the three-dimensional scene data of the virtual scene in the three-dimensional space to the two-dimensional space corresponding to the screen of the display device, and obtain the two-dimensional scene data of the virtual scene in the two-dimensional space;
[0044] A disturbance map obtaining unit, configured to obtain a two-dimensional disturbance map for a target object in the virtual scene according to the two-dimensional scene data;
[0045] A first offset unit, configured to obtain a two-dimensional scene depth map for the virtual scene according to the two-dimensional scene data, and to perform an offset process on the two-dimensional scene depth map using the two-dimensional disturbance map to obtain a fog depth range parameter for representing a fog depth range in the virtual scene;
[0046] A second offset unit, configured to obtain a two-dimensional opaque map for the virtual scene according to the two-dimensional scene data, and perform an offset process on the two-dimensional opaque map using the two-dimensional disturbance map to obtain a refraction effect parameter for representing a refraction effect of the target object;
[0047] A fog effect parameter obtaining unit, used to obtain light-transmitting fog effect parameters of the virtual scene;
[0048] The rendering parameter obtaining unit is used to obtain the rendering parameters for the target object according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter.
[0049] The present application provides a virtual scene image display device, comprising:
[0050] A rendering parameter obtaining unit, used to obtain rendering parameters for a target object; the rendering parameters for the target object are obtained by using the above-mentioned virtual scene image processing method;
[0051] A rendering unit is used for rendering on a display device screen based on the rendering parameters for the target object.
[0052] The present application provides an electronic device, including:
[0053] processor;
[0054] The memory is used to store a computer program, and the computer program is run by the processor to execute the above-mentioned virtual scene image processing method and virtual scene image display method.
[0055] The present application provides a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program is run by a processor to execute the above-mentioned virtual scene image processing method and virtual scene image display method.
[0056] Compared with the prior art, this application has the following advantages:
[0057] The present application provides a virtual scene image processing method. The method maps the three-dimensional scene data of the virtual scene in the three-dimensional space to the two-dimensional space corresponding to the display device screen, and obtains the two-dimensional scene data of the virtual scene in the two-dimensional space; and obtains the two-dimensional disturbance map, the two-dimensional scene depth map and the two-dimensional opaque map for the target object in the virtual scene according to the two-dimensional scene data; and uses the two-dimensional disturbance map to offset the two-dimensional scene depth map to obtain the fog depth range parameter for representing the fog depth range in the virtual scene; at the same time, the two-dimensional disturbance map is used to offset the two-dimensional opaque map to obtain the refraction effect parameter for representing the refraction effect of the target object; and the light-transmitting fog effect parameter of the virtual scene is also obtained; finally, according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter, the rendering parameter for the target object is obtained. Since the final rendering parameter is obtained based on the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter, the rendering parameter takes into account the depth, refraction, light transmittance and other factors involved in the virtual scene, and the fog effect rendered based on the rendering parameter is closer to reality. At the same time, since the method processes two-dimensional information, the image processing efficiency is higher. Since the fog depth range parameters, refraction effect parameters and light-transmitting fog effect parameters are obtained during the processing, it is equivalent to having obtained the fog conditions in the virtual scene, and there is no need to calculate the fog effect separately. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 A schematic diagram of the system architecture of the virtual scene image processing method provided in this application;
[0059] Figure 2 A flowchart of a virtual scene image processing method provided in the first embodiment of the present application;
[0060] Figure 3 is a schematic diagram for representing the depth range of fog in a virtual scene;
[0061] Figure 4 is a schematic diagram for representing the refraction effect of a target object;
[0062] Figure 5 is a schematic diagram for representing the current light direction;
[0063] Figure 6 is a schematic diagram of light-transmitting fog effect parameters for representing a virtual scene;
[0064] Figure 7 is a schematic diagram of the target image;
[0065] Figure 8 A flowchart of a virtual scene image display method provided in the second embodiment of the present application;
[0066] Fig. 9 A schematic diagram of a virtual scene image processing device provided in a third embodiment of the present application;
[0067] Fig.10 A schematic diagram of a virtual scene image display device provided in a fourth embodiment of the present application;
[0068] Fig.11 This is a schematic diagram of an electronic device provided in the fifth embodiment of the present application. DETAILED DESCRIPTION
[0069] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0070] The present application provides a virtual scene image processing method, a virtual scene image display method, a device, an electronic device and a computer storage medium, which are described one by one in the following embodiments.
[0071] Taking the underwater game scene as an example of the virtual scene of the present application, in the underwater game scene, the character played by the user player can move in the underwater scene area. In this scene, it is assumed that the user moves back and forth in the glass tunnel on the seabed and looks at the seabed outside the glass tunnel through the glass tunnel. The virtual scene image processing method of the present application is mainly used to provide an image to be displayed for the game interface of the user end. In fact, the displayed image can show the situation where the user looks at the seabed fog effect outside the glass tunnel through the glass tunnel at a certain angle. Of course, it can be understood that the virtual scene of the present application can also be other scenes besides the underwater game scene, such as some scenes in the VR world, or a game scene of a game character in the mountains. The virtual scene of the present application is not specifically limited.
[0072] The virtual scene image processing method provided by the present application actually processes the two-dimensional parameter information in the two-dimensional image, so as to obtain the rendering parameters for the target object, render the target object based on the rendering parameters for the target object, and then obtain the target image. In short, the entire image processing process processes two-dimensional information, so the performance requirements for the processing end that obtains the target image or the processing end that runs the virtual scene image processing method program do not need to be too high. However, the image processing method in the prior art processes the three-dimensional information in the three-dimensional image, and after processing the three-dimensional information, it is rendered based on the processed three-dimensional parameter information. In short, the entire image processing process of the prior art processes three-dimensional information, and the performance requirements for the processing end are high, which may cause the game screen to freeze and make the game users feel poor.
[0073] For ease of understanding, the following combination Figure 1 A description is given of the system architecture of the virtual scene image processing method provided in this application. Figure 1 The system architecture example shown includes: a user terminal 101 and a server terminal 102. In this embodiment, the user terminal 101 can be, but is not limited to, a portable terminal, a mobile phone, a PAD, a personal computer or an electronic device with an image processing function, etc., which is used to run a program containing a virtual scene image processing method. The user terminal 101 and the server terminal 102 are interconnected through a communication network, and the communication network can include a mobile network, a gateway, the Internet, or can be composed of a local area network and the Internet. For example: the user terminal 101 is connected to the server terminal 102 via a mobile network, a gateway, and the Internet. For another example: the user terminal 101 is connected to the server terminal 102 via a local area network and the Internet. The server terminal 102 obtains the rendering parameters for the target object through the fog depth range parameters, the refraction effect parameters and the light-transmitting fog effect parameters. In this embodiment, the fog can be natural fog or artificial smoke.
[0074] After obtaining the rendering parameters, the server 102 may provide the rendering parameters to the client 101 .
[0075] First embodiment
[0076] The first embodiment of the present application provides a virtual scene image processing method. Figure 2 Provide explanation.
[0077] Please refer to Figure 2 , which is a flowchart of the virtual scene image processing method provided in the first embodiment of the present application.
[0078] The virtual scene image processing method of the embodiment of the present application includes the following steps:
[0079] Step S201: Mapping the three-dimensional scene data of the virtual scene in the three-dimensional space to the two-dimensional space corresponding to the display device screen to obtain the two-dimensional scene data of the virtual scene in the two-dimensional space.
[0080] In this embodiment, three-dimensional scene data may refer to pixel coordinates in three-dimensional space, such as the coordinates of an object in the scene (such as a box, a piece of glass) in three-dimensional space. Two-dimensional scene data may refer to pixel coordinates in two-dimensional space corresponding to the display device screen. Such as UV coordinates, the so-called UV coordinates are the coordinates of the image in the horizontal and vertical directions of the display, with values ranging from 0 to 1. For example, the U-th pixel in the horizontal direction of the display device screen represents the horizontal position of the pixel, that is, the horizontal position of the corresponding pixel point. The V-th pixel in the vertical direction of the display device screen represents the vertical position of the pixel, that is, the vertical position of the corresponding pixel point. In this embodiment, the display device screen displays two-dimensional information, but what is seen through this screen is three-dimensional information. Mapping three-dimensional space to two-dimensional space may refer to converting three-dimensional coordinates of pixels into two-dimensional coordinates.
[0081] Step S202: Obtain a two-dimensional disturbance map for a target object in a virtual scene according to the two-dimensional scene data.
[0082] In this embodiment, the target object is a light-transmitting object. The light-transmitting object may be a light-transmitting medium such as glass. In the game scene of an underwater tunnel, it may refer to a glass tunnel. It should be noted that in the game scene of an underwater tunnel, the target object is a light-transmitting object on the seabed. For example, it may be a glass tunnel on the seabed. In this embodiment, the target object is used to divide the virtual scene into two areas, an inner area and an outer area. For example, the underwater glass tunnel can be used to divide the underwater game scene into two areas, an inner area and an outer area.
[0083] In this embodiment, the two-dimensional perturbation map of the target object may refer to the perturbation map corresponding to the glass of the submarine tunnel. Since it is necessary to map the submarine tunnel in the game scene to create the fog effect of the seabed only outside the tunnel, and the inside of the tunnel is not affected by the fog effect, a two-dimensional perturbation map is obtained in advance. The two-dimensional perturbation map can actually be a Perlin noise black and white grayscale map. The perturbation map is the same size as the submarine glass tunnel. The perturbation map records the refraction offset parameters (i.e., brightness values) of each pixel point, and these brightness values are 0 to 1, which can be used as parameters to offset the sampling position of each corresponding pixel point. In this embodiment, the two-dimensional perturbation map is used to directly cover the glass tunnel in the game.
[0084] In this embodiment, as an implementation method of obtaining a two-dimensional disturbance map, it may refer to: first, determining the target object in the virtual scene; then, sampling based on the pixel shader of the target object to obtain the two-dimensional disturbance map. For example, in the display scene of the submarine tunnel in the game, the target object is a glass tunnel. Therefore, the obtained two-dimensional disturbance map is an image covered on the glass of the glass tunnel.
[0085] When sampling is performed based on the pixel shader of the target object, a two-dimensional disturbance map (RefractionMap) can be obtained based on the following method: half refraction Offset = SAMPLE_TEXTURE2D (_RefractionMap, sampler_RefractionMap, input.uv.xy).x, where refraction Offset is a refraction offset parameter.
[0086] Step S203: obtaining a two-dimensional scene depth map for the virtual scene according to the two-dimensional scene data, and performing offset processing on the two-dimensional scene depth map using a two-dimensional disturbance map to obtain a fog depth range parameter for representing the fog depth range in the virtual scene.
[0087] In this embodiment, the two-dimensional scene depth map is used to indicate that although the pixel coordinates in the image are two-dimensional, it can indicate the distance of the pixel from the user.
[0088] Specifically, the two-dimensional disturbance map includes a refraction offset parameter of a first pixel point, and the two-dimensional scene depth map includes coordinates of a second pixel point.
[0089] As a method of using a two-dimensional disturbance map to offset a two-dimensional scene depth map, a fog depth range parameter for representing the fog depth range in a virtual scene is obtained: the refraction offset parameter of a first pixel point is used to offset the coordinates of a corresponding second pixel point in the two-dimensional scene depth map to obtain the fog depth range parameter for representing the fog depth range in the virtual scene.
[0090] Specifically, the fog depth range parameter can be obtained in the following way: half refractedSceneDepth = SAMPLE_DEPTH_TEXTURE_LOD (_CameraDepthTexture, sampler_CameraDepthTexture, screenUV + refractionOffset, 0).
[0091] Step S204: obtaining a two-dimensional opaque map for the virtual scene according to the two-dimensional scene data, and performing an offset process on the two-dimensional opaque map using the two-dimensional disturbance map to obtain a refraction effect parameter for representing the refraction effect of the target object.
[0092] In a game scene, a two-dimensional opaque map may refer to an image in the game scene that retains opaque objects and removes translucent objects (such as glass).
[0093] The two-dimensional disturbance map contains the refraction offset parameter of the first pixel point, and the two-dimensional opacity map contains the coordinates of the third pixel point.
[0094] As a method of using a two-dimensional perturbation map to offset a two-dimensional opaque map, the method of obtaining refraction effect parameters for representing the refraction effect of a target object can be: using the refraction offset parameters of a first pixel point to offset the coordinates of a corresponding third pixel point in the two-dimensional opaque map, to obtain refraction effect parameters for representing the refraction effect of the target object.
[0095] Please refer to Figure 3 and Figure 4 , which are respectively a schematic diagram for representing the depth range of fog in a virtual scene and a schematic diagram for representing the refraction effect of a target object. Figure 3 and Figure 4 Schematic diagram of the depth texture map after disturbance and the camera opacity texture map after disturbance. Figure 3 and Figure 4 It can be seen that the objects outside the submarine glass tunnel are twisted and deformed, and the deformation is caused by disturbance.
[0096] Specifically, the refraction effect parameters can be obtained in the following way: half3 refraction = SAMPLE_TEXTURE2D (_CameraOpaqueTexture, sampler_CameraOpaqueTexture, screenUV + refractionOffset). rgb.
[0097] Step S205: Obtaining light-transmitting fog effect parameters of the virtual scene.
[0098] In this embodiment, the light-transmitting fog effect parameters of the virtual scene can be obtained by: determining the current light direction in the virtual scene; and obtaining the light-transmitting fog effect parameters of the virtual scene based on the light direction.
[0099] Specifically, determining the current light direction in the virtual scene may refer to: determining the current light source direction in the virtual scene and the current sight line direction of the virtual character in the virtual scene; and determining the current light direction in the virtual scene based on the light source direction and the sight line direction.
[0100] Determining the current light direction in the virtual scene based on the light source direction and the sight line direction may refer to: performing a dot product operation on a parameter representing the light source direction and a parameter representing the sight line direction to determine the current light direction in the virtual scene. For example, the current light direction is determined by using half dirFac = saturate(dot(-mainLight.direction, viewDirWS)).
[0101] Obtaining the light-transmitting fog effect parameters of the virtual scene based on the light direction may refer to: determining the light color parameters used to represent the current light color and the fog color parameters used to represent the fog color in the virtual scene; using the light direction parameters used to represent the light direction as weights, mixing the light color parameters and the fog color parameters, and obtaining the light-transmitting fog effect parameters of the virtual scene.
[0102] The above-mentioned using the light direction parameter for indicating the light direction as a weight, mixing the light color parameter and the fog color parameter, and obtaining the light-transmitting fog effect parameter of the virtual scene may refer to: using a linear interpolation function to process the light direction parameter, the light color parameter and the fog color parameter, and obtaining the light-transmitting fog effect parameter of the virtual scene. For example, using half3 scattringColor=lerp(_FogColor.rgb,_DirColor.rgb,dirFac) to obtain the light-transmitting fog effect parameter of the virtual scene.
[0103] In order to further reflect that when the game character is in different positions in the glass tunnel, or when the game character looks out of the glass tunnel at different angles, the fog effect that can be seen is different due to the influence of different light, the light-transmitting fog effect parameters of the virtual scene can also be obtained in advance. Figure 6, which is a schematic diagram for representing the light-transmitting fog effect parameters of a virtual scene, which may actually refer to a light-transmitting effect diagram of a target object. The light-transmitting effect diagram of the target object actually corresponds to a light-transmitting effect diagram of a virtual character at a specific position in a glass tunnel and looking out of the glass tunnel in a specific line of sight. In fact, when the position of the virtual character in the submarine tunnel changes or the line of sight to the outside of the glass tunnel changes, the light-transmitting effect diagram of the target object will change.
[0104] As a way of obtaining the light transmission effect diagram of the target object, it may refer to: obtaining the light transmission effect diagram of the target object based on the current light direction in the virtual scene.
[0105] In the underwater game scene, the light-transmitting effect diagram of the target object is the underwater light-transmitting effect diagram of the target object.
[0106] As a way to obtain the seabed light transmission effect map of the target object, it can refer to: obtaining the seabed light transmission effect map of the target object based on the current light direction in the game scene.
[0107] Specifically, based on the current light direction in the game scene, the seabed light transmission effect map of the target object can be obtained in the following manner: first, determine the current light direction in the game scene; then, based on the light direction, obtain the seabed light transmission effect map of the target object.
[0108] For details, please refer to Figure 5 , which is a schematic diagram for representing the current light direction. The schematic diagram for representing the current light direction includes parameters for representing the current light direction.
[0109] More specifically, the current light direction in the game scene can be determined in the following manner: first, the current light source direction in the game scene and the current sight direction of the game player in the game are determined; then, based on the light source direction and the sight direction, the current light direction in the game scene is determined. The current light direction in the game scene can be the direction of the sun's light relative to the game character, or it can also be the direction of light generated by other light sources relative to the game character.
[0110] In this embodiment, determining the current light direction in the game scene based on the light source direction and the line of sight direction may refer to: performing a dot product operation on a parameter used to represent the light source direction and a parameter used to represent the line of sight direction to determine the current light direction in the game scene.
[0111] In this embodiment, more specifically, based on the current light direction in the game scene, the seabed light transmission effect map of the target object is obtained, which can be referred to the following method: first, determine the current light color and seabed fog color in the game scene; then, use the light direction as a weight to mix the light color and the seabed fog color to obtain the light transmission fog effect parameters of the virtual scene; finally, use the seabed light transmission parameters to process the target object to obtain the seabed light transmission effect map of the target object.
[0112] The above method of using the light direction as a weight, mixing the light color and the seabed fog color, and obtaining the light-transmitting fog effect parameters of the virtual scene can actually be calculated using a linear interpolation function. That is, a linear interpolation function is used to calculate and process the parameters used to represent the light direction, the parameters used to represent the light color, and the parameters used to represent the seabed fog color to obtain the light-transmitting fog effect parameters of the virtual scene.
[0113] For example, when the parameter used to represent the direction of light is A, the parameter used to represent the color of light is B, and the parameter used to represent the color of seabed fog is C, the linear interpolation function calculation formula is A*B+(1-A)*C.
[0114] After obtaining the light-transmitting effect map, the disturbed depth texture map, the disturbed camera opaque texture map and the light-transmitting effect map may be superimposed to obtain a target image for display in a game interface on the user side.
[0115] After obtaining the disturbed depth texture map, the disturbed camera opaque texture map and the light-transmitting effect map, the disturbed depth texture map, the disturbed camera opaque texture map and the light-transmitting effect map are superimposed to obtain a target image for display in a game interface on the user side.
[0116] Specifically, the disturbed depth texture map, the disturbed camera opaque texture map, and the light-transmitting effect map are stacked to obtain a target image for display in a game interface on a user side, in the manner described below.
[0117] Firstly, based on the disturbed depth texture map, parameters for representing the depth range of the fog on the seabed are obtained; at the same time, based on the disturbed camera opacity texture map, parameters for representing the refraction effect of the target object are obtained.
[0118] Afterwards, the parameter used to represent the fog depth range of the seabed is used as a weight, and the parameter used to represent the refraction effect of the target object and the seabed transmittance parameter are mixed to obtain the target processing parameter used to process the target object.
[0119] After that, the target object is processed using the target processing parameters to obtain a target image for display in the game interface of the user end. Please refer to the final target image Figure 7 , which is a schematic diagram of the target image.
[0120] Specifically, using parameters for representing the fog depth range of the seabed as weights, mixing parameters for representing the refraction effect of the target object and seabed transmittance parameters, and obtaining target processing parameters for processing the target object may mean: using a linear interpolation function to process parameters for representing the fog depth range of the seabed, parameters for representing the refraction effect of the target object, and seabed transmittance parameters, and obtaining target processing parameters for processing the target object.
[0121] Step S206: Obtain rendering parameters for the target object according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter.
[0122] As a method of obtaining rendering parameters for a target object based on fog depth range parameters, refraction effect parameters and light-transmitting fog effect parameters, it can be: using fog depth range parameters as weights, mixing refraction effect parameters and light-transmitting fog effect parameters, and obtaining rendering parameters for the target object.
[0123] Specifically, the fog depth range parameter is used as a weight, and the refraction effect parameter and the light-transmitting fog effect parameter are mixed to obtain the rendering parameters for the target object. This may be: the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter are processed by a linear interpolation function to obtain the rendering parameters for the target object. For example, the rendering parameters for the target object are obtained by adopting the method of half3tunnelRefraction=lerp(refraction,scattringColor.rgb,refractedSceneDepth).
[0124] This step is actually equivalent to comparing the target object's light transmittance effect map with the disturbed depth texture map and the disturbed camera opaque texture map. The target image actually obtained can correspond to the fog effect outside the glass tunnel seen by the virtual character at a specific position in the glass tunnel and in a specific line of sight.
[0125] If the method in this embodiment is used on the server side, the method further includes: providing rendering parameters for the target object to the user side; wherein the user side is used to render on the display device screen based on the rendering parameters for the target object.
[0126] If the method in this embodiment is used on a user side, the method further includes: rendering on a display device screen of the user side based on rendering parameters for the target object.
[0127] Since the method maps the three-dimensional scene data of the virtual scene in the three-dimensional space to the two-dimensional space corresponding to the display device screen, the two-dimensional scene data of the virtual scene in the two-dimensional space is obtained; and the two-dimensional disturbance map, the two-dimensional scene depth map and the two-dimensional opaque map for the target object in the virtual scene are obtained according to the two-dimensional scene data; and the two-dimensional disturbance map is used to offset the two-dimensional scene depth map to obtain the fog depth range parameter used to represent the fog depth range in the virtual scene; at the same time, the two-dimensional disturbance map is used to offset the two-dimensional opaque map to obtain the refraction effect parameter used to represent the refraction effect of the target object; the light-transmitting fog effect parameter of the virtual scene is also obtained; finally, according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter, the rendering parameter for the target object is obtained. Since the final rendering parameter is obtained based on the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter, the rendering parameter takes into account the depth, refraction, light transmittance and other factors involved in the virtual scene, and the fog effect rendered based on the rendering parameter is closer to reality. At the same time, since the method processes two-dimensional information, the image processing efficiency is higher. Since the fog depth range parameters, refraction effect parameters and light-transmitting fog effect parameters are obtained during the processing, it is equivalent to having obtained the fog conditions in the virtual scene, and there is no need to calculate the fog effect separately.
[0128] Second embodiment
[0129] Corresponding to the first embodiment, the second embodiment of the present application provides a method for displaying a virtual scene image. Since the target image displayed in the second embodiment is obtained based on the method of the first embodiment, the parts of the second embodiment that are the same as the first embodiment will not be introduced again. Please refer to the relevant parts of the first embodiment for details.
[0130] Please refer to Figure 8 , which is a flowchart of the virtual scene image display method provided in the second embodiment of the present application.
[0131] The virtual scene image display method of the embodiment of the present application includes the following steps:
[0132] Step S801: Obtain rendering parameters for a target object.
[0133] In this embodiment, the rendering parameters for the target object are obtained by processing using the method of the first embodiment.
[0134] Step S802: Rendering is performed on the display device screen based on rendering parameters for the target object.
[0135] The rendering parameters rendered in this embodiment are obtained based on the method of the first embodiment: since the rendering parameters finally obtained by the method of the first embodiment are obtained based on fog depth range parameters, refraction effect parameters and light-transmitting fog effect parameters, the rendering parameters take into account factors such as depth, refraction, and light transmittance involved in the virtual scene, and the fog effect rendered based on the rendering parameters is closer to reality.
[0136] Third embodiment
[0137] Corresponding to the method provided in the first embodiment of the present application, the third embodiment of the present application further provides a virtual scene image processing device. Since the device embodiment is basically similar to the first embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the first embodiment. The device embodiment described below is only exemplary.
[0138] Please refer to Fig. 9 , which is a schematic diagram of a virtual scene image processing device provided in the third embodiment of the present application.
[0139] The virtual scene image processing device comprises:
[0140] A mapping unit 901 is used to map the three-dimensional scene data of the virtual scene in the three-dimensional space to the two-dimensional space corresponding to the display device screen, and obtain the two-dimensional scene data of the virtual scene in the two-dimensional space;
[0141] A disturbance map obtaining unit 902, configured to obtain a two-dimensional disturbance map for a target object in the virtual scene according to the two-dimensional scene data;
[0142] A first offset unit 903 is used to obtain a two-dimensional scene depth map for the virtual scene according to the two-dimensional scene data, and use the two-dimensional disturbance map to perform an offset process on the two-dimensional scene depth map to obtain a fog depth range parameter for representing a fog depth range in the virtual scene;
[0143] A second offset unit 904 is used to obtain a two-dimensional opaque map for the virtual scene according to the two-dimensional scene data, and use the two-dimensional disturbance map to perform an offset process on the two-dimensional opaque map to obtain a refraction effect parameter for representing the refraction effect of the target object;
[0144] A fog effect parameter obtaining unit 905, used to obtain light-transmitting fog effect parameters of the virtual scene;
[0145] The rendering parameter obtaining unit 906 is used to obtain the rendering parameters for the target object according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter.
[0146] Optionally, the two-dimensional disturbance map includes a refraction offset parameter of a first pixel point, and the two-dimensional scene depth map includes coordinates of a second pixel point;
[0147] The using the two-dimensional disturbance map to perform offset processing on the two-dimensional scene depth map to obtain a fog depth range parameter for representing the fog depth range in the virtual scene includes:
[0148] The refraction offset parameter of the first pixel point is used to offset the coordinates of the corresponding second pixel point in the two-dimensional scene depth map to obtain a fog depth range parameter for representing the fog depth range in the virtual scene.
[0149] Optionally, the two-dimensional disturbance map includes a refraction offset parameter of a first pixel point, and the two-dimensional opaque map includes coordinates of a third pixel point;
[0150] The using the two-dimensional disturbance map to perform offset processing on the two-dimensional opaque map to obtain a refraction effect parameter for representing the refraction effect of the target object includes:
[0151] The coordinates of the corresponding third pixel point in the two-dimensional opaque map are offset by using the refraction offset parameter of the first pixel point to obtain a refraction effect parameter for representing the refraction effect of the target object.
[0152] Optionally, obtaining the light-transmitting fog effect parameters of the virtual scene includes:
[0153] Determine the current light position in the virtual scene;
[0154] Based on the light direction, light-transmitting fog effect parameters of the virtual scene are obtained.
[0155] Optionally, determining the current light direction in the virtual scene includes:
[0156] Determine the current light source direction in the virtual scene and the current sight direction of the virtual character in the virtual scene;
[0157] Based on the light source direction and the sight line direction, a current light direction in the virtual scene is determined.
[0158] Optionally, determining the current light direction in the virtual scene based on the light source direction and the sight line direction includes:
[0159] A dot product operation is performed on the parameter used to represent the light source direction and the parameter used to represent the sight line direction to determine the current light direction in the virtual scene.
[0160] Optionally, obtaining the light-transmitting fog effect parameters of the virtual scene based on the light direction includes:
[0161] Determine a light color parameter for representing a current light color and a fog color parameter for representing a fog color in a virtual scene;
[0162] The light direction parameter used to represent the light direction is used as a weight, and the light color parameter and the fog color parameter are mixed to obtain a light-transmitting fog effect parameter of the virtual scene.
[0163] Optionally, the step of taking the light direction parameter used to represent the light direction as a weight, mixing the light color parameter and the fog color parameter, and obtaining the light-transmitting fog effect parameter of the virtual scene includes:
[0164] The light azimuth parameter, the light color parameter and the fog color parameter are processed by a linear interpolation function to obtain the light-transmitting fog effect parameter of the virtual scene.
[0165] Optionally, obtaining rendering parameters for the target object according to the fog depth range parameter, the refraction effect parameter, and the light-transmitting fog effect parameter includes:
[0166] The refraction effect parameter and the light-transmitting fog effect parameter are mixed with the fog depth range parameter as a weight to obtain a rendering parameter for the target object.
[0167] Optionally, the step of taking the fog depth range parameter as a weight, mixing the refraction effect parameter and the light-transmitting fog effect parameter, and obtaining the rendering parameter for the target object includes:
[0168] The fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter are processed using a linear interpolation function to obtain rendering parameters for the target object.
[0169] Optionally, the device is used for a server; the device also includes: a providing unit, used to provide the rendering parameters for the target object to a user terminal; wherein the user terminal is used to render on a display device screen based on the rendering parameters for the target object.
[0170] Optionally, the apparatus is used at a user end; the apparatus further comprises: a rendering unit, configured to render on a display device screen at the user end based on the rendering parameters for the target object.
[0171] Fourth embodiment
[0172] Corresponding to the method provided in the second embodiment of the present application, the fourth embodiment of the present application further provides a virtual scene image display device. Since the device embodiment is basically similar to the second embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the second embodiment. The device embodiment described below is only exemplary.
[0173] Please refer to Fig.10 , which is a schematic diagram of a virtual scene image display device provided in the fourth embodiment of the present application.
[0174] The virtual scene image display device comprises:
[0175] A rendering parameter obtaining unit 1001 is used to obtain rendering parameters for a target object; the rendering parameters for the target object are obtained by using the method of the first embodiment;
[0176] The rendering unit 1002 is used for rendering on the screen of the display device based on the rendering parameters for the target object.
[0177] Fifth embodiment
[0178] Corresponding to the methods of the first to second embodiments of the present application, the fifth embodiment of the present application further provides an electronic device.
[0179] like Fig.11 As shown, Fig.11 This is a schematic diagram of an electronic device provided in the fifth embodiment of the present application. The electronic device includes: a processor 1101; a memory 1102 for storing a computer program, the computer program is run by the processor to execute the methods of the first embodiment to the second embodiment.
[0180] Sixth embodiment
[0181] Corresponding to the methods of the first to second embodiments of the present application, the sixth embodiment of the present application further provides a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program is run by a processor to execute the methods of the first to second embodiments.
[0182] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0183] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0184] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. 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, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic 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. As defined herein, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0185] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0186] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
Claims
1. A virtual scene image processing method, characterized in that: include: Mapping three-dimensional scene data of a virtual scene in a three-dimensional space to a two-dimensional space corresponding to a display device screen to obtain two-dimensional scene data of the virtual scene in the two-dimensional space; Obtaining a two-dimensional disturbance map for a target object in the virtual scene according to the two-dimensional scene data; Obtaining a two-dimensional scene depth map for the virtual scene according to the two-dimensional scene data, and performing an offset process on the two-dimensional scene depth map using the two-dimensional disturbance map to obtain a fog depth range parameter for representing a fog depth range in the virtual scene; Obtaining a two-dimensional opaque map for the virtual scene according to the two-dimensional scene data, and performing an offset process on the two-dimensional opaque map using the two-dimensional disturbance map to obtain a refraction effect parameter for representing the refraction effect of the target object; Obtaining light-transmitting fog effect parameters of the virtual scene; Rendering parameters for the target object are obtained according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter.
2. The method according to claim 1, characterized in that The two-dimensional disturbance map includes a refraction offset parameter of a first pixel point, and the two-dimensional scene depth map includes coordinates of a second pixel point; The using the two-dimensional disturbance map to perform offset processing on the two-dimensional scene depth map to obtain a fog depth range parameter for representing the fog depth range in the virtual scene includes: The refraction offset parameter of the first pixel point is used to offset the coordinates of the corresponding second pixel point in the two-dimensional scene depth map to obtain a fog depth range parameter for representing the fog depth range in the virtual scene.
3. The method according to claim 1, characterized in that The two-dimensional disturbance map includes a refraction offset parameter of a first pixel point, and the two-dimensional opaque map includes coordinates of a third pixel point; The using the two-dimensional disturbance map to perform offset processing on the two-dimensional opaque map to obtain a refraction effect parameter for representing the refraction effect of the target object includes: The coordinates of the corresponding second pixel point in the two-dimensional opaque map are offset by using the refraction offset parameter of the first pixel point to obtain a refraction effect parameter for representing the refraction effect of the target object.
4. The method according to claim 1, characterized in that The step of obtaining the light-transmitting fog effect parameters of the virtual scene includes: Determine the current light position in the virtual scene; Based on the light direction, light-transmitting fog effect parameters of the virtual scene are obtained.
5. The method according to claim 4, characterized in that Determining the current light direction in the virtual scene includes: Determine the current light source direction in the virtual scene and the current sight direction of the virtual character in the virtual scene; Based on the light source direction and the sight line direction, a current light direction in the virtual scene is determined.
6. The method according to claim 5, characterized in that The determining the current light direction in the virtual scene based on the light source direction and the sight line direction includes: A dot product operation is performed on the parameter used to represent the light source direction and the parameter used to represent the sight line direction to determine the current light direction in the virtual scene.
7. The method according to claim 4, characterized in that The step of obtaining the light-transmitting fog effect parameters of the virtual scene based on the light direction includes: Determine a light color parameter for representing a current light color and a fog color parameter for representing a fog color in a virtual scene; The light direction parameter used to represent the light direction is used as a weight, and the light color parameter and the fog color parameter are mixed to obtain a light-transmitting fog effect parameter of the virtual scene.
8. The method according to claim 7, characterized in that The step of using the light direction parameter used to represent the light direction as a weight, mixing the light color parameter and the fog color parameter, and obtaining the light-transmitting fog effect parameter of the virtual scene includes: The light azimuth parameter, the light color parameter and the fog color parameter are processed by a linear interpolation function to obtain the light-transmitting fog effect parameter of the virtual scene.
9. The method according to claim 1, characterized in that: The obtaining, according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter, a rendering parameter for the target object comprises: The refraction effect parameter and the light-transmitting fog effect parameter are mixed with the fog depth range parameter as a weight to obtain a rendering parameter for the target object.
10. The method according to claim 9, characterized in that The step of taking the fog depth range parameter as a weight, mixing the refraction effect parameter and the light-transmitting fog effect parameter, and obtaining the rendering parameter for the target object includes: The fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter are processed using a linear interpolation function to obtain rendering parameters for the target object.
11. The method according to claim 1, characterized in that: The method is used on the server side; the method also includes: The rendering parameters for the target object are provided to a user terminal, wherein the user terminal is used to render on a display device screen based on the rendering parameters for the target object.
12. The method according to claim 1, characterized in that The method is used at a user end; the method further comprises: Rendering is performed on a display device screen of the user terminal based on the rendering parameters for the target object.
13. A method for displaying a virtual scene image, characterized in that: include: Get rendering parameters for the target object; The rendering parameters for the target object are obtained by processing using the method described in any one of claims 1 to 12; Rendering is performed on a display device screen based on the rendering parameters for the target object.
14. A virtual scene image processing device, characterized in that: include: A mapping unit, used to map the three-dimensional scene data of the virtual scene in the three-dimensional space to the two-dimensional space corresponding to the screen of the display device, and obtain the two-dimensional scene data of the virtual scene in the two-dimensional space; A disturbance map obtaining unit, configured to obtain a two-dimensional disturbance map for a target object in the virtual scene according to the two-dimensional scene data; A first offset unit, configured to obtain a two-dimensional scene depth map for the virtual scene according to the two-dimensional scene data, and to perform an offset process on the two-dimensional scene depth map using the two-dimensional disturbance map to obtain a fog depth range parameter for representing a fog depth range in the virtual scene; A second offset unit, configured to obtain a two-dimensional opaque map for the virtual scene according to the two-dimensional scene data, and perform an offset process on the two-dimensional opaque map using the two-dimensional disturbance map to obtain a refraction effect parameter for representing a refraction effect of the target object; A fog effect parameter obtaining unit, used to obtain light-transmitting fog effect parameters of the virtual scene; The rendering parameter obtaining unit is used to obtain the rendering parameters for the target object according to the fog depth range parameter, the refraction effect parameter and the light-transmitting fog effect parameter.
15. A virtual scene image display device, characterized in that: include: A rendering parameter obtaining unit, used to obtain rendering parameters for a target object; The rendering parameters for the target object are obtained by processing using the method described in any one of claims 1 to 12; A rendering unit is used for rendering on a display device screen based on the rendering parameters for the target object.
16. An electronic device, characterized in that: include: processor; A memory for storing a computer program, wherein the computer program is executed by a processor to perform the method according to any one of claims 1 to 13.
17. A computer storage medium, characterized in that: The computer storage medium stores a computer program, which is executed by a processor to perform the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Proxy training data for human body tracking
CN102194105A
Interactive interface rendering method and device, electronic equipment and storage medium
CN110196746A